skillfed

flake8-black

flake8 plugin to call black as a code style validator

flake8-black v0.4.0 668.8K downloads/30d#5,417 on PyPI167
Permissive license MIT Active released

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

uv

uv add flake8-black

poetry

poetry add flake8-black

Installing 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

Framework :: Flake8Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Quality Assurance

Tags

flake8 black integrationblack code style validatorflake8 formatting pluginpython code style lintingblack format checker
code-stylelinting-plugin

More Python Modules packages