Open
Conversation
Replaces five separate hooks (black, pyupgrade, reorder-python-imports,
add-trailing-comma, blacken-docs) with ruff-check + ruff-format. Ruff
does the work of all five in one pass, two orders of magnitude faster,
with a single config file.
pyproject.toml added (the project's first) with ruff config that keeps
the existing style:
- F/I/UP/COM rulesets cover what the old hooks covered. COM812 is
disabled because it conflicts with ruff-format; F401 is disabled
because the codebase has ~16 real unused imports that predate ruff
— worth cleaning up in a follow-up rather than in this PR.
- isort settings mirror reorder-python-imports: one import per line,
required `from __future__ import annotations`.
- docstring-code-format = true replaces blacken-docs.
Ruff's autofix applied small cleanups along the way (UP017
`timezone.utc` → `UTC`, F541 redundant f-strings, a few I001 import
reorderings). Net diff is ~15 lines across ten files. All tests still
green.
Follow-ups for future PRs:
- Enable F401 + fix the ~16 genuinely unused imports.
- Rename the accidentally-tri-underscored app/models/___init__.py to
__init__.py (currently a dead barrel file; the package works as an
implicit namespace).
- Drop `from __future__ import annotations` altogether now that the
required-imports rule lives in one place.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces five pre-commit hooks (black, pyupgrade, reorder-python-imports, add-trailing-comma, blacken-docs) with ruff-check + ruff-format. Two orders of magnitude faster, single config file, no more in-fighting hooks.
Config
New `pyproject.toml` (project's first) with ruff config that keeps the existing style:
What ruff autofix changed
Small, mechanical: 2× `UP017` (`datetime.timezone.utc` → `datetime.UTC`), 1× `F541` (redundant `f""`), 4× `I001` (minor import reorderings). Net ~15 lines across 10 files.
Follow-ups I'd do next
Test plan
🤖 Generated with Claude Code