nbtoolbelt: Tools to Work with Jupyter Notebooks¶
When you work with many Jupyter notebooks (e.g., when writing a book or teaching a course), you will need tools to do bulk operations on notebooks.
nbtoolbelt is an integrated collection of tools to work with Jupyter notebooks.
nbtoolbelt together with
a highly-configurable LTI Tool Provider
that automatically processes digital content
submitted in our Learning Management System
(in our case, students submit Jupyter notebooks),
and returns various forms of feedback.
nbtoolbelt you get tools and libraries to
- validate notebooks (a wrapper for
- inspect head or tail cells of notebooks
- dump notebooks compactly on the terminal
- summarize notebooks, with statistics (stats)
- view notebooks in the browser
- catenate multiple notebooks into one notebook
- clean notebooks
- run notebooks, with pre/post cleaning (a wrapper for
- split notebooks
- punch notebooks (shoot holes in them, to produce frameworks useful for exercises)
The next sections briefly discuss some other tools.
You can use Jupyter’s
nbconvert on the command line:
jupyter nbconvert --to notebook --execute --allow-errors notebook.ipynb
notebook.nbconvert.ipynb capturing the execution results,
including cells that produce errors.
for further details.
nbtoolbelt from PyPI (the Python Package Index):
pip install nbtoolbelt
For users who install from a locally saved wheel:
pip install --no-index --find-links=<path/to/wheel/dir> nbtoolbelt
<path/to/wheel/dir> is the (absolute or relative) path
to the directory where you saved the wheel.
The wheel has a name of the form
nbtoolbelt depends on
nbformatfor notebook structure, and reading and writing of notebooks;
nbconvertfor notebook validation and execution;
numpyfor summary statistics in the
For testing, it depends on
To upgrade your
--upgrade flag to the above commands:
pip install --upgrade nbtoolbelt pip install --upgrade --no-index --find-links=<path/to/wheel/dir> nbtoolbelt
pip uninstall nbtoolbelt
To install for testing:
pip install nbtoolbelt[test]
- Command-Line Usage
- Notebook Validation
- Notebook Heads
- Notebook Dump
- Notebook Statistics
- Notebook Viewing
- Notebook Catenation
- Notebook Cleaning
- Notebook Execution
- Notebook Splitting
- Notebook Punching
- Configuration Files
- The structure of Jupyter notebooks is specified in
nbformat(documentation). The library
nbformatfacilitates programmatic manipulation of notebooks.
- Tool to convert notebooks:
nbconvert(documentation); can be used on the command line and as a library for conversion to various other formats, including notebook execution and other notebook versions. It also provides a set of notebook preprocessors.
- Tools for showing, diffing, and merging Jupyter notebooks,
including Git integration:
License and Source Code¶
This software is made available under the terms of the
Copyright (c) 2017-2020 - Eindhoven University of Technology, The Netherlands
The source code and issue tracker are at <https://gitlab.tue.nl/jupyter-projects/nbtoolbelt/>.