Skip to content

chore: align ruff and mypy with the pre-commit hooks; group them in Renovate - #461

Merged
allen0099 merged 1 commit into
masterfrom
claude/charming-gauss-dyvsj7
Oct 14, 2026
Merged

allen0099 merged 1 commit into
masterfrom
claude/charming-gauss-dyvsj7

Conversation

@allen0099

Copy link
Copy Markdown
Owner

No issue: this is maintenance, a follow-up to #453.

Summary

#453 moved the ruff and mypy pre-commit hooks to v0.17.0 and v2.4.0. uv.lock, which CI lints with, stayed on ruff 0.16.9 and mypy 2.3.1. As a result, pre-commit run --all-files failed on master while CI stayed green.

Align the versions

  • Lock ruff 0.17.0 and mypy 2.4.0, and raise the dev floors in pyproject.toml to match (ruff>=0.17.0, mypy>=2.4.0).
  • Bring the mypy hook's additional_dependencies floors in line with pyproject.toml (fastapi>=0.128.2, pydantic>=2.7.0, pytest>=8.3.5, pytest-asyncio>=0.26.0). Drop starlette, which fastapi brings in.

Fix what the new versions report

  • import datetime as dt in scripts/changelog_release.py and tests/test_changelog_release.py, for ruff 0.17's unconventional-import-alias.
  • Replace four # type: ignore[union-attr] on TestClient.portal with assert ... is not None. portal is Optional in starlette 1.7's stubs (locked) but not in the newer starlette the hook installs. So the ignore was required in one environment and flagged as unused in the other; the assert passes in both.

Renovate: one PR per tool
New packageRules, placed after the manager groups so their groupName wins:

Group Packages rangeStrategy
ruff ruff (pyproject/uv.lock) and astral-sh/ruff-pre-commit bump
mypy mypy and pre-commit/mirrors-mypy bump
uv uv_build (build backend) and astral-sh/uv-pre-commit default

bump raises the pyproject floor to the new release, so the grouped PR relocks to the same version the hook moves to. The config passes renovate-config-validator --strict.

Checklist

  • The issue above is assigned to me: no issue, maintenance only
  • Tests under tests/ cover the change: the touched Redis tests pass against a live Redis (88 passed)
  • A changelog fragment: not needed, nothing under fastapi_cachex/ changes
  • uv run pre-commit run --all-files passes again. uv run pytest passes (1202 passed, 192 skipped), and so do CI's lint commands (ruff, ruff format, mypy strict, mypy tests, mypy scripts).

Generated by Claude Code

…enovate

#453 moved the ruff and mypy pre-commit hooks to v0.17.0 and v2.4.0
while uv.lock, which CI lints with, stayed on ruff 0.16.9 and mypy
2.3.1, so `pre-commit run --all-files` failed on master while CI was
green.

- Lock ruff 0.17.0 and mypy 2.4.0 and raise the dev floors to them.
- Import datetime as dt (ruff 0.17's unconventional-import-alias).
- Replace four `type: ignore[union-attr]` on TestClient.portal with an
  assert: portal is Optional in starlette 1.7's stubs but not in the
  newer starlette the hook installs, so the ignore was needed in one
  environment and unused in the other.
- Bring the mypy hook's additional_dependencies floors in line with
  pyproject.toml and drop starlette, which fastapi brings.
- Renovate: group each tool's hook with its pinned dependency (ruff,
  mypy, and uv-pre-commit with uv_build), with rangeStrategy bump so
  the PR raises the floor and relocks to the same version.
@allen0099
allen0099 merged commit 88f6de2 into master Oct 14, 2026
15 checks passed
@allen0099
allen0099 deleted the claude/charming-gauss-dyvsj7 branch October 14, 2026 05:53
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