Skip to content

Commit 6162765

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

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
@@ -77,6 +77,12 @@ class IPythonKernel(KernelBase):
7777
shell = Instance("IPython.core.interactiveshell.InteractiveShellABC", allow_none=True)
7878
shell_class = Type(ZMQInteractiveShell)
7979

80+
# use fully-qualified name to ensure lazy import and prevent the issue from
81+
# https://github.com/ipython/ipykernel/issues/1198
82+
debugger_class = Type("ipykernel.debugger.Debugger")
83+
84+
compiler_class = Type(XCachingCompiler)
85+
8086
use_experimental_completions = Bool(
8187
True,
8288
help="Set this flag to False to deactivate the use of experimental IPython completion APIs.",
@@ -114,11 +120,11 @@ def __init__(self, **kwargs):
114120
"""Initialize the kernel."""
115121
super().__init__(**kwargs)
116122

117-
from .debugger import Debugger, _is_debugpy_available
123+
from .debugger import _is_debugpy_available
118124

119125
# Initialize the Debugger
120126
if _is_debugpy_available:
121-
self.debugger = Debugger(
127+
self.debugger = self.debugger_class(
122128
self.log,
123129
self.debugpy_stream,
124130
self._publish_debug_event,
@@ -134,7 +140,7 @@ def __init__(self, **kwargs):
134140
user_module=self.user_module,
135141
user_ns=self.user_ns,
136142
kernel=self,
137-
compiler_class=XCachingCompiler,
143+
compiler_class=self.compiler_class,
138144
)
139145
self.shell.displayhook.session = self.session # type:ignore[attr-defined]
140146

0 commit comments

Comments
 (0)