Summary
The project currently uses Black (line-length 88) and isort for formatting but lacks a linter to enforce PEP 8 naming, unused imports, and other non-formatting rules.
Proposal
Add Ruff as a single-tool replacement for flake8/pycodestyle/pydocstyle with auto-fix support.
Suggested pyproject.toml configuration
[tool.ruff]
line-length = 88
target-version = "py312"
[tool.ruff.lint]
select = ["E", "F", "W", "I", "N", "UP", "B"]
Rule sets
| Code |
Category |
Description |
| E |
pycodestyle errors |
Core PEP 8 style |
| F |
pyflakes |
Unused imports, undefined names |
| W |
pycodestyle warnings |
Whitespace issues |
| I |
isort |
Import ordering (replaces standalone isort) |
| N |
pep8-naming |
Naming conventions |
| UP |
pyupgrade |
Modernize Python syntax |
| B |
flake8-bugbear |
Common bug patterns |
Rollout plan
- Add Ruff to
[project.optional-dependencies] dev
- Run
ruff check --fix . for auto-fixable violations
- Run
black . and isort . to reformat
- Manual review for remaining violations
- Add
ruff check to CI pipeline
- Use
git blame --ignore-rev to exclude the formatting commit
Notes
- Ruff is 10-100x faster than flake8/pylint
- Already Black-compatible out of the box
- Existing code largely follows PEP 8 naming conventions already
- Keep line-length at 88 to match existing Black config
- Do this as a separate PR to avoid polluting git blame
Summary
The project currently uses Black (line-length 88) and isort for formatting but lacks a linter to enforce PEP 8 naming, unused imports, and other non-formatting rules.
Proposal
Add Ruff as a single-tool replacement for flake8/pycodestyle/pydocstyle with auto-fix support.
Suggested
pyproject.tomlconfigurationRule sets
Rollout plan
[project.optional-dependencies] devruff check --fix .for auto-fixable violationsblack .andisort .to reformatruff checkto CI pipelinegit blame --ignore-revto exclude the formatting commitNotes