New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge and update variable and params annotations from typeshed #4246
base: main
Are you sure you want to change the base?
Merge and update variable and params annotations from typeshed #4246
Conversation
e179ba7
to
c9c9332
Compare
c9c9332
to
b0e1a1e
Compare
_NestedStr = Union[str, Iterable[Union[str, Iterable["_NestedStr"]]]] | ||
_InstallerType = Callable[["Requirement"], Optional["Distribution"]] | ||
_PkgReqType = Union[str, "Requirement"] | ||
_EPDistType = Union["Distribution", _PkgReqType] | ||
_MetadataType = Optional["IResourceProvider"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These aliases come from the typeshed stub. Please lmk if you'd prefer different names or to make them public.
…sources-variables-params-annotations
…sources-variables-params-annotations
…sources-variables-params-annotations
require = None | ||
working_set = None | ||
require = cast("Callable[..., Any]", None) | ||
working_set = cast("WorkingSet", None) | ||
add_activation_listener = None | ||
cleanup_resources = None | ||
resource_stream = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like the way it's been done in https://github.com/pypa/setuptools/pull/4242/files#diff-e3d3d454fa3a072c9f46f8affa27513892fbc2d245e87f57a5927a7be851de05R3332-R3349 is better than casting all these with forward references and redefining callable types.
pkg_resources/__init__.py
Outdated
egg_name: str | ||
egg_info: str | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
egg_name: str | |
egg_info: str |
Actually there's no assurance that an egg is even found.
…github.com/Avasam/setuptools into pkg_resources-variables-params-annotations
…sources-variables-params-annotations
…sources-variables-params-annotations
fcca83f
to
93053ec
Compare
Summary of changes
Merge and update (because they were not all correct or exact) variable and params annotations from typeshed. Missing public annotations are missing from typeshed too.
This PR purposefully avoids adding TypeVars, overloads and return types. Those will all be tackled in a follow-up PR. Return types are inferred at this step.
Step 3.1 of #2345 (comment) but only for
pkg_resources
Pull Request Checklist
newsfragments/
.(See documentation for details)