Instead of Flake8: Ruff
Use Ruff instead of Flake8. It implements every Flake8 rule plus native versions of the popular plugins, and runs 10 to 100 times faster by Astral's measurements. It can also fix many problems automatically.
Both are for linting Python code.
Why Ruff is better
- Astral reports Ruff as 10 to 100 times faster than existing linters such as Flake8. LWN reported it as 150 times faster than Flake8 when linting the CPython code base.
- Over 900 rules come built in, including native versions of flake8-bugbear, flake8-bandit and dozens of other plugins, so there is no plugin list to install and pin.
- Many violations, such as unused imports, are fixed automatically with --fix, where Flake8 only reports them.
- Ruff reads pyproject.toml and also replaces isort, pyupgrade and autoflake, so several tools collapse into one.
When to keep Flake8
Keep Flake8 if you depend on custom or in-house Flake8 plugins. Ruff does not support third-party plugins, so a rule it has not reimplemented cannot be added.
Switching
For projects that use Flake8 with few or no plugins, Ruff is a drop-in replacement. Map your select and ignore codes into the [tool.ruff.lint] section of pyproject.toml; the codes keep the same names. Then swap the pre-commit hook and CI step. Check that each plugin you use appears in Ruff's list of reimplemented plugins.
Watch out
Ruff does not implement every pycodestyle style rule, on the assumption that a formatter handles layout. It has no plugin system, so a missing rule means waiting for Astral to add it. Ruff remains MIT-licensed after OpenAI bought Astral in March 2026.
More newer, better linters, formatters and type checkers
Sources
- Ruff documentation
- Ruff FAQ
- Flake8 documentation
- LWN: Ruff, a fast Python linter
- Real Python: Ruff
- Simon Willison: Thoughts on OpenAI acquiring Astral
Judged on 2026-11-06. See every linters, formatters and type checkers, or all 66 replacements.