Skip to content

Fix mypy errors, add mypy config, and run mypy in CI#172

Merged
beaufour merged 1 commit into
masterfrom
precommit-and-mypy
Jun 27, 2026
Merged

Fix mypy errors, add mypy config, and run mypy in CI#172
beaufour merged 1 commit into
masterfrom
precommit-and-mypy

Conversation

@beaufour

@beaufour beaufour commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Makes uv run mypy flickr_api/ pass cleanly (was 3 errors) and wires mypy into CI so type errors are caught going forward.

Changes

  • method_call.py — narrow _RATE_LIMIT_REQUESTS_PER_HOUR with an explicit if/else in get_rate_limit_status(), fixing the float / None operand error without duplicating the None check.
  • pyproject.toml — add a [tool.mypy] section with ignore_missing_imports overrides for:
    • requests_oauthlib — ships no type stubs
    • PIL (Pillow) — an optional runtime dependency, not installed by default
  • .github/workflows/ci.yml — add a mypy step to the lint job so type errors are caught in CI and don't regress.

Verification

  • uv run mypy flickr_api/Success: no issues found (was 3 errors)
  • uv run flake8 flickr_api/ — clean
  • uv run ruff check flickr_api/ — clean
  • uv run ruff format --check flickr_api/ — clean
  • uv run pytest282 passed

- method_call.py: narrow `_RATE_LIMIT_REQUESTS_PER_HOUR` with an explicit
  if/else so the `float / None` operand error is gone, without
  duplicating the None check.
- pyproject.toml: add a [tool.mypy] section with ignore_missing_imports
  overrides for `requests_oauthlib` (no stubs) and `PIL` (optional, not
  installed by default).
- ci.yml: add a `mypy` step to the lint job so type errors are caught in
  CI and don't regress.

`uv run mypy flickr_api/` is now clean (was 3 errors). flake8, ruff
check, ruff format --check, and all 282 tests still pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@beaufour beaufour force-pushed the precommit-and-mypy branch from 32e8ade to 37534d4 Compare June 27, 2026 21:41
@beaufour beaufour changed the title Fix mypy errors and add mypy config Fix mypy errors, add mypy config, and run mypy in CI Jun 27, 2026
@beaufour beaufour merged commit 2d52b33 into master Jun 27, 2026
5 checks passed
@beaufour beaufour deleted the precommit-and-mypy branch June 27, 2026 21:42
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