Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions ipykernel/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,14 @@ class Debugger:
'richInspectVariables', 'modules'
]

def __init__(self, log, debugpy_stream, event_callback, shell_socket, session):
def __init__(self, log, debugpy_stream, event_callback, shell_socket, session, just_my_code = True):
self.log = log
self.debugpy_client = DebugpyClient(log, debugpy_stream, self._handle_event)
self.shell_socket = shell_socket
self.session = session
self.is_started = False
self.event_callback = event_callback
self.just_my_code = just_my_code
self.stopped_queue = Queue()

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

async def configurationDone(self, message):
Expand Down
3 changes: 2 additions & 1 deletion ipykernel/ipkernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def __init__(self, **kwargs):
self.debugpy_stream,
self._publish_debug_event,
self.debug_shell_socket,
self.session)
self.session,
self.debug_just_my_code)

# Initialize the InteractiveShell subclass
self.shell = self.shell_class.instance(parent=self,
Expand Down
9 changes: 9 additions & 0 deletions ipykernel/kernelbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ def _default_ident(self):
# any links that should go in the help menu
help_links = List()

# Experimental option to break in non-user code.
# The ipykernel source is in the call stack, so the user
# has to manipulate the step-over and step-into in a wize way.
debug_just_my_code = Bool(True,
help="""Set to False if you want to debug python standard and dependent libraries.
"""
).tag(config=True)

# track associations with current request
# Private interface

_darwin_app_nap = Bool(True,
Expand Down