Skip to content

[WIP] Add an advertise_debugger option so kernel_info need not import debugpy - #1545

Draft
Carreau wants to merge 1 commit into
ipython:mainfrom
Carreau:force-reply-kinfo
Draft

[WIP] Add an advertise_debugger option so kernel_info need not import debugpy#1545
Carreau wants to merge 1 commit into
ipython:mainfrom
Carreau:force-reply-kinfo

Conversation

@Carreau

@Carreau Carreau commented Aug 9, 2026

Copy link
Copy Markdown
Member

Deferring the debugger construction does not on its own keep debugpy out of a kernel: kernel_info imports .debugger to fill in supported_features, and every frontend sends a kernel_info_request at startup -- jupyter_client's wait_for_ready re-sends it until it gets a reply, on start and on every restart. Left alone, the import is merely moved from initialisation into the first shell request.

Add an advertise_debugger trait, auto|true|false, defaulting to auto so nothing changes by default. "auto" asks the debugger module as before; "true" and "false" answer kernel_info without importing anything, which lets a deployment that already knows whether debugpy is available keep it out of the process entirely.

The option only controls what is advertised: setting it to "true" where debugpy is unavailable does not make debug requests work.


We can also do Bool with allow_none=True, I don't care much, this look more explicit. Just for discussion for now.

Deferring the debugger construction does not on its own keep debugpy out of a
kernel: `kernel_info` imports `.debugger` to fill in `supported_features`, and
every frontend sends a kernel_info_request at startup -- jupyter_client's
`wait_for_ready` re-sends it until it gets a reply, on start and on every
restart. Left alone, the import is merely moved from initialisation into the
first shell request.

Add an `advertise_debugger` trait, auto|true|false, defaulting to auto so
nothing changes by default. "auto" asks the debugger module as before; "true"
and "false" answer kernel_info without importing anything, which lets a
deployment that already knows whether debugpy is available keep it out of the
process entirely.

The option only controls what is advertised: setting it to "true" where
debugpy is unavailable does not make debug requests work.
@Carreau

Carreau commented Aug 9, 2026

Copy link
Copy Markdown
Member Author

Alternative is caching on disk the environemnt, package version... etc, or just using find_spec to know wether debugpy is installed without actually loading it. I'm happy leaving on auto for most deployments and leaving this as a tunable value for large deployments even if i would like to have it fast for everybody.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant