Skip to main content

Tools to work with Jupyter notebooks

Project description

nbtoolbelt - Tools to Work with Jupyter Notebooks

  • validate: validate notebooks
  • head: show head or tail of notebooks
  • dump: dump notebook info and source on terminal
  • stats: summarize notebooks with statistics
  • view: view notebook, including all embedded images, LaTeX, and HTML in a browser
  • cat: concatenate multiple notebooks
  • clean: clean notebooks by removing specified elements
  • run: execute notebooks, with pre/post cleaning
  • split: split notebooks into MarkDown, code, and raw
  • punch: punch holes into notebooks and fill them (for creating exercises)

Available as library functions and as configurable command-line scripts.


pip install nbtoolbelt


Documentation is available on Read the Docs.

On the command line, you can use the options -h or --help.


On the command line:

nbtb [-h] [options] tool [options] nb.ipynb ...

As library: see documentation


pip install nbtoolbelt[test]

nbtoolbelt comes with a set of automatic test cases for pytest.


Some useful commands, and where to run them:

  • In nbtoolbelt/docs/,

    • clean build directory: make clean
    • create html documentation tree: make html
    • create pdf documentation: make latexpdf
    • determine size of documentation: wc `find . -name '*.rst'`
  • In nbtoolbelt/test/,

    • run all test cases: pytest .
  • In nbtoolbelt/,

    • test package configuration: python check -r -s
    • create source distribution and wheel: python sdist bdist_wheel
  • In nbtoolbelt/dist/

    • create digital signature: gpg --detach-sign -a ...
    • upload to PyPI: twine upload ...
  • In nbtoolbelt/src/,

    • determine size of code: wc `find . -name '*.py'`

Steps to add a feature:

  1. Add issue.

  2. Design interface.

    1. Add (failing) test cases in nbtoolbelt/test/.

    2. Add documentation in nbtoolbelt/docs/.

  3. Implement feature in nbtoolbelt/src/nbtoolbelt/.

  4. Update nbtoolbelt/src/nbtoolbelt/

  5. Update CHANGELOG.rst.

  6. Commit and push changes.

  7. Close issue, indicating commit hash.


Copyright (c) 2017 - Eindhoven University of Technology, The Netherlands

This software is made available under the terms of the MIT License.


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

nbtoolbelt-2022.3.tar.gz (35.9 kB view hashes)

Uploaded source

Built Distribution

nbtoolbelt-2022.3-py3-none-any.whl (52.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page