Skip to content

Bump ruff/mypy target to 3.11, fix pyupgrade violations#129

Open
monkeypants wants to merge 2 commits intomasterfrom
bump-python-target-311
Open

Bump ruff/mypy target to 3.11, fix pyupgrade violations#129
monkeypants wants to merge 2 commits intomasterfrom
bump-python-target-311

Conversation

@monkeypants
Copy link
Copy Markdown
Contributor

Summary

  • Bump [tool.ruff] target-version from py310 to py311
  • Bump [tool.mypy] python_version from 3.10 to 3.11
  • Fix 279 UP017 violations: timezone.utcdatetime.UTC
  • Fix 13 UP042 violations: (str, Enum)StrEnum
  • Clean up unused timezone and Enum imports, re-sort import blocks

Context

pyproject.toml declares requires-python = ">=3.11" but both ruff and mypy were targeting 3.10. This is not cosmetic — the doctrine infrastructure imports tomllib (stdlib since 3.11), so 3.10 is not actually supported. The stale target suppressed valid pyupgrade suggestions.

All changes are mechanical (auto-fixed by ruff check --fix + black). No behavioural changes — datetime.UTC is just an alias for timezone.utc, and StrEnum is the stdlib replacement for the (str, Enum) pattern.

Stacks on #127.

Test plan

  • ruff check passes
  • black --check passes
  • 17 doctrine tests pass
  • 335 CEAP + repository tests pass

Fixes #128

Chris Gough added 2 commits March 26, 2026 21:30
The project uses black for formatting and ruff for linting, but this
was not documented anywhere. Add a comment to [tool.ruff] in
pyproject.toml making this explicit.

The CI doctrine job ran bare `pytest` instead of `uv run pytest`,
causing failures on systems where the system Python lacks tomllib
(pre-3.11). Use uv run for consistency with the other CI jobs.

Fixes #126
The project requires Python >=3.11 (tomllib is used in doctrine
infrastructure), but ruff and mypy were targeting 3.10. This suppressed
valid pyupgrade suggestions.

Bump both tool targets to 3.11 and apply the resulting fixes:

- UP017: timezone.utc → datetime.UTC (279 occurrences)
- UP042: (str, Enum) → StrEnum (13 occurrences)
- F401: remove now-unused timezone and Enum imports
- I001: re-sort imports after the above changes

All 352 tests pass. No behavioural changes.

Fixes #128
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.

Bump ruff/mypy target to 3.11 and fix pyupgrade violations

1 participant