• This repository has been archived on 26/Jan/2022
  • Stars
    star
    559
  • Rank 76,777 (Top 2 %)
  • Language
    TypeScript
  • License
    BSD 3-Clause "New...
  • Created almost 5 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A visual debugger for Jupyter notebooks, consoles, and source files

@jupyterlab/debugger

Archived

This project is archived. Development is now happening in https://github.com/jupyterlab/jupyterlab.

If you use JupyterLab 3.x:

The debugger extension is shipped by default with JupyterLab 3.x and doesn't need to be installed manually.

Be sure to install a kernel that supports debugging, such as xeus-python:

conda install -c conda-forge xeus-python

Refer to the documentation for more details: https://jupyterlab.readthedocs.io/en/latest/user/debugger.html

Please open new issues and pull requests on the JupyterLab repo: https://github.com/jupyterlab/jupyterlab

If you use JupyterLab 2.x:

Follow the instructions below.


Github Actions Status Binder

A JupyterLab debugger UI extension. This extension is under active development.

screencast

Prerequisites

  • JupyterLab 2.0+
  • xeus-python 0.8.0+
  • notebook 6+

Installation

A kernel with support for debugging is required to be able to use the debugger.

It is generally recommended to create a new conda environment to install the dependencies:

conda create -n jupyterlab-debugger -c conda-forge xeus-python=0.8.6 notebook=6 jupyterlab=2 ptvsd nodejs
conda activate jupyterlab-debugger

Then, run the following command to install the extension:

jupyter labextension install @jupyterlab/debugger

Usage

For now xeus-python is the only Jupyter kernel that supports debugging. xeus-python can be selected from the JupyterLab launcher:

xpython-launcher

Alternatively, it is also possible to switch to the xpython kernel using the kernel selection dialog:

xpython-dialog

Enable the debugger, set breakpoints and step into the code:

xpython-step

Development

# Create a new conda environment
conda create -n jupyterlab-debugger -c conda-forge nodejs xeus-python=0.8.6 ptvsd jupyterlab=2

# Activate the conda environment
conda activate jupyterlab-debugger

# Install dependencies
jlpm

# Build TypeScript source
jlpm build

# Link your development version of the extension with JupyterLab
jupyter labextension link .

# Rebuild TypeScript source after making changes
jlpm build

# Rebuild JupyterLab after making any changes
jupyter lab build

# Start JupyterLab with the kernel logs enabled and watch mode enabled
XEUS_LOG=1 jupyter lab --no-browser --watch

Tests

To run the tests:

# [Optional] to enable the logs for xeus-python
export XEUS_LOG=1

jlpm run test

To run tests for a specific test suite name:

jlpm run test --testNamePattern=<regex>

To run tests for a specific test module name:

jlpm run test --testPathPattern=<regex>

Inspecting debug messages

The kernelspy extension for JupyterLab can be used to inspect the debug messages sent between the debugger UI and the kernel.

To install it:

jupyter labextension install jupyterlab-kernelspy

Debug Protocol Overview

The following diagram illustrates the types of messages sent between the JupyterLab extension and the kernel.

Diagram

debug-protocol

References

Source

Generated using: https://bramp.github.io/js-sequence-diagrams/

Diagram source
user->JupyterLab: open notebook

JupyterLab->JupyterLab: check 'debugger' key\nin the kernel spec

JupyterLab->user: show toggle button\nif 'debugger'

user->JupyterLab: enable debugging

JupyterLab->kernel: debugInfo request

kernel->JupyterLab: debugInfo response

user->JupyterLab: start debugger

JupyterLab->kernel: initialize request

kernel->JupyterLab: initialize response

JupyterLab->kernel: attach request

kernel->JupyterLab: attach response

Note right of kernel: debugger started

user->JupyterLab: add breakpoints\n(click on gutters)

JupyterLab->kernel: dumpCell request

kernel->JupyterLab: dumpCell response

JupyterLab->kernel: setBreakpoints request

kernel->JupyterLab: breakpoints response

JupyterLab->kernel: configurationDone request

kernel->JupyterLab: configurationDone response

user->JupyterLab: execute cell\n(Ctrl-Enter)

JupyterLab->kernel: requestExecute

kernel->kernel: execute code

kernel->kernel: hit breakpoint

