Run any Python code quality tool on a Jupyter Notebook!

Marco Edward Gorelli

Prior knowledge:
No previous knowledge expected

Summary

Data scientists love Jupyter Notebooks. Unfortunately, they're hard to maintain. In this talk, you'll learn how nbQA (an open-source, MIT-licensed Python tool) allows you to run the standard Python code quality tools (such as isort, pylint, and mypy) on Jupyter Notebooks. You'll learn how to use it from the command-line and as a pre-commit hook.

Description

Never write an unmaintainable Jupyter Notebook again!

This lightning talk is intended for anyone who loves the interactivity and story-telling ability of Jupyter Notebooks, but struggles with keeping them maintainable.

What's nbQA?

nbQA brings existing Python code-quality tools to Jupyter Notebooks: for example, if you wanted to check your type annotations on a Python script, you could run

mypy my_script.py

nbQA allows you to do the same for a Jupyter Notebook, by simply running

nbqa mypy my_notebook.ipynb

It will work with any standard Python code quality tool (e.g. isort, mypy, pylint, ...).

Since its release ~1 year ago, nbQA has been downloaded more than 100,000 times and is used in the CI processes of several open source packages (see Used by for some examples).

The main takeaway is that you need not choose between Jupyter Notebooks and having code quality tools available - you have it all!