Skip to content

Commit aa1e7a0

Browse files
authored
Merge pull request #863 from datalayer-externals/conf/just-my-code
2 parents 2ad426e + bd0f200 commit aa1e7a0

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

ipykernel/debugger.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,14 @@ class Debugger:
270270
'richInspectVariables', 'modules'
271271
]
272272

273-
def __init__(self, log, debugpy_stream, event_callback, shell_socket, session):
273+
def __init__(self, log, debugpy_stream, event_callback, shell_socket, session, just_my_code = True):
274274
self.log = log
275275
self.debugpy_client = DebugpyClient(log, debugpy_stream, self._handle_event)
276276
self.shell_socket = shell_socket
277277
self.session = session
278278
self.is_started = False
279279
self.event_callback = event_callback
280+
self.just_my_code = just_my_code
280281
self.stopped_queue = Queue()
281282

282283
self.started_debug_handlers = {}
@@ -515,11 +516,12 @@ async def attach(self, message):
515516
'port': port
516517
}
517518
message['arguments']['logToFile'] = True
518-
# Reverts that option for now since it leads to spurious break of the code
519-
# in ipykernel source and resuming the execution leads to several errors
520-
# in the kernel.
519+
# Experimental option to break in non-user code.
520+
# The ipykernel source is in the call stack, so the user
521+
# has to manipulate the step-over and step-into in a wize way.
521522
# Set debugOptions for breakpoints in python standard library source.
522-
# message['arguments']['debugOptions'] = [ 'DebugStdLib' ]
523+
if not self.just_my_code:
524+
message['arguments']['debugOptions'] = [ 'DebugStdLib' ]
523525
return await self._forward_message(message)
524526

525527
async def configurationDone(self, message):

ipykernel/ipkernel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ def __init__(self, **kwargs):
8383
self.debugpy_stream,
8484
self._publish_debug_event,
8585
self.debug_shell_socket,
86-
self.session)
86+
self.session,
87+
self.debug_just_my_code)
8788

8889
# Initialize the InteractiveShell subclass
8990
self.shell = self.shell_class.instance(parent=self,

ipykernel/kernelbase.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,15 @@ def _default_ident(self):
128128
# any links that should go in the help menu
129129
help_links = List()
130130

131+
# Experimental option to break in non-user code.
132+
# The ipykernel source is in the call stack, so the user
133+
# has to manipulate the step-over and step-into in a wize way.
134+
debug_just_my_code = Bool(True,
135+
help="""Set to False if you want to debug python standard and dependent libraries.
136+
"""
137+
).tag(config=True)
138+
139+
# track associations with current request
131140
# Private interface
132141

133142
_darwin_app_nap = Bool(True,

0 commit comments

Comments
 (0)