You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add ability to specify files to skip debugging #1170
This is similar to justMyCode, but more fine-grained.
In my use of debugpy, another python file is being run to run my unittests, and therefore after debugging a unit test I always end up in this file. It would be great to be able to specify manually to never debug it.
This index is basically a dict with all the cities of France, with keys as city_code.
When I try to debug my project it spends an infinite time to just import the variable COMMUNES_INDEX (honestly I've never had the patience to wait until this step is done, it is useless) :
# in file : module.pyfromapi.servicesimportCOMMUNES_INDEX
Note that I encounter no problem to run my code (not in debug mode).
So I want to tell debugpy to not debug the __init__.py file at all. Is there anyway I can achieve that ? The trick proposed here does not work on my setup. In the launch.json I have this warning : Property rules is not allowed.
I think this feature should be improved or at least make more user-friendly like in C# where when clicking "All Exceptions" in VSCode for C#, it allows you to write an expression to skip functions or similar.
I am having an issue where in Python, that feature for "Raised Exceptions" does not exist, so I am having a hard time trying to skip files for debugging breakpoints, specifically: "/pymeta_generated_code/pymeta_grammar__Grammar.py" since there's no way to copy the file path with right-click, so I have to do it manually per each friggin' file that appears.
Oh, I so wish there was a feature where you could right-click the open tab in VSCode and have an option that says "Skip file for breakpoints" and it auto-adds the file in your VSCode exception system, just like good ol' Visual Studio.
Are rules supposed to work with unit tests? I'm having trouble with third-partly libraries that are installed to a non-standard location and added to PYTHONPATH one by one. The debugger thinks it's my code but I want to ignore exceptions that are raised from the third-party lib but handled by the standard library between my code and the third-party lib.
Activity
karthiknadig commentedon Jan 11, 2023
We do have it, it is un-documented feature:
{ "name": "Python: Current File", "type": "python", "request": "launch", "program": "${file}", "console": "integratedTerminal", "justMyCode": true, "rules": [ {"path": "path_to_file_or_dir", "include": false}, ] }AlexSWall commentedon Jan 12, 2023
Ah great, thanks, I realize why it wasn't working for me initially. I was including
~at the start for my home directory, and this didn't expand.ezhang7423 commentedon Mar 27, 2024
Thanks, this worked perfectly for me!
lionpeloux commentedon Oct 11, 2024
Hi there,
I have a project with a huge (350k lines) persisted search index that I've put in a global variable in my
__init__.py:This index is basically a
dictwith all the cities of France, with keys ascity_code.When I try to debug my project it spends an infinite time to just import the variable
COMMUNES_INDEX(honestly I've never had the patience to wait until this step is done, it is useless) :Note that I encounter no problem to run my code (not in debug mode).
So I want to tell
debugpyto not debug the__init__.pyfile at all. Is there anyway I can achieve that ? The trick proposed here does not work on my setup. In thelaunch.jsonI have this warning : Property rules is not allowed.{ "configurations": [ { "name": "Python Debugger: Current File", "type": "debugpy", "request": "launch", "program": "${file}", "console": "integratedTerminal", "justMyCode": true, "rules": [ { "path": "path_to_file_or_dir", "include": false }, ] }, ] }rchiodo commentedon Oct 11, 2024
The warning in the launch.json is because the "rules" option is undocumented. VS code doesn't know about it. It's implemented here:
debugpy/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py
Line 66 in 39879bd
Did you try 3.12? Might be a lot faster. I think it depends upon whether or not we're trying to eval that giant dict.
lionpeloux commentedon Oct 18, 2024
Ok, I've just came back to this today, and now it is working, I really dont know why/how ...
I'm on 3.12 indeed.
Thanks for your quick reply anyway !
darkguy2008 commentedon Apr 29, 2025
I think this feature should be improved or at least make more user-friendly like in C# where when clicking "All Exceptions" in VSCode for C#, it allows you to write an expression to skip functions or similar.
I am having an issue where in Python, that feature for "Raised Exceptions" does not exist, so I am having a hard time trying to skip files for debugging breakpoints, specifically: "/pymeta_generated_code/pymeta_grammar__Grammar.py" since there's no way to copy the file path with right-click, so I have to do it manually per each friggin' file that appears.
Oh, I so wish there was a feature where you could right-click the open tab in VSCode and have an option that says "Skip file for breakpoints" and it auto-adds the file in your VSCode exception system, just like good ol' Visual Studio.
rchiodo commentedon Apr 29, 2025
The rule does support globs, You should be able to add a glob like
/pymeta_generated_code/**/*.pydobos commentedon Jun 24, 2025
Are rules supposed to work with unit tests? I'm having trouble with third-partly libraries that are installed to a non-standard location and added to PYTHONPATH one by one. The debugger thinks it's my code but I want to ignore exceptions that are raised from the third-party lib but handled by the standard library between my code and the third-party lib.
rchiodo commentedon Jun 24, 2025
The rules should allow you to mark any file as 'system' code (or not included).