What Ruff Replaces
| Old Tool | Ruff Equivalent | Speed Improvement |
|---|---|---|
| Flake8 | ruff check |
25-100x faster |
| Black | ruff format |
10-30x faster |
| isort | ruff check --select I |
50x faster |
| pyupgrade | ruff check --select UP |
100x faster |
| pydocstyle | ruff check --select D |
50x faster |
| autoflake | ruff check --select F |
80x faster |
800+ Lint Rules
Ruff implements rules from 50+ Flake8 plugins:
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"F", # pyflakes
"I", # isort
"N", # pep8-naming
"UP", # pyupgrade
"B", # bugbear
"SIM", # simplify
"TCH", # type-checking imports
"RUF", # ruff-specific rules
]Auto-Fix
Most issues can be fixed automatically:
ruff check --fix .
# Fixed 42 issues:
# 12 × F401 (unused imports removed)
# 8 × I001 (imports sorted)
# 6 × UP035 (deprecated typing replaced)
# ...Editor Integration
- VS Code:
charliermarsh.ruffextension - Neovim: built-in LSP support
- Pre-commit:
ruff-pre-commithook
CI Configuration
# .github/workflows/lint.yml
- name: Ruff
run: |
pip install ruff
ruff check .
ruff format --check .Key Stats
- 40,000+ GitHub stars
- 800+ lint rules from 50+ plugins
- 10-100x faster than alternatives
- Written in Rust by Astral
- Used by FastAPI, Pandas, Airflow
FAQ
Q: What is Ruff? A: Ruff is a Python linter and formatter written in Rust that replaces Flake8, Black, isort, and several other tools with a single, 10-100x faster alternative.
Q: Is Ruff free? A: Yes, fully open-source under MIT license.
Q: Is Ruff compatible with Black formatting?
A: Yes, ruff format is designed as a drop-in replacement for Black with near-identical output.