Skip to content

Test: Jupyter run by line/debugging #131469

@roblourens

Description

@roblourens

Refs: #126431, microsoft/vscode-jupyter#5607

Complexity: 4

Authors: @roblourens, @DavidKutu

Create Issue


Setup

  • Set "jupyter.experimental.debugging": true
  • Make sure that you have python 3.7 or greater installed and on your path as python3 or python
  • Set up a python virtualenv (use regular python, conda is not recommended)
  • In past months we had some issues with setup. If you can't get this to work, please ping me, don't struggle with it for hours
mkdir jupyter-dbg
cd jupyter-dbg
python3 -m venv ipykernel-env
  • Activate the virtual environment

Mac/Linux:

source ipykernel-env/bin/activate

Windows:

ipykernel-env\Scripts\activate.bat
  • Make sure you have ipykernel 6+ in the virtual environment, which has debugging support
pip install ipykernel
python3 -m ipykernel install --user
  • Make sure you have the latest version of the Jupyter extension installed in VS Code Insiders

Testing

  • Open a .ipynb notebook file
  • Pick the kernel from your virtual env
  • Click the Run by Line button in the cell toolbar, or press F10 while a cell is selected
    image
  • A debugging session should start, without the status bar changing, without the debug widget and without revealing the debug sidebar automatically
  • Press the same button (or F10) to advance to the next line, or the stop button on the left of the cell to end the session
  • The Variable Explorer should be shown automatically and should update after advancing each line
  • Once you've stepped to the end of the cell, the session should end automatically

Test full debugging

  • You should also be able to set breakpoints and use the Debug Cell command to run a cell and hit breakpoints:
    image

More testing

  • Restarting, Interrupting or changing the Kernel should end the session
  • The Run by Line button shouldn't move position
  • It should not step into another cell or file
  • Note: the flow above is the only entrypoint. launch.json is not relevant here.
  • You should never see an error that looks something like "Unable to open ..." with some tmp file path
  • Clicking Run by Line on a different cell (or notebook) while a session is running should do nothing
  • It shouldn't get stuck where clicking the RBL button does nothing

Known issues

  • Testing run by line in an untitled notebook will ask you to save the file
  • If you step over a line that calls a function in another file, it might open that file. The jupyter extension will be published with this fix tomorrow

Filing issues

File issues on the jupyter repo using the link above. Include the log from the Jupyter output channel

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions