Skip to content

Adopt Ruff, target Python 3.13, add type hints#2

Merged
jontyms merged 1 commit into
mainfrom
chore/ruff-python313-typehints
Jun 6, 2026
Merged

Adopt Ruff, target Python 3.13, add type hints#2
jontyms merged 1 commit into
mainfrom
chore/ruff-python313-typehints

Conversation

@jontyms

@jontyms jontyms commented Jun 6, 2026

Copy link
Copy Markdown
Member

Modernizes the project toward the Python style guide: Ruff, a current Python, and type hints.

Tooling — swap to Ruff

  • Replace black + isort with Ruff for formatting and linting.
  • Add [tool.ruff] config (rules E, F, I, UP, B, line-length 88, target-version = py313).
  • Update .pre-commit-config.yaml to the ruff + ruff-format hooks.
  • Replace the black.yml workflow with ruff.yml (installs uv, runs ruff check --fix + ruff format, auto-commits).
  • Delete isort.cfg; drop 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 <3.12 cap was hiding removed-stdlib usage, now fixed:
    • distutils.util.strtobool (removed in 3.12) → new githubapp/util.py drop-in.
    • collections.Iterable (removed in 3.10) → collections.abc.Iterable.
    • Drop the unused operator.truediv import.
  • Re-locked uv.lock against 3.13.

Type hints

  • Annotate every function/method signature across app.py and githubapp/*.py. Loosely-typed github3 client objects are Any; everything else uses concrete types.

Incidental

  • Fixed pre-existing lint surfaced by Ruff: 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.
  • All modules compile and githubapp imports cleanly with the Keycloak backend on 3.13.9.

Out of scope (still open from the style guide)

  • Flask → FastAPI, and sync → async. Flagged for separate discussion.
  • tox/tox-gh-actions dev deps are inert (no config, no tests) — left as-is; can remove if desired.

🤖 Generated with Claude Code

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>
@jontyms jontyms merged commit 7e5ac76 into main Jun 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant