https://github.com/lgpage/nbtutor
Visualize Python code execution (line-by-line) in Jupyter Notebook cells.
https://github.com/lgpage/nbtutor
jupyter jupyter-notebook learning python
Last synced: about 16 hours ago
JSON representation
Visualize Python code execution (line-by-line) in Jupyter Notebook cells.
- Host: GitHub
- URL: https://github.com/lgpage/nbtutor
- Owner: lgpage
- License: other
- Created: 2016-11-07T14:08:25.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2025-03-11T11:52:21.000Z (about 1 month ago)
- Last Synced: 2025-04-14T04:13:33.394Z (about 16 hours ago)
- Topics: jupyter, jupyter-notebook, learning, python
- Language: TypeScript
- Homepage:
- Size: 5.26 MB
- Stars: 463
- Watchers: 18
- Forks: 41
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-jupyter - nbtutor - Visualize Python code execution (line-by-line). (Collaboration/Education)
- -awesome-jupyter - nbtutor - Visualize Python code execution (line-by-line). (Collaboration/Education)
- awesome-jupyter-resources - GitHub - 29% open · ⏱️ 04.04.2022): (交互式小部件和可视化)
README
# Nbtutor
Visualize Python code execution (line-by-line) in [Jupyter Notebook] cells. Inspired by [Online Python Tutor]

[](https://pypi.org/project/nbtutor)
[](https://pypi.org/project/nbtutor)
[](https://pypi.org/project/nbtutor)
[](https://pypi.org/project/nbtutor)
[](https://pypi.org/project/nbtutor)
[](https://anaconda.org/conda-forge/nbtutor)
[](https://anaconda.org/conda-forge/nbtutor)[](https://github.com/lgpage/nbtutor/actions/workflows/angular-test.yml?query=branch%3Amain)
[](https://github.com/lgpage/nbtutor/actions/workflows/python-check.yml?query=branch%3Amain)
[](https://github.com/lgpage/nbtutor/actions/workflows/python-test.yml?query=branch%3Amain)[](https://mybinder.org/v2/gh/lgpage/nbtutor/HEAD?urlpath=tree/)
To try out `nbtutor`, click on the "launch binder" button above and then view the examples.
## 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](#developing) below.### `pip`
```shell
pip install nbtutor
jupyter nbextension install --overwrite --py nbtutor
jupyter nbextension enable --py nbtutor
```### `conda`
```shell
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`:```python
%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:```python
%%nbtutor
```### Optional Arguments
There are also optional arguments that can be used with the cell magic:
- Reset the IPython user namespace
```python
%%nbtutor -r/--reset
```- Suppress the confirmation message from `-r/--reset`
```python
%%nbtutor -r/--reset -f/--force
```- Specify the maximum frame depth to visualize (default: 3)
```python
%%nbtutor -d/--depth N
```- Specify the maximum number of elements to visualize for "sequence"
type objects (default: 5)```python
%%nbtutor --max_size S
```- Step through all frames (including frames from other cells and other
global scopes altogether)```python
%%nbtutor --step_all
```### Notes
- If you find a problem please feel free to submit a [GitHub Issue]
## Develop
Please see the [CONTRIBUTING](CONTRIBUTING.md) and [DEVELOPMENT.md](DEVELOPMENT.md) guides
[Jupyter Notebook]: https://jupyter.org
[Online Python Tutor]: http://pythontutor.com/index.html
[GitHub Issue]: https://github.com/lgpage/nbtutor/issues