Jupyter notebooks

We generally recommend packaging reusable code components into Python modules where possible. However occasionally we support researchers who prefer a notebook environment or projects which want to provide examples and tutorials in notebook format. Notebooks can also be a valid alternative to Python scripts for running and recording the results of numerical experiments for example.

Live executable environments

Name Short description 🚦
binder Turns a Git repository into a collection of interactive notebooks 🟢
Google Colab Colab is a hosted Jupyter Notebook service that requires no setup to use and provides free access to computing resources, including GPUs and TPUs. 🟢
GitHub codespaces with JupyterLab A codespace is a development environment that is hosted in the cloud and can run Python and Jupyter notebooks 🟠

Linting

Many of our recommended linters don’t work out-of-the box on Jupyter notebooks, however nbQA has been found to work well. This is a translation tool that can be used to run our recommended linters over notebooks.

There is one exception: we’ve found that black’s own Jupyter extension works more reliably than black via nbQA.

Name Short description 🚦
black[jupyter] (also black-jupyter) black with the optional Jupyter extension. 🟢
nbQA Recommended for all other linters (ruff, isort) and mypy. 🟢
pre-commit Has cell output cleanup hooks (if desired). Also found to work well with nbQA. 🟢
nbqa black black via nbQA. 🟠

Other

Name Short description 🚦
jupytext Automatically convert notebooks to/from a plain text format that is more human readable and better for version control than the standard notebook format. 🟢