Skip to content

Add jupyter.debugRules to expose rules-option of debugpy #16990

@iFreilicht

Description

@iFreilicht

What

I would like to have an option jupyter.debugRules that sets the debugpy rules-Option. This option is currently not documented, see microsoft/debugpy#1958 and the linked issues, but it has been implemented since almost 7 years, see microsoft/debugpy@4f7abad

So in my settings.json I could write

"jupyter.debugRules": [
    { "path": "${workspaceFolder}/src/libs/custom_cache" }
]

to exclude all files in src/libs/custom_cache from debugging.

Why

This feature would be useful to mark certain modules as excluded from debugging, which makes it possible to skip certain function decorators or Metaclasses and focus on the meat of my business-logic when using "Step Into". I can already do this when debugging tests, but for Notebooks it would require support from vscode-jupyter.

Alternative solutions

The only alternative I can think of would be to support debug configurations outright by registering a "purpose" like it is already possible for Tests, see https://code.visualstudio.com/docs/python/testing#_debug-tests, so I could add a configuration to launch.json like this:

      {
            "name": "Debug Test or Notebook",
            "type": "debugpy",
            "purpose": [
                "debug-jupyter-notebook", "debug-test"
            ],
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true,
            "rules": [
                { "path": "${workspaceFolder}/src/libs/custom_cache" }
            ]
        },

This would be preferrable in some cases to keep the configuration between tests and notebooks in sync, though I'm not sure whether it is technically feasible. There might be limitations like those mentioned in #8146 (comment)

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionality

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions