nbt

nbtutor

Visualize Python code execution (line-by-line) in Jupyter Notebook cells.

Showing:

Popularity

Downloads/wk

0

GitHub Stars

389

Maintenance

Last Commit

2mos ago

Contributors

3

Package

Dependencies

0

License

BSD 3-Clause

Categories

Readme

Nbtutor

Visualize Python code execution (line-by-line) in Jupyter Notebook cells. Inspired by Online Python Tutor

Usage Example

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

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
    
  • Render primitive objects inline

    %%nbtutor -i/--inline
    
  • Specify the maximum frame depth to visualize (default: 1)

    %%nbtutor -d/--depth N
    
  • Specify the number of significant digits for floats (default: 3)

    %%nbtutor --digits D
    
  • 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
    
  • Expand numpy arrays to show underlying data

    %%nbtutor --expand_arrays
    
  • No inlined keys, attributes, or primitive objects

    %%nbtutor --nolies
    

Notes

  • Visualizing numpy arrays is somewhat experimental. Simple ndarrays and simple slicing should work, but anything beyond that is un-tested.

  • If you find a problem please feel free to submit a GitHub Issue

Develop

Please see the DEVELOPMENT.md file

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100