-
-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make debugger class configurable #1307
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
from .comm.comm import BaseComm | ||
from .comm.manager import CommManager | ||
from .compiler import XCachingCompiler | ||
from .debugger import Debugger, _is_debugpy_available | ||
from .eventloops import _use_appnope | ||
from .iostream import OutStream | ||
from .kernelbase import Kernel as KernelBase | ||
|
@@ -71,6 +72,8 @@ class IPythonKernel(KernelBase): | |
shell = Instance("IPython.core.interactiveshell.InteractiveShellABC", allow_none=True) | ||
shell_class = Type(ZMQInteractiveShell) | ||
|
||
debugger_class = Type(Debugger) | ||
|
||
use_experimental_completions = Bool( | ||
True, | ||
help="Set this flag to False to deactivate the use of experimental IPython completion APIs.", | ||
|
@@ -110,11 +113,9 @@ def __init__(self, **kwargs): | |
|
||
self.executing_blocking_code_in_main_shell = False | ||
|
||
from .debugger import Debugger, _is_debugpy_available | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like #1223 intentionally introduced this lazy import. Let's make sure we're addressing the need there as well before making this an eager import at the top of the file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In particular, does this change mean that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CC @krassowski who made this lazy import change earlier this year. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for spotting, yes this is intentional to address #1198 |
||
|
||
# Initialize the Debugger | ||
if _is_debugpy_available: | ||
self.debugger = Debugger( | ||
self.debugger = self.debugger_class( | ||
self.log, | ||
self.debugpy_socket, | ||
self._publish_debug_event, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also give this class as a full-specified dotted string (like in the shell instance above), so we could move the import above back to being an on-demand import in the class definition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should work:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion; I think if I do this I can omit the import altogether?
EDIT: for Debugger, but not for
_is_debugpy_available
I guess