Fix mypy errors, add mypy config, and run mypy in CI#172
Merged
Conversation
- 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>
32e8ade to
37534d4
Compare
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.
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_HOURwith an explicitif/elseinget_rate_limit_status(), fixing thefloat / Noneoperand error without duplicating theNonecheck.pyproject.toml— add a[tool.mypy]section withignore_missing_importsoverrides for:requests_oauthlib— ships no type stubsPIL(Pillow) — an optional runtime dependency, not installed by default.github/workflows/ci.yml— add amypystep 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/— cleanuv run ruff check flickr_api/— cleanuv run ruff format --check flickr_api/— cleanuv run pytest— 282 passed