published fresh until

Ruff or Black plus flake8 for a large Python repo?

Summary As of November 2026, choose Ruff after auditing rule coverage; keep Black during a lint-only rollout, and retain flake8 for custom plugins Ruff cannot run. Ruff 0.17.6 is current, but its expanded defaults make an unconfigured replacement risky for legacy CI (checked 2026-11-24).

Not for running Ruff after agent edits, see ruff-uv-claude-code-auto-format-hook-post-tool-use

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Choose Ruff after auditing the repo's rules; keep Black for a lint-only rollout and retain flake8 wherever custom plugins remain necessary.

What changed

  • Ruff's breaking-change record says 0.16.0 (checked 2026-10-28) expanded default lint coverage substantially and added Markdown code-block formatting. Old recipes describing a tiny default rule set are stale.
  • The same official record documents changed target and lint defaults in 0.17.0 (checked 2026-10-28). Set the actual project's Python target and explicit rule selection rather than treating defaults as a compatibility contract.

How to choose and migrate

1. Inventory every flake8 plugin, enabled code, ignore, per-file exclusion, formatter setting and CI entry point. Mark each rule as supported by Ruff, intentionally retired, or still requiring flake8. Ruff's FAQ, checked 2026-10-28, says it does not run custom lint plugins and some plugin rule codes differ. 2. Start with linting while retaining Black if minimizing format churn matters. Configure Ruff explicitly for the audited rule set in pyproject.toml, including target-version, line length and exclusions; compare diagnostics on the same file set. The linter guide, checked 2026-10-28, documents ruff check and rule selection. Do not start with --fix. 3. Compare without rewriting files by using ruff check --no-fix ., ruff format --check ., black --check --diff . and flake8 .. The explicit --no-fix overrides a configured fix = true:

ruff check --no-fix .
ruff format --check .
black --check --diff .
flake8 .

Run these in the project's resolved tooling environment. Review unmatched diagnostics and format diffs before removing an old gate. Black's CLI guide and flake8's invocation guide, checked 2026-10-28, document their checks. flake8 configuration lives in .flake8, setup.cfg or tox.ini; it is not automatically translated into Ruff configuration. 4. If format changes are acceptable, make one dedicated formatting change and switch editor and CI formatting together. Do not alternate two formatters on the same files. Keep the custom-plugin runner until its checks have a verified replacement. 5. When flake8 remains, preserve its suppression prefixes using Ruff's lint.external, checked 2026-10-28. This preserves unknown noqa codes; it does not implement those checks. Then introduce selected fixes in reviewed batches.

Versions and licences

Entries carry individual check dates; these are reference versions, not a tested combined environment.

ToolOfficial version referenceLicence and CLI cost
Ruff0.17.3 release, checked 2026-10-28MIT, no CLI licence fee; checked 2026-10-28
Black26.10.1 documentation, checked 2026-10-28MIT, no CLI licence fee; checked 2026-10-28
flake8As of November 2026, 7.5.0 documentation, checked 2026-11-15MIT, no CLI licence fee; checked 2026-10-28

Check each retained plugin's own licence separately. No hosted service or support pricing is compared.

Pick by constraint

OptionPick whenNot for
Ruff lint and formatRequired rules are covered and a reviewed format change is acceptableRunning a team's custom flake8 plugin; keep its runner
Ruff lint plus BlackLint consolidation is useful but formatting must stay consistent with the existing gateRemoving both legacy tools in one change
Black plus flake8Custom plugins or established style gates outweigh consolidationAssuming every legacy plugin will be maintained indefinitely; review them individually

What breaks and what to test

A replacement can silently lose custom checks even when CI passes. Expanded defaults can also create a new lint backlog. Compare old and new diagnostics on representative subprojects, generated files, notebooks and suppression comments. Assert the custom plugin still catches one known violation. Run checks twice after any formatting change and confirm no churn.

Community evidence

  • evan0greenup asks about compatibility in Ruff discussion 10138. Maintainer MichaReiser explains the compatibility goal. That historical answer is not proof of identical output today.
  • Maintainer MichaReiser's style-difference issue 15927 records a concrete Black/Ruff difference and later discussion. It supports reviewing diffs rather than promising byte-for-byte identity.
  • The pydevtools migration guide describes keeping flake8 for custom rules and preserving external suppressions. This is one practitioner's account, not a workload benchmark. All three pages checked 2026-10-28.

Pitfalls

Do not infer lint parity from formatter similarity. Ruff's formatter does not sort imports by itself; use the linter's import rules if required. Avoid incompatible style checks and --unsafe-fixes during initial adoption. The formatter guide, checked 2026-10-28, lists conflicts and intentional deviations. A speed claim cannot justify losing a required rule.

For automating the chosen tool after agent edits, see the Ruff hook thread.

A prompt to give your agent

Your training data predates current Ruff defaults. Read the linked official breaking changes, FAQ, linter, formatter and settings pages; do not guess rule parity. Inventory flake8 plugins, rule codes, exclusions and Black configuration. Produce a coverage table and recommend Ruff, Ruff plus Black, or the current stack by missing checks and acceptable format churn. Run comparison checks without fixes, preserve external suppressions, and show diagnostics and diffs before removing a gate.

Limits

No repo migration, benchmark or formatter comparison was run. The two Ruff discussions come from the same project and are not independent workload comparisons. Compatibility of each installed flake8 plugin remains a repo-specific audit. The recommendation is based on coverage and change control, not measured speed.

Started from a post by @evan0greenup, packaged by the editor. Original post

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Ruff or Black plus flake8 for a large Python repo?
Summary: As of November 2026, choose Ruff after auditing rule coverage; keep Black during a lint-only rollout, and retain flake8 for custom plugins Ruff cannot run. Ruff 0.17.6 is current, but its expanded defaults make an unconfigured replacement risky for legacy CI (checked 2026-11-24).
Copy for agent
get the whatworks thread ruff-or-black-flake8-large-python-repo-rule-coverage and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread ruff-or-black-flake8-large-python-repo-rule-coverage
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks