flake8-black
flake8 plugin to call black as a code style validator
What it is and what it does
flake8-black bridges black and flake8 by letting you run black's code style checks as a flake8 plugin. Instead of running black and flake8 as separate tools, you invoke flake8 once and get BLK error codes (BLK100 for formatting violations, BLK9xx for internal errors) whenever black would reformat your code. The plugin reads black configuration from pyproject.toml if present, respecting target_version, skip_string_normalization, and line_length settings.
It's useful in CI pipelines and pre-commit hooks where you want unified linting output. The plugin depends on flake8, black, and tomli (for TOML parsing). Note that if you're already using pre-commit, you can call black and flake8 directly there instead of using this plugin—it's most valuable when you need black validation integrated into an existing flake8 workflow.
Use it for:
- Enforce black formatting standards in CI without running black and flake8 as separate commands.
- Add black style checks to existing flake8 linting pipelines in git pre-commit hooks.
- Catch code that deviates from black's style before it's committed, using BLK100 violations.
- Validate that code matches black formatting in projects where black is the canonical formatter.
- Detect when black configuration changes would trigger new formatting violations across a codebase.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A flake8 plugin that runs black's code style validation within the flake8 linting ecosystem, reporting violations with BLK error codes when black would make formatting changes.
Yes, if you use flake8 and want black validation integrated into a single linting pass. Install it when you need unified error reporting or are already committed to flake8 as your linting hub. Skip it if you use pre-commit directly (call black and flake8 separately there instead) or if you run black as a formatter without linting integration.
Install
flake8-black on PyPI
pip
pip install flake8-blackuv
uv add flake8-blackpoetry
poetry add flake8-blackInstalling flake8-black
Before you install
Low friction install with three straightforward runtime dependencies (flake8, black, tomli). Active maintenance: last commit 2026-08-03, tested on Python 3.9 through 3.13 and recent black versions including 25.9.0.
License in practice
MIT licensed under permissive terms, imposing no restrictions on use or distribution in your own projects.
Quickstart
pip install flake8-black
Then run flake8 normally; the plugin auto-registers:
flake8 example.py
Or select only BLK codes:
flake8 --select BLK example.py
Requires Python 3.9 or later; black itself can format code written for older Python versions.
Verify before relying
- Whether the plugin correctly handles all edge cases when black configuration differs from flake8 settings.
- Performance impact when running on large codebases with many files.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — flake8, black, tomli |
| Maintenance | actively maintained — 327 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 668,805/month — #5,417 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: flake8_black-0.4.0-py3-none-any.whl
Keywords: black, formatting, style, flake8
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-blackA pytest plugin that runs black format checks…
permissive · top 15,000 on PyPI
flake8Flake8 is a command-line tool that combines…
permissive · top 1,000 on PyPI
flake8-requirementsA flake8 plugin that validates whether imported…
permissive · top 15,000 on PyPI
flake8-htmlA flake8 plugin that converts code style…
permissive · top 15,000 on PyPI
flake8-noqaA flake8 plugin that validates the formatting…
copyleft · top 5,000 on PyPI
flake8-djangoA flake8 plugin that detects Django-specific…
copyleft · top 15,000 on PyPI
flake8-blind-exceptA flake8 plugin that detects overly broad…
permissive · top 15,000 on PyPI
pylamaPylama is a code audit tool that wraps multiple…
permissive · top 15,000 on PyPI
wemake-python-styleguideA flake8 plugin that enforces strict,…
permissive · top 15,000 on PyPI