|
22 | 22 | from .comm.comm import BaseComm
|
23 | 23 | from .comm.manager import CommManager
|
24 | 24 | from .compiler import XCachingCompiler
|
25 |
| -from .debugger import Debugger, _is_debugpy_available |
26 | 25 | from .eventloops import _use_appnope
|
27 | 26 | from .iostream import OutStream
|
28 | 27 | from .kernelbase import Kernel as KernelBase
|
@@ -81,7 +80,7 @@ class IPythonKernel(KernelBase):
|
81 | 80 | help="Set this flag to False to deactivate the use of experimental IPython completion APIs.",
|
82 | 81 | ).tag(config=True)
|
83 | 82 |
|
84 |
| - debugpy_stream = Instance(ZMQStream, allow_none=True) if _is_debugpy_available else None |
| 83 | + debugpy_stream = Instance(ZMQStream, allow_none=True) |
85 | 84 |
|
86 | 85 | user_module = Any()
|
87 | 86 |
|
@@ -109,6 +108,8 @@ def __init__(self, **kwargs):
|
109 | 108 | """Initialize the kernel."""
|
110 | 109 | super().__init__(**kwargs)
|
111 | 110 |
|
| 111 | + from .debugger import Debugger, _is_debugpy_available |
| 112 | + |
112 | 113 | # Initialize the Debugger
|
113 | 114 | if _is_debugpy_available:
|
114 | 115 | self.debugger = Debugger(
|
@@ -209,6 +210,8 @@ def __init__(self, **kwargs):
|
209 | 210 | }
|
210 | 211 |
|
211 | 212 | def dispatch_debugpy(self, msg):
|
| 213 | + from .debugger import _is_debugpy_available |
| 214 | + |
212 | 215 | if _is_debugpy_available:
|
213 | 216 | # The first frame is the socket id, we can drop it
|
214 | 217 | frame = msg[1].bytes.decode("utf-8")
|
@@ -524,6 +527,8 @@ def do_complete(self, code, cursor_pos):
|
524 | 527 |
|
525 | 528 | async def do_debug_request(self, msg):
|
526 | 529 | """Handle a debug request."""
|
| 530 | + from .debugger import _is_debugpy_available |
| 531 | + |
527 | 532 | if _is_debugpy_available:
|
528 | 533 | return await self.debugger.process_request(msg)
|
529 | 534 | return None
|
|
0 commit comments