Skip to content

Test: Run By Line in Jupyter notebooks #133903

@DavidKutu

Description

@DavidKutu

Refs: microsoft/vscode-jupyter#5607

Complexity: 3

Authors: @roblourens, @DavidKutu

Create Issue


Setup

  • Use VS Code Insiders and the latest jupyter and python extensions
  • Make sure that you have python 3.7 or greater installed and on your path as python3 or python
  • Set up a python virtualenv:
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
  • Install the latest version of ipykernel in the virtual environment, which has debugging support
pip install ipykernel
python3 -m ipykernel install --user
  • Open a .ipynb notebook file (You can use this one if you need one)
  • Pick the kernel from your virtual env
  • Set "jupyter.logging.level": "verbose"

Testing

  • Click the RBL button
    image
  • It should stop execution on the first code line, the RBL button should change to Run Next Line, and another button called Continue Execution should appear next to it
    image
  • Clicking Run Next Line should step into the next line, stepping into functions defined in the same cell, but not stepping into anything else (functions in other cells, other python files, other python packages, etc.)
  • Clicking Continue Execution should stop RBL, and continue executing the cell where it left off
  • Interrupting or Restarting the kernel should also stop RBL

More Testing

  • Use the cell toolbar on both positions, check that the Run by Line button doesn't move when you press it
  • Check on the panel, that Jupyter: Variables comes up and that your variables get updated after each step
  • Try using it only with the key bindings (each button shows how to do it)

Filing issues

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

Known Issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions