Reputation: 167
I usually use Matlab for processing results. However I'm required now to use Python. I want to set a breakpoint in a Python Jupyter notebook to go through functions. I was able to set up breakpoint but I can't actually go line by line debugging with this breakpoint. In Matlab I used to press F10 to do this.
Upvotes: 1
Views: 2953
Reputation: 9984
In JupyterLab with the Xeus Python kernel (often tagged with 'XPython' when you are choosing the kernel) you can use the visual debugger. The run-next-line feature is the 'Next' button in the 'CALLSTACK' pane of the debugger panel. See the animation here for the 'Next' tooltip when hovering. And, although not featured in that animation, the tool tip actually shows 'Next (F10)' presently in my browser.
You can try it by clicking here. The session that spins up starts with a notebook open that has a nice introduction and guide to the features.
More can be found about the visual debugger here.
Current 'default' launches via MyBinder, have the Xeus Python kernel and the debugger available already. You can run the following code in a cell in any of those sessions to pull in the debugger demonstration notebook.
!curl -o debugger.ipynb https://raw.githubusercontent.com/jupyterlab/debugger/dfd6bf9d51a7a0cd78ca54f4173fcf527bd4d7fd/examples/index.ipynb
You'll find when you open it, that notebook also is set to trigger opening with the correct kernel necessary for debugging selected. Note that won't always be the first choice for when you start a new notebook.
Upvotes: 2