-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jupyter cell debugging does not support "step into" the third party library code with "justmycode:false" #8146
Comments
can not step into lib code even setting: |
This is explicitly hardcoded here:
Likely because stepping into 3rd party code isn't going to do what you want. It will end up stepping through the display hooks for ipython and not the 3rd party library. @int19h is there a way to add libs to the 'justMyCode' list? |
I don't think we have anything documented for this, but pydevd exposes some environment variables to control this. Presumably you'd want the library to debug to be listed in I wonder if perhaps the Jupyter extension should be using the exclusion filters on a lower level to specifically exclude all those display hooks, while leaving "justMyCode" setting to the user? |
That sounds interesting too. How do we set exclusion filters? |
It's all in the same code linked above, so currently, also via env vars (or using pydevd APIs). But we can always plumb that API through debugpy as needed. |
Thanks, where does the justMyCode flag actually come in, is it implemented using those flags? |
In case it's helpful to others until this is addressed, I've been able to workaround the issue effectively using IDE_PROJECT_ROOTS as suggested but would note one needs to add the appropriate ipykernel temp files directory (/tmp by default on Linux) in addition to the third party library code in IDE_PROJECT_ROOTS, e.g.: IDE_PROJECT_ROOTS=/tmp:/opt/miniconda/envs/<myenv>/lib/<python_ver>/site-packages/<target third party lib> otherwise, the 3rd-party breakpoints will work but the other breakpoints you set in your notebook will stop working. Hope this helps! |
Ok. After about 20 hours of trying, I got vscode to step into to dependent python libraries during debugging. I'm running Jupyter works too. You have to use 'base' python interpreters - NOT python environments in vscode, and set 'justmycode' to false in vscode's launch.json. My dependent library modules are in a subdirectory of the directory that contains my Jupyter notebook and is the first directory listed when I run 'os.sys.path' Hope this helps! |
Oops, yep thanks. But does ipykernel import that debugger.py right away? |
Apparently yes: https://github.com/ipython/ipykernel/blob/main/ipykernel/ipkernel.py#L19 |
Note: I also created an issue ipython/ipykernel#1004 for |
Thanks. I suppose that we can also actually spawn the kernel with the proper environment. But it really seems like the proper thing is for ipykernel to set this flag. Any reason we haven't already brought it up with them? Does Jupyter Lab know about this or have a solution to this? |
Well, I just brought it up in that ticket (ipython/ipykernel#1004) -- some ipython devs were on microsoft/debugpy#869, so I thought they were up to date on this, but maybe they didn't notice it. |
Don pushed a change in #11682 to spawn the kernel with the environment variable set, and I confirmed that with that change, justMyCode can work perfectly. So we have that for local kernels, and we just have to keep on top of ipython/ipykernel#1004 as well. Thanks @fabioz and @DonJayamanne! |
Hm, this is actually not working for the Interactive Window. When I start debugging, I always start at that same line in interactiveshell.py as above #8146 (comment) and can't hit a breakpoint in the cell code. I confirmed that the fix from yesterday is applying to the IW so I see |
I figured out that this happens with the @fabioz do you expect |
We can probably get that working using a normal breakpoint. I'll open a new issue for that. |
When you use What you can do instead in this case is ask the debugger to stop just in user code. The api for this is not as simple as just If you know that you want to stop just at the main thread you can do something as:
Note that this works just for the main thread (because |
To anyone else coming here looking for an answer
This takes in the solution of the highest rated answer above and puts it into actual extension. |
holy jesus christ! |
This is lifechanging! |
Alright it's still not the best it could be, but still: |
Okay, this is actually falling apart.... oh jeez I thought I'm saved but this is getting uglier and uglier : ( |
OH YES!!! I'm saaaaaaaaaaaaved !!!! :D |
Jupyter cell debugging does not support "step into" the third party library code with "justmycode:false" in launch.json.
Please fix it !
The text was updated successfully, but these errors were encountered: