mrkeyoor.com_
Wed 16 Sept 06:24 UTC
Dev Toolsevaluationupdated 16 Sept 2026

black review

Black is an automatic Python formatter that rewrites whole files to one deliberately opinionated style. It removes recurring debates about spacing, wrapping, and quote style from code review, with only a small set of project options.

Verdict

Our Black install took 26 seconds and pip-audit found 0 known vulnerabilities, but the build exited 1 and the full suite ended with 445 of 449 tests passing plus 1 collection or setup error. Black is still the sensible default for a Python team that wants formatting settled by one command and can install the right development extras. Choose YAPF for tunable house style or Ruff when consolidating the formatter with lint and import checks matters more.

We ran it

Lab card: what happened when we ran blackScreenshot of black (black.readthedocs.io/en/stable)
Install✓ · 26s40 packages · 39 MB
Build✗ · 3s
Tests✗ · 59s445 passed · 3 failed · 3 skipped · 1 errors of 449 (pytest)
Known vulns0(pip-audit)
Repo482 files~134,051 lines of source · 6.1 MB · 13 CI workflows · Dockerfile · tests dir

Answers from our run

Does black build from source?

Dependencies installed in 26 seconds (40 packages), and the build failed. We cloned commit acd6198 into a clean Debian container with 3 CPUs and no project-specific setup.

Do black's tests pass?

Not all of them: 445 of 449 passed and 3 failed when we ran the project's own test command (pytest), with 1 collection error. Some failures need services or credentials a bare container does not have.

Does black have known vulnerabilities in its dependencies?

pip-audit found none in the dependency tree at the time of our run.

Who should not use black?

Teams that need a highly configurable house style: the README says style options are deliberately limited and rarely added.

What are the alternatives to black?

Ruff, YAPF, autopep8. Our Black install took 26 seconds and pip-audit found 0 known vulnerabilities, but the build exited 1 and the full suite ended with 445 of 449 tests passing plus 1 collection or setup error.

Setup4/526-second base install; contributor checks need optional extras
Docs5/5Usage, configuration, style, and stability policy are documented
Community5/541,843 stars with issue and pull request work on September 16
Maturity4/5Stable style and frequent fixes, with edge cases still active

Who it’s for

Python teams that want one enforced format across editors, local hooks, and CI.
Maintainers willing to accept Black's choices in exchange for smaller formatting discussions.
Projects that want configuration in pyproject.toml and predictable whole-file formatting.
Developers who value the default AST-equivalence check before formatted code is written.

Who it’s NOT for

Teams that need a highly configurable house style: the README says style options are deliberately limited and rarely added.
Developers who must preserve hand-aligned or carefully wrapped layouts: Black reformats entire files and usually ignores their previous formatting.
Tool environments stuck below Python 3.10 with no isolated runner or standalone executable: current Black requires Python 3.10 or newer to run.
Users expecting the base package to include every optional service: our test collection stopped on test_blackd.py and explicitly asked for the d extra.

Setup reality

Our sandbox install succeeded in 26 seconds, adding 40 packages and using 39 MB. The build exited 1 after 3 seconds; its supplied tail shows SyntaxWarnings from generator expressions in test fixtures but does not reveal the command's final cause. Tests exited 1 after 59 seconds: 445 passed, 3 failed, 3 skipped, and 1 collection or setup error out of 449.

Basic formatting needs Python 3.10 or newer and no account, token, database, or network service. Jupyter support uses the jupyter extra. The daemon test asked for Black's d extra, which our base environment did not have.

The three failed assertions involved __pycache__ or compiled files appearing among test-data paths. The separate collection error came from tests/test_blackd.py. Pip-audit found 0 known vulnerabilities, so the failing suite should not be misreported as a dependency advisory.

Black removes style choices by keeping options scarce

Black rewrites an entire Python file according to one style and deliberately offers few ways to change that style. The bargain is plain: developers stop spending review time on wrapping, quotes, and spacing, while Black gets the final say. A team that already agrees on that bargain can add one command to an editor, pre-commit hook, or CI job and expect the same result in each place.

The current package requires Python 3.10 or newer to run. It can read defaults such as line length, target versions, and include or exclude patterns from pyproject.toml. Notebook formatting comes through the jupyter extra, while standalone executables are available for users who do not want to install Python. There are enough controls for repository boundaries and language targets, but the project does not aim to reproduce a custom style guide.

Default mode checks the formatted file's AST

Black parses code before and after formatting and checks that the resulting abstract syntax trees are effectively equivalent. This safety step slows the formatter, and --fast disables it. Keeping the check enabled is a sensible default for CI and bulk migrations because the formatter is editing executable source. The option exists for cases where the caller has a separate reason to prefer speed.

That safety check has practical limits. It compares Python structure, so it cannot decide whether a moved comment has changed a tool directive or whether every external parser understands the result. Release 26.5.1 fixed comment handling around # fmt: skip after a lost # type: ignore could trigger an AST-equivalence failure. A formatter with a stable style still needs regression tests for comments, pragmas, and new Python syntax.

What happened when we ran it

Our sandbox installed Black in 26 seconds, pulling 40 packages and using 39 MB on disk. We tested commit acd6198 with 3 CPUs, 8 GB of RAM, Python 3.12 on Debian, no secrets, and an unprivileged container. Pip-audit found 0 known vulnerabilities in the installed dependencies. The checkout itself contained 482 files, about 134,051 lines of source, and occupied 6.1 MB.

The build command exited 1 after 3 seconds. The supplied end of its log contains SyntaxWarnings from tests/data/cases/preview_redundant_generator_parentheses.py, where generator objects are indexed or called on purpose as formatter input. That tail does not include the final build error, so those warnings are all we can report. Calling them the cause would go beyond the evidence.

Pytest exited 1 after 59 seconds. It reported 445 passed, 3 failed, 3 skipped, and 1 collection or setup error out of 449, plus 8 passing subtests. The failed assertions involved __pycache__ or compiled paths turning up in fixture discovery. Collection of tests/test_blackd.py raised a direct instruction to install Black with the d extra. The base install therefore did not reproduce a green contributor run.

The base formatter needs no service or credential

For normal use, installation is pip install black, followed by black and a file or directory. No API key, account, server, or database is involved. Black writes files in place, while check and diff modes let CI report changes without applying them. The project also ships a Dockerfile and has a tests directory, which makes its intended development surfaces easier to find than in many command-line projects.

Optional paths change the dependency picture. Jupyter notebooks need one extra, and the daemon path needs another. Our 40-package environment was enough to import and exercise most of the suite, yet it was not enough to collect the daemon tests. A contributor should install the documented development set rather than treating the smallest user install as a complete test environment.

Style stability reduces churn without freezing output forever

Black describes its current style as stable and says large formatting changes should be uncommon. Release 26.5.1, published May 18, 2026, focused on annotated assignments, comment preservation, executable version metadata, and Neovim documentation. Those are narrow maintenance items rather than a redesign of everyday output.

Development is still active. GitHub recorded a last push on September 16, 2026, 41,843 stars, and 306 open issues and pull requests combined. Issue 5402 documents an unreleased regression on the main branch involving # fmt: skip on an opening bracket, while several September pull requests target the same parsing area. The release remains unaffected according to that report, which is exactly why teams should pin a released version instead of installing the repository head.

Ruff combines formatting with more checks

Black does one job, and that focus remains useful. Ruff is the obvious comparison for teams that also want lint rules and import sorting from one binary. YAPF gives maintainers more formatting controls. autopep8 is closer to a targeted repair tool for pycodestyle findings. None is a drop-in philosophical match because Black's main feature is the refusal to negotiate every style decision.

The 26-second install and 39 MB footprint make Black cheap to trial on a real branch. Run it once, inspect the diff, and ask whether the team prefers that output to recurring formatting review. If the answer is yes, pin the release, install the extras required by your workflow, and enforce the same command locally and in CI. The value comes from everyone accepting the result.

Alternatives

ProjectWhat it isPick it when
Ruff gh↗A Rust-based Python linter and formatter that can replace several separate checks.pick this instead when you want formatting, linting, and import rules in one fast tool.
YAPFA Python formatter with more style controls and several built-in style families.pick this instead when the team needs to tune formatting rather than accept one dominant style.
autopep8A formatter focused on fixing pycodestyle violations in existing Python code.pick this instead when targeted PEP 8 cleanup is preferable to whole-file restyling.

What people are saying

  1. [velocity-scout] psf/black
  2. [hackernews] Romania soccer introduces black card to 'combat abusive behaviour' from parents
  3. [theverge] The black iPhone Pro returns
  4. [hackernews] Black Hole of Los Alamos: Seller of surplus nuclear research materials (2011)
  5. [mastodon-trends] Black-clad protesters in balaclavas block road at port of Dover in Kent
  6. [hackernews] Black hole singularity is a surface not a point

Sources

  1. Black repository and README
  2. Black code style documentation
  3. Black 26.5.1 release
  4. Black issue 5402 on an unreleased fmt skip regression

More dev tools reviews

IKONA-Security · noty · forward-implementation-first · breakscale · ASC · BrewUI · the whole board →