Repository navigation
chore: align ruff and mypy with the pre-commit hooks; group them in Renovate - #461
Merged
Merged
Conversation
…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.
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.
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-filesfailed on master while CI stayed green.Align the versions
pyproject.tomlto match (ruff>=0.17.0,mypy>=2.4.0).additional_dependenciesfloors in line withpyproject.toml(fastapi>=0.128.2,pydantic>=2.7.0,pytest>=8.3.5,pytest-asyncio>=0.26.0). Dropstarlette, which fastapi brings in.Fix what the new versions report
import datetime as dtinscripts/changelog_release.pyandtests/test_changelog_release.py, for ruff 0.17'sunconventional-import-alias.# type: ignore[union-attr]onTestClient.portalwithassert ... is not None.portalis 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 theirgroupNamewins:rangeStrategyruffruff(pyproject/uv.lock) andastral-sh/ruff-pre-commitbumpmypymypyandpre-commit/mirrors-mypybumpuvuv_build(build backend) andastral-sh/uv-pre-commitbumpraises the pyproject floor to the new release, so the grouped PR relocks to the same version the hook moves to. The config passesrenovate-config-validator --strict.Checklist
tests/cover the change: the touched Redis tests pass against a live Redis (88 passed)fastapi_cachex/changesuv run pre-commit run --all-filespasses again.uv run pytestpasses (1202 passed, 192 skipped), and so do CI's lint commands (ruff, ruff format, mypy strict,mypy tests,mypy scripts).Generated by Claude Code