jupyter-black
A simple extension for Jupyter Notebook and Jupyter Lab to beautify Python code automatically using Black. Fork of dnanhkhoa/nb_black.
What it is and what it does
jupyter-black is an extension that integrates the Black code formatter into your notebook workflow. Once loaded, it automatically formats any syntactically correct Python code cell with Black immediately after you run it, without requiring manual formatting steps. The extension reads Black configuration from pyproject.toml if available and allows you to override settings like line length and target Python version through its load function.
It depends only on black as a runtime dependency and works with both Jupyter Notebook and JupyterLab (defaulting to lab mode). The extension can be loaded either through Python code with configuration options or via the %load_ext magic command, though the magic command defaults to lab=True and may not work in standalone notebook installations.
Use it for:
- Automatically format code cells to Black style without manual intervention after each cell execution.
- Enforce consistent code formatting across a notebook-based project by loading the extension at startup.
- Override Black defaults like line length and target Python version on a per-notebook basis using the configurable load function.
- Migrate from nb_black while gaining access to newer Black features and improved responsiveness.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A Jupyter Notebook and JupyterLab extension that automatically formats Python code cells using Black after they are run.
Yes, if you use Jupyter Notebook or JupyterLab and want automatic Black formatting. The extension has low install friction, no security vulnerabilities, and a permissive MIT license. However, note that the project is dormant (last release 2024-08-30); if you need active maintenance or encounter compatibility issues with newer versions, you may need to pin versions or consider alternatives.
Install
jupyter-black on PyPI
pip
pip install jupyter-blackuv
uv add jupyter-blackpoetry
poetry add jupyter-blackInstalling jupyter-black
Before you install
Low install friction with a single runtime dependency on black. The project is dormant (last release 2024-08-30, 714 days ago) but the repository remains active and unarchived. No known vulnerabilities.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both personal and commercial projects.
Quickstart
pip install jupyter-black
# In a notebook cell:
import jupyter_black
jupyter_black.load()
Requires Jupyter Notebook or JupyterLab to be installed and running; the extension only formats cells after they are executed.
Verify before relying
- Whether the extension works with all current versions of Jupyter Notebook and JupyterLab, given the dormant maintenance status.
- Compatibility with the latest versions of black beyond what the fact sheet documents.
- Whether the extension requires specific Python versions beyond the classifiers listed (3.8, 3.9, 3.10, 3.11).
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — black |
| Maintenance | dormant — 714 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 137,362/month — #11,369 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: jupyter_black-0.4.0-py3-none-any.whl
Keywords: jupyter-black
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
jupyterlab-code-formatterA JupyterLab plugin that integrates code…
permissive · top 15,000 on PyPI
jupyterlab-execute-timeA JupyterLab extension that displays the…
permissive · top 15,000 on PyPI
jupyter_bokehRenders Bokeh visualizations directly within…
permissive · top 15,000 on PyPI
jupyterlab_notebook_awarenessA JupyterLab extension that tracks which…
permissive · top 15,000 on PyPI
jupyterlab-commands-toolkitExposes JupyterLab commands to Python code and…
permissive · top 15,000 on PyPI
jupyterlabJupyterLab is an extensible web-based…
permissive · top 1,000 on PyPI
jupyter-server-documentsA JupyterLab extension that moves document…
permissive · top 15,000 on PyPI
jupysql-pluginA JupyterLab 4 extension that integrates…
permissive · top 15,000 on PyPI
jupyterJupyter is a metapackage that installs the core…
permissive · top 5,000 on PyPI
pytest-blackA pytest plugin that runs black format checks…
permissive · top 15,000 on PyPI