Comments (5)
Is this possible right now?
An option could be to run debugpy within the jupyter notebook using the APIs described here: https://github.com/microsoft/debugpy/#enabling-debugging and then attach to it.
Using jupyter's own debugging mechanism is afaik currently not possible, and would require a custom implementation
Or is it easy to implement?
It looks like jupyter has its own transport (zeromq?) and wraps DAP messages in their own requests: https://jupyter-client.readthedocs.io/en/stable/messaging.html#debug-request
On a first glance it seems as if the vscode-jupyter extension takes care of translating that: https://github.com/microsoft/vscode-jupyter/blob/c0b8e355de960f0ba393235066059167aeadb3b7/src/notebooks/debugger/kernelDebugAdapterBase.ts
It should be possible to do something like that with nvim-dap, but not without some effort. It's also out-of-scope for nvim-dap-python and would probably deserve it's own extension
from nvim-dap-python.
I never tried but I thinkg that using jupytext, https://github.com/goerz/jupytext.vim, you can open a ipynb, convert it to python script underhood and then you should be able to debug it as if it was a regular python script.
from nvim-dap-python.
Yes, I can do that. The problem is that I am not able to debug a single cell. To debug I would have to run the whole file, but this is not ideal since, for example, I may want to debug the last cell without running the first part of the notebook/script. I am currently using jupytext
and sending cells to an REPL.
from nvim-dap-python.
Oh, I see the point! I concur with @mfussenegger, I think that is a very concrete implementation.
A bit offtopick, I drop here some ideas in case it could help: Personally, I would execute the whole file many times or, if I really needed, I would create a MRE. A quick way to get it done is using dill e.g. https://stackoverflow.com/a/35296032. I'm not a fan of notebooks as it's easy to mess it up and/or forget good practises, so I would check if there is a design problem on it (lack of class or high level function, or a utils module to import function from) .
from nvim-dap-python.
Closing this here since it's out of scope for nvim-dap-python, but it would be really cool to see a nvim-jupyter extension that includes dap support.
from nvim-dap-python.
Related Issues (20)
- Debugger current working directory HOT 1
- crash on input()
- unintuitive configuration on Windows HOT 1
- debugging a flask application crashes before starting HOT 1
- Provide more configuration examples HOT 1
- Windows venv detection HOT 3
- Custom visualization of dataframes HOT 2
- how to debug with arguments?
- Debugpy - Windows HOT 4
- ModuleImportError when running from Pyenv HOT 6
- [Feature Request] `test_file`, `test_dir` & `test_all` HOT 2
- Help needed for compatibility with nvim-lua/kickstart HOT 1
- `os.fork` indefinitely waiting HOT 1
- Django and multiprocess HOT 8
- regression on detection of python bin HOT 1
- Debugging pytest test method fails on dap.continue() but works with dep.test_method() HOT 3
- type python deprecated in favor of debugpy HOT 2
- DAP `test_method` not uses `VIRTUAL_ENV` path HOT 2
- python not found in virtual environment HOT 4
- how to debug main method using pytest HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvim-dap-python.