Skip to content

Commit 3867c33

Browse files
make debugger class configurable (#1307)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 4f42f03 commit 3867c33

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

ipykernel/ipkernel.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ class IPythonKernel(KernelBase):
7171
shell = Instance("IPython.core.interactiveshell.InteractiveShellABC", allow_none=True)
7272
shell_class = Type(ZMQInteractiveShell)
7373

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+
7480
use_experimental_completions = Bool(
7581
True,
7682
help="Set this flag to False to deactivate the use of experimental IPython completion APIs.",
@@ -110,11 +116,11 @@ def __init__(self, **kwargs):
110116

111117
self.executing_blocking_code_in_main_shell = False
112118

113-
from .debugger import Debugger, _is_debugpy_available
119+
from .debugger import _is_debugpy_available
114120

115121
# Initialize the Debugger
116122
if _is_debugpy_available:
117-
self.debugger = Debugger(
123+
self.debugger = self.debugger_class(
118124
self.log,
119125
self.debugpy_socket,
120126
self._publish_debug_event,
@@ -130,7 +136,7 @@ def __init__(self, **kwargs):
130136
user_module=self.user_module,
131137
user_ns=self.user_ns,
132138
kernel=self,
133-
compiler_class=XCachingCompiler,
139+
compiler_class=self.compiler_class,
134140
)
135141
self.shell.displayhook.session = self.session # type:ignore[attr-defined]
136142

0 commit comments

Comments
 (0)