Run Python linters and formatters like ruff, black, and mypy directly on Jupyter Notebooks.
nbQA is a command-line utility that allows developers to run standard Python code quality and formatting tools on Jupyter Notebooks. It solves the problem of maintaining consistent code standards in notebook-driven projects by enabling tools like black, ruff, and mypy to process .ipynb files directly. This ensures notebooks meet the same style and quality benchmarks as regular Python scripts.
Python developers and data scientists who use Jupyter Notebooks for prototyping, analysis, or documentation and want to enforce code quality standards. Teams collaborating on notebook-based projects that require consistent linting and formatting across contributions.
Developers choose nbQA because it seamlessly integrates existing Python tooling into the notebook workflow without requiring manual conversion steps. Its unique selling point is robust handling of notebook-specific features like IPython magics while preserving the configuration and behavior of the underlying linters and formatters.
Run ruff, isort, pyupgrade, mypy, pylint, flake8, and more on Jupyter Notebooks
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports a wide range of popular tools like black, ruff, mypy, and pylint, allowing teams to apply their existing Python toolchain directly to notebooks without switching contexts.
Robustly processes notebooks containing IPython magics without breaking execution, a key advantage over naive approaches that strip magics and cause errors.
Honors existing configuration files such as pyproject.toml and .flake8, ensuring consistent behavior between notebook and script linting without redundant setup.
Easily set up as a pre-commit hook with clear examples in the README, enabling automated code quality enforcement in CI/CD pipelines.
Works with .md files saved via Jupytext, extending tool support to text-based notebook formats for better version control and collaboration.
Running tools through nbQA can be slower than direct execution on Python files, especially for large notebooks, due to the extra step of extracting and processing cell contents.
As a command-line tool, it lacks integrated, real-time linting in JupyterLab or notebooks during editing, requiring manual runs or pre-commit hooks for feedback.
Requires separate installation of both nbQA and each underlying tool, adding setup overhead and potential version conflicts in the toolchain.
While it supports many tools, it may not cover all niche linters or formatters, and updates to wrapped tools can introduce compatibility issues that nbQA must catch up with.