Skip to content

ci: add ruff + mypy + pytest#21

Merged
ErikBjare merged 1 commit into
masterfrom
ci/ruff-mypy-pytest
Jul 12, 2026
Merged

ci: add ruff + mypy + pytest#21
ErikBjare merged 1 commit into
masterfrom
ci/ruff-mypy-pytest

Conversation

@ErikBjare

Copy link
Copy Markdown
Member

The stats repo had no build/typecheck/test CI. Adds a uv-based CI workflow (runs on push to master + PRs):

  • ruff check (lint)
  • mypy (typecheck; ignore_missing_imports since the deps are untyped scripts)
  • pytest (the existing analyze_stats test_load/test_load_all smoke tests — wired up via python_files since they live in analyze_stats.py, not a test_*.py)

Fixed the handful of mypy findings to make it green (implicit Optionals in main(), a couple of dict/None annotations). All three pass locally.

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).
@ErikBjare ErikBjare merged commit fe0ad4d into master Jul 12, 2026
1 check passed
@ErikBjare ErikBjare deleted the ci/ruff-mypy-pytest branch July 12, 2026 17:26

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread analyze_stats.py
column: str = None,
save: str = None,
since: datetime = None,
column: str | None = None,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

ErikBjare added a commit that referenced this pull request Jul 12, 2026
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.
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