@@ -71,6 +71,12 @@ class IPythonKernel(KernelBase):
71
71
shell = Instance ("IPython.core.interactiveshell.InteractiveShellABC" , allow_none = True )
72
72
shell_class = Type (ZMQInteractiveShell )
73
73
74
+ # use fully-qualified name to ensure lazy import and prevent the issue from
75
+ # https://github.com/ipython/ipykernel/issues/1198
76
+ debugger_class = Type ("ipykernel.debugger.Debugger" )
77
+
78
+ compiler_class = Type (XCachingCompiler )
79
+
74
80
use_experimental_completions = Bool (
75
81
True ,
76
82
help = "Set this flag to False to deactivate the use of experimental IPython completion APIs." ,
@@ -110,11 +116,11 @@ def __init__(self, **kwargs):
110
116
111
117
self .executing_blocking_code_in_main_shell = False
112
118
113
- from .debugger import Debugger , _is_debugpy_available
119
+ from .debugger import _is_debugpy_available
114
120
115
121
# Initialize the Debugger
116
122
if _is_debugpy_available :
117
- self .debugger = Debugger (
123
+ self .debugger = self . debugger_class (
118
124
self .log ,
119
125
self .debugpy_socket ,
120
126
self ._publish_debug_event ,
@@ -130,7 +136,7 @@ def __init__(self, **kwargs):
130
136
user_module = self .user_module ,
131
137
user_ns = self .user_ns ,
132
138
kernel = self ,
133
- compiler_class = XCachingCompiler ,
139
+ compiler_class = self . compiler_class ,
134
140
)
135
141
self .shell .displayhook .session = self .session # type:ignore[attr-defined]
136
142
0 commit comments