kernel-->JupyterLab: stopped event

JupyterLab->kernel: stackTrace request

kernel->JupyterLab: stackTrace response

JupyterLab->user: show current line

JupyterLab->kernel: scopes request

kernel->JupyterLab: scopes response

JupyterLab->kernel: variables request

kernel->JupyterLab: variables response

JupyterLab->user: show variables

user->JupyterLab: step in deleted cell code

JupyterLab->kernel: stepIn request

kernel-->JupyterLab: stopped event

JupyterLab->JupyterLab: search for code matching\nsource path

JupyterLab->kernel: source request

kernel->JupyterLab: source response

JupyterLab->user: show source for current path

Note right of kernel: debug session

user->JupyterLab: disable debugging

JupyterLab->kernel: disconnect request

Note right of kernel: debugger stopped

kernel->JupyterLab: disconnect response

JupyterLab->JupyterLab: clear debugger UI for\nthe notebook

Inspecting Debug Messages in VS Code

Inspecting the debug messages in VS Code can be useful to understand when debug requests are made (for example triggered by a UI action), and to compare the behavior of the JupyterLab debugger with the Python debugger in VS Code.

Create launch.json

The first step is to create a test file and a debug configuration:

image

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python: Current File",
      "type": "python",
      "request": "launch",
      "program": "${file}",
      "console": "integratedTerminal",
      "env": { "DEBUGPY_LOG_DIR": "/path/to/logs/folder" }
    }
  ]
}

Start the debugger

image

Open the logs

The content of the log file look like this:

...

D00000.032: IDE --> {
                "command": "initialize",
                "arguments": {
                    "clientID": "vscode",
                    "clientName": "Visual Studio Code",
                    "adapterID": "python",
                    "pathFormat": "path",
                    "linesStartAt1": true,
                    "columnsStartAt1": true,
                    "supportsVariableType": true,
                    "supportsVariablePaging": true,
                    "supportsRunInTerminalRequest": true,
                    "locale": "en-us"
                },
                "type": "request",
                "seq": 1
            }

...

With:

Overview

vscode-debug-logs

More Repositories

1

jupyterlab

JupyterLab computational environment.
TypeScript
13,674
star
2

jupyterlab-desktop

JupyterLab desktop application, based on Electron.
TypeScript
3,292
star
3

jupyter-ai

A generative AI extension for JupyterLab
Python
2,803
star
4

jupyterlab-git

A Git extension for JupyterLab
TypeScript
1,395
star
5

jupyterlab-toc

Table of Contents extension for JupyterLab
TypeScript
723
star
6

jupyterlab-latex

JupyterLab extension for live editing of LaTeX documents
Python
602
star
7

lumino

Lumino is a library for building interactive web applications
TypeScript
567
star
8

jupyter-renderers

Renderers and renderer extensions for JupyterLab
HTML
483
star
9

extension-examples

JupyterLab Extensions by Examples
TypeScript
420
star
10

jupyterlab-google-drive

Cloud storage for JupyterLab using Google Drive
TypeScript
399
star
11

jupyterlab-github

GitHub integration for JupyterLab
TypeScript
396
star
12

retrolab

JupyterLab distribution with a retro look and feel πŸŒ…
Jupyter Notebook
281
star
13

jupyterlab-monaco

A JupyterLab extension providing the Monaco editor
TypeScript
236
star
14

rtc

Real Time Collaboration for Jupyter and beyond
TypeScript
218
star
15

jupyterlab-demo

Demonstrations of JupyterLab
Jupyter Notebook
182
star
16

jupyterlab-data-explorer

First class datasets in JupyterLab
TypeScript
177
star
17

extension-cookiecutter-ts

A cookiecutter recipe for JupyterLab extensions in Typescript
CSS
176
star
18

jupyterlab_server

A set of server components for JupyterLab and JupyterLab like applications
Python
135
star
19

jupyter-collaboration

A Jupyter Server Extension Providing Support for Y Documents
Jupyter Notebook
126
star
20

jupyterlab-hdf5

Open and explore HDF5 files in JupyterLab. Can handle very large (TB) sized files, and datasets of any dimensionality
Jupyter Notebook
114
star
21

jupyterlab-celltags

A JupyterLab extension for notebook cell tags
TypeScript
111
star
22

jupyterlab-commenting

Commenting and annotation for JupyterLab
Jupyter Notebook
99
star
23

scipy2018-jupyterlab-tutorial

Tutorial material and instruction for scipy 2018 jupyterlab tutorial
Jupyter Notebook
72
star
24

language-packs

Language packs for JupyterLab ecosystem
Python
70
star
25

extension-cookiecutter-js

A cookiecutter recipe for building JupyterLab extensions.
Python
55
star
26

jupyterlab-shortcutui

A JupyterLab extension for managing keyboard shortcuts
TypeScript
54
star
27

scipy2019-jupyterlab-tutorial

Scipy 2019 JupyterLab tutorial
Jupyter Notebook
51
star
28

frontends-team-compass

A repository for team interaction, syncing, and handling meeting notes across the JupyterLab ecosystem.
51
star
29

jupyterlab-statusbar

A status bar for JupyterLab
TypeScript
49
star
30

theme-cookiecutter

A cookiecutter template to help you make new JupyterLab theme extensions
CSS
48
star
31

jupyterlab-plugin-playground

A dynamic extension loader for JupyterLab
TypeScript
43
star
32

extension-template

A `copier` template for JupyterLab extensions
Jinja
42
star
33

pull-requests

A JupyterLab extension for reviewing GitHub pull requests
Python
37
star
34

hatch-jupyter-builder

A hatch plugin to help build Jupyter packages
Python
33
star
35

jupyterlab_pygments

Pygments theme making use of JupyterLab CSS variables
Python
33
star
36

jupyterlab_xkcd

Random xkcd comic in a JupyterLab panel
TypeScript
31
star
37

galata

JupyterLab UI Testing Framework
JavaScript
30
star
38

jupyterlab-metadata-service

Linked data exploration in JupyterLab.
TypeScript
29
star
39

jupyterlab-telemetry

A JupyterLab extension for logging and telemetry of usage data
TypeScript
26
star
40

jupyterlab_apod

JupyterLab extension tutorial answer key. Please see the tutorial at https://jupyterlab.readthedocs.io/en/stable/extension/extension_tutorial.html
TypeScript
23
star
41

jupytercon-jupyterlab-tutorial

JupyterCon 2018 JupyterLab tutorial
Jupyter Notebook
22
star
42

mimerender-cookiecutter-ts

Cookie cutter for JupyterLab mimerenderer extensions using TypeScript
Python
20
star
43

jupyterlab-mp4

Example mimerenderer extension for showing mp4 videos.
TypeScript
17
star
44

mimerender-cookiecutter

A cookiecutter for rendering MIME type based output
Python
16
star
45

pytest-check-links

pytest plugin that checks URLs
Python
15
star
46

ui-profiler

Extension for profiling performance of JupyterLab UI for JupyterLab core developers, extension developers, and advanced users.
TypeScript
12
star
47

benchmarks

Benchmarking tools for JupyterLab
Jupyter Notebook
12
star
48

maintainer-tools

Workflows and Actions meant to be used by other repositories to make repo maintenance easier
Python
11
star
49

runall-extension

Add a "Run All Cells" toolbar button, context menu item, and keyboard shortcut.
TypeScript
8
star
50

richoutput-js

Experimental investigation into a rendermime for es6 modules rendering rich output
Jupyter Notebook
8
star
51

jupyterlab-media

Repository storing movies and other media for JupyterLab tutorials and documentation
8
star
52

jupytercon-jupyterlab-training

JupyterCon 2018 JupyterLab Training
7
star
53

jupyterlab-translate

JupyterLab Language pack helper
Python
6
star
54

vscode-config-template

A copier template for creating the IDE config needed to debug the Python and Typescript code in any Jupyter project
Dockerfile
6
star
55

jupyterlab-module-federation

Experimental playground for a JupyterLab extension system based on Module Federation
Python
5
star
56

jupyterlab-bot

JupyterLab Bot
Python
5
star
57

jupyterlab-probot

A probot for JupyterLab development
TypeScript
3
star
58

language-pack-cookiecutter

Template for Jupyterlab Language packs
Jinja
3
star
59

ux-research

3
star
60

.github

Community health files for the @JupyterLab organization
1
star
61

jupyterlab-builder

Build tools for JupyterLab (and remixes)
1
star