Repository navigation
Run strict mypy in pre-commit, clearer errors for missing extras - #25
Merged
Merged
Conversation
… adapter imports
- Bump the PackageNotFoundError fallback __version__ string to 1.0.0 to
match the released [project].version (was still 0.1.0).
- Add a local mypy pre-commit hook so the existing strict mypy config is
actually enforced (it was configured but never run).
- Wrap the optional third-party imports in fastapi/, flask/, ninja/, and
providers/{firebase,google,jwt}.py in try/except ImportError, re-raising
with a clear "install with: pip install altissimo-auth[extra]" message
instead of a raw ModuleNotFoundError.
- Fix the mypy errors this newly-wired hook surfaced: missing generic type
args (Callable, dict), unused type: ignore comments, untyped-call/
any-return findings around google-auth's verify_oauth2_token and PyJWT's
decode(), and added [[tool.mypy.overrides]] ignore_missing_imports for
firebase_admin, google_auth_oauthlib, django, and stripe, none of which
ship type stubs.
poetry run pre-commit run --all-files and poetry run pytest both pass
(164 tests).
Co-Authored-By: Claude Sonnet 5 <[email protected]>
- The local mypy pre-commit hook used `entry: mypy`, which only works with the Poetry venv on PATH; a plain `git commit` failed with "Executable `mypy` not found". Use `poetry run mypy`, as customerio-python does. - Fallback __version__ is now 1.1.0, matching the released version. - CHANGELOG entry for these changes under Unreleased. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RKNZkKLdZpDSx8Nfrignfz
Merged
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.
Lands a74fe4f, a commit from Sep 15 that was on a local
mainbut never pushed, rebased onto currentmain, plus a follow-up commit.From a74fe4f:
pyproject.tomlwas never run; a local hook now runs it onsrc, so CI enforces it. The type errors it found are fixed (generic args onCallable/dict, unused ignores,no-untyped-callaround google-auth and PyJWT), andignore_missing_importsis set forfirebase_admin,google_auth_oauthlib,djangoandstripe, which ship no stubs.altissimo.auth.fastapi,.flask,.ninja,.providers.firebase,.providers.googleor.providers.jwtwithout its extra raisesImportError: … Install it with: pip install altissimo-auth[fastapi]instead of a bareModuleNotFoundError.Follow-up commit:
entry: mypyonly worked with the Poetry venv on PATH, so a plaingit commitfailed with "Executablemypynot found". It's nowpoetry run mypy, as in customerio-python.__version__was set to 1.0.0 in a74fe4f; it's now 1.1.0, the released version.Locally: pre-commit (with mypy) passes both via
poetry runand plainpre-commit, and 164 tests pass. Importingaltissimo.auth.fastapiwith fastapi blocked gives the new message.🤖 Generated with Claude Code
https://claude.ai/code/session_01RKNZkKLdZpDSx8Nfrignfz