|
21 | 21 | from .comm.comm import BaseComm
|
22 | 22 | from .comm.manager import CommManager
|
23 | 23 | from .compiler import XCachingCompiler
|
24 |
| -from .debugger import Debugger, _is_debugpy_available |
25 | 24 | from .eventloops import _use_appnope
|
26 | 25 | from .iostream import OutStream
|
27 | 26 | from .kernelbase import Kernel as KernelBase
|
@@ -75,9 +74,7 @@ class IPythonKernel(KernelBase):
|
75 | 74 | help="Set this flag to False to deactivate the use of experimental IPython completion APIs.",
|
76 | 75 | ).tag(config=True)
|
77 | 76 |
|
78 |
| - debugpy_socket = ( |
79 |
| - Instance(zmq.asyncio.Socket, allow_none=True) if _is_debugpy_available else None |
80 |
| - ) |
| 77 | + debugpy_socket = Instance(zmq.asyncio.Socket, allow_none=True) |
81 | 78 |
|
82 | 79 | user_module = Any()
|
83 | 80 |
|
@@ -107,6 +104,8 @@ def __init__(self, **kwargs):
|
107 | 104 |
|
108 | 105 | self.executing_blocking_code_in_main_shell = False
|
109 | 106 |
|
| 107 | + from .debugger import Debugger, _is_debugpy_available |
| 108 | + |
110 | 109 | # Initialize the Debugger
|
111 | 110 | if _is_debugpy_available:
|
112 | 111 | self.debugger = Debugger(
|
@@ -214,13 +213,17 @@ async def process_debugpy(self):
|
214 | 213 | tg.cancel_scope.cancel()
|
215 | 214 |
|
216 | 215 | async def receive_debugpy_messages(self):
|
| 216 | + from .debugger import _is_debugpy_available |
| 217 | + |
217 | 218 | if not _is_debugpy_available:
|
218 | 219 | return
|
219 | 220 |
|
220 | 221 | while True:
|
221 | 222 | await self.receive_debugpy_message()
|
222 | 223 |
|
223 | 224 | async def receive_debugpy_message(self, msg=None):
|
| 225 | + from .debugger import _is_debugpy_available |
| 226 | + |
224 | 227 | if not _is_debugpy_available:
|
225 | 228 | return
|
226 | 229 |
|
@@ -506,6 +509,8 @@ def do_complete(self, code, cursor_pos):
|
506 | 509 |
|
507 | 510 | async def do_debug_request(self, msg):
|
508 | 511 | """Handle a debug request."""
|
| 512 | + from .debugger import _is_debugpy_available |
| 513 | + |
509 | 514 | if _is_debugpy_available:
|
510 | 515 | return await self.debugger.process_request(msg)
|
511 | 516 | return None
|
|
0 commit comments