Adopt Ruff, target Python 3.13, add type hints#2
Merged
Conversation
Tooling - Replace black + isort with Ruff for both formatting and linting. Add [tool.ruff] config (E, F, I, UP, B), update the pre-commit hooks, and swap the black.yml workflow for ruff.yml. Delete isort.cfg and drop the black/isort/pylint/seed-isort-config dev deps. Python 3.13 - Bump requires-python to >=3.13 (was >=3.9,<3.12) and add .python-version. The old upper bound masked removed-stdlib usage, now fixed: - distutils.util.strtobool (removed in 3.12) -> new githubapp/util.py - collections.Iterable (removed in 3.10) -> collections.abc.Iterable - drop the unused operator.truediv import - Re-lock uv.lock against 3.13. Type hints - Annotate every function/method signature across app.py and githubapp/*. Loosely-typed github3 client objects are typed Any; everything else uses concrete types. Also fixed pre-existing lint surfaced by Ruff (raise ... from, == True, %-format, a mutable default arg, unused imports, long lines). Co-Authored-By: Claude Opus 4.8 <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.
Modernizes the project toward the Python style guide: Ruff, a current Python, and type hints.
Tooling — swap to Ruff
[tool.ruff]config (rulesE, F, I, UP, B, line-length 88,target-version = py313)..pre-commit-config.yamlto theruff+ruff-formathooks.black.ymlworkflow withruff.yml(installsuv, runsruff check --fix+ruff format, auto-commits).isort.cfg; dropblack/isort/pylint/seed-isort-configdev deps.Python 3.13
requires-pythonto>=3.13(was>=3.9,<3.12) and add.python-version.<3.12cap was hiding removed-stdlib usage, now fixed:distutils.util.strtobool(removed in 3.12) → newgithubapp/util.pydrop-in.collections.Iterable(removed in 3.10) →collections.abc.Iterable.operator.truedivimport.uv.lockagainst 3.13.Type hints
app.pyandgithubapp/*.py. Loosely-typed github3 client objects areAny; everything else uses concrete types.Incidental
raise ... from,== True,%-format → f-string, a mutable default arg, unused imports, and long lines.Verification
ruff check .→ All checks passed;ruff format --check→ clean.githubappimports cleanly with the Keycloak backend on 3.13.9.Out of scope (still open from the style guide)
tox/tox-gh-actionsdev deps are inert (no config, no tests) — left as-is; can remove if desired.🤖 Generated with Claude Code