Add inline type hints for public API#153
Merged
Merged
Conversation
Documents the approach for adding inline type hints to the public API to address issue #127. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Detailed step-by-step plan for adding inline type hints to the public API. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add class attribute annotations and __init__ type hints to: - FlickrAPIError: code (int), message (str) - FlickrServerError: status_code (int), content (str) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Type all classes and functions in auth.py: - AuthHandler class with class attributes and all methods - OAuthRequest class with all dunder methods - Module-level functions token_factory and set_auth_handler Added necessary type narrowing checks for mypy compliance. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add comprehensive type annotations to the core infrastructure classes: - FlickrObject: Base class with typed converters, display, and all methods - FlickrList: Typed as UserList[FlickrObject] with info attribute - Walker: Generic[T] iterator for paginated results - SlicedWalker: Generic[T] for sliced iteration Uses TypeVar T bound to FlickrObject for generic walker typing. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add class-level type annotations for commonly-accessed attributes to main domain classes (Person, Photo, Photoset, Gallery, Group, Tag) and type the dict_converter helper function. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add minimal type annotations to cache.py, reflection.py, and api.py to allow full mypy pass on the package. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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
py.typedmarker for PEP 561 compliancemypyandtypes-requeststo dev dependenciesCloses #127
Changes
Typed modules:
flickrerrors.py- Exception classeskeys.py-set_keys()and module variablesauth.py-AuthHandler,OAuthRequest,token_factory(),set_auth_handler()method_call.py-enable_cache(),disable_cache(),set_timeout(),get_timeout()upload.py-upload(),replace()objects.py- Base classes (FlickrObject,FlickrList,Walker,SlicedWalker) and domain classes (Person,Photo,Photoset,Gallery,Group,Tag)New files:
flickr_api/py.typed- PEP 561 markerDesign decisions
.pyistub files since Python 3.10+ is already requiredAnyfor dynamic API responsesTest plan
uv run mypy flickr_api/ --ignore-missing-importspasses (0 errors)uv run pytestpasses (237 tests)py.typedincluded in wheel distribution🤖 Generated with Claude Code