Repository navigation
Fix ruff target version and mypy pre-commit hook - #9
Merged
puddly merged 2 commits intoSep 29, 2026
Merged
Conversation
- ruff target-version py39 -> py312, matching requires-python = ">=3.12". Newer ruff rejects the existing `match` statement as invalid syntax under py39. - Run the local mypy hook with `--group testing`: mypy lives in that dependency group, so `uv run --frozen mypy` failed to spawn in a venv synced without it. - Bump ruff-pre-commit v0.6.2 -> v0.16.9 (hook id `ruff` -> `ruff-check`) and codespell v2.3.0 -> v2.4.3.
UP017 (`timezone.utc` -> `UTC`) from the py312 target, and ruff 0.16's parenthesized multi-line lambda bodies. No behaviour change.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #9 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 6 6
Lines 1185 1185
=========================================
Hits 1185 1185 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
TheJulianJES
approved these changes
Sep 28, 2026
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved review issues remain, and all verification checks pass.
Review effort: Lite
Findings: None
What changed in this PR
Updates Ruff and pre-commit configuration for Python 3.12, fixes mypy dependency resolution, and applies resulting formatting changes.
Changes:
- Targets Ruff at Python 3.12.
- Updates Ruff and codespell hooks.
- Runs mypy with the
testingdependency group. - Modernizes UTC usage and formats multiline lambdas.
| File | Description |
|---|---|
zigpy_ziggurat/zigbee/wire.py |
Ruff formatting updates |
zigpy_ziggurat/zigbee/application.py |
Uses datetime.UTC |
pyproject.toml |
Sets Ruff target to Python 3.12 |
.pre-commit-config.yaml |
Updates hooks and mypy invocation |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Problems
[tool.ruff] target-version = "py39"does not matchrequires-python = ">=3.12". ruff 0.6.2 accepted the existingmatchstatement anyway, but current ruff reports it asinvalid-syntaxfor Python 3.9.uv run --frozen mypy, but mypy is in thetestingdependency group. In a venv synced without that group (for example after a plainuv sync), the hook fails with "Failed to spawn:mypy". CI is unaffected because it syncs thecigroup, which includestesting.Changes
target-version = "py312", matchingrequires-python.uv run --frozen --group testing mypy.ruff→ruff-check, the old id is now a legacy alias) and codespell v2.3.0 → v2.4.3.timezone.utc→UTC(UP017, from the new target) and ruff 0.16's parenthesized multi-line lambda bodies. No behaviour change.Verification
pre-commit run --all-filespasses on Python 3.14, including mypy in a venv without thetestinggroup.Context
This is one of a set of draft PRs that align the pre-commit setup of the zigpy libraries on ruff (
ruff check+ruff format), which zigpy, zha, zha-device-handlers, zigpy-znp, zigpy-ota and zigpy-ziggurat already use. The same change is proposed for bellows, zigpy-deconz, zigpy-xbee, zigpy-zigate and zigpy-cli, plus small ruff config fixes in zigpy and zigpy-ziggurat.The commits are kept separate so parts can be dropped or moved into their own PR. Maintainers can ask the bot for that, or for any other change, by commenting
@zigpy-review-bot <request>on this PR.