Visualize Python code execution in Jupyter Notebook cells
Project description
Nbtutor
Visualize Python code execution (line-by-line) in Jupyter Notebook cells. Inspired by Online Python Tutor
Install
Note: installing directly off this repo won't work, as we don't ship the built JavaScript and CSS assets. See more about developing below.
pip
pip install nbtutor
jupyter nbextension install --overwrite --py nbtutor
jupyter nbextension enable --py nbtutor
conda
conda install -c conda-forge nbtutor
jupyter nbextension install --overwrite --py nbtutor
jupyter nbextension enable --py nbtutor
Usage (Jupyter Notebook)
First load the nbtutor
IPython kernel extension at top of the Notebook by executing the following magic in a
CodeCell
:
%load_ext nbtutor
Then to visualize the execute of code in a CodeCell
add the following magic to the top of the CodeCell
and execute it again:
%%nbtutor
Optional Arguments
There are also optional arguments that can be used with the cell magic:
-
Reset the IPython user namespace
%%nbtutor -r/--reset
-
Suppress the confirmation message from
-r/--reset
%%nbtutor -r/--reset -f/--force
-
Specify the maximum frame depth to visualize (default: 3)
%%nbtutor -d/--depth N
-
Specify the maximum number of elements to visualize for "sequence" type objects (default: 5)
%%nbtutor --max_size S
-
Step through all frames (including frames from other cells and other global scopes altogether)
%%nbtutor --step_all
Notes
- If you find a problem please feel free to submit a GitHub Issue
Develop
Please see the DEVELOPMENT.md file
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file nbtutor-2.0.3.tar.gz
.
File metadata
- Download URL: nbtutor-2.0.3.tar.gz
- Upload date:
- Size: 618.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b02ed69e39c1240055bec07cd0b902dd10d3332786c2f913e041538b312563d |
|
MD5 | cc4f254710082be7651802443c455680 |
|
BLAKE2b-256 | d41ddb9ce929a20abf5d7a1a234d83847314f9ccc84d67af05315a64f4be7937 |
File details
Details for the file nbtutor-2.0.3-py2.py3-none-any.whl
.
File metadata
- Download URL: nbtutor-2.0.3-py2.py3-none-any.whl
- Upload date:
- Size: 190.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ac8101ea5fcc4b67b44b1c2b28df6ab7223fd78f1459bc632692bd574680993 |
|
MD5 | cb9392507d3e2189da10850e5488967d |
|
BLAKE2b-256 | 21341eea3231a2a15768a744a8af7f2c2023905d0f6d76ba54aee3be58e0ec21 |