ci: add ruff + mypy + pytest#21
Conversation
The repo had no build/typecheck/test CI. Add a uv-based workflow running: - ruff check (lint) - mypy (typecheck; ignore_missing_imports for the untyped script deps) - pytest (the existing analyze_stats smoke tests, via python_files config) Fixed the few mypy findings to make it green (implicit Optionals in analyze_stats.main, dict/None annotations in vitals/collect_stats).
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f403515463
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| column: str = None, | ||
| save: str = None, | ||
| since: datetime = None, | ||
| column: str | None = None, |
There was a problem hiding this comment.
Add postponed annotations for Python 3.9
This project still declares requires-python = ">=3.9", but analyze_stats.py does not use from __future__ import annotations. On Python 3.9 these new str | None/datetime | None parameter annotations are evaluated when the module is imported, raising TypeError: unsupported operand type(s) for | ..., so the analysis script becomes unusable on a supported interpreter. Either postpone annotation evaluation here or raise the minimum Python version.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in #24 — raised requires-python to >=3.10 (3.9 is EOL and 3.10 is the lowest we actually run). The PEP 604 str | None annotations are valid natively there, so no __future__ import needed.
The 'str | None' / 'datetime | None' parameter annotations added in #21 are evaluated at import time and fail on 3.9 (PEP 604 union syntax needs 3.10+). 3.9 is EOL and the lowest we actually run is 3.10 (collect-stats CI), so bump requires-python to >=3.10 rather than adding __future__ annotations.
The stats repo had no build/typecheck/test CI. Adds a uv-based
CIworkflow (runs on push to master + PRs):ignore_missing_importssince the deps are untyped scripts)analyze_statstest_load/test_load_allsmoke tests — wired up viapython_filessince they live inanalyze_stats.py, not atest_*.py)Fixed the handful of mypy findings to make it green (implicit Optionals in
main(), a couple ofdict/Noneannotations). All three pass locally.