skillfed

jupyter-black

A simple extension for Jupyter Notebook and Jupyter Lab to beautify Python code automatically using Black. Fork of dnanhkhoa/nb_black.

jupyter-black v0.4.0 137.4K downloads/30d#11,369 on PyPI59
Permissive license MIT DORMANT released

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-black

uv

uv add jupyter-black

poetry

poetry add jupyter-black

Installing 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

Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

jupyter code formatterblack formatter jupyterautomatic code formatting notebookjupyter lab extension formattingpython code beautifier jupyterjupyter notebook black integrationauto-format jupyter cells
jupyter-extensioncode-formattingblack-integration

More Quality Assurance packages