Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork93
type annotations#449
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
type annotations#449
Conversation
jaraco commentedApr 15, 2023
FYI,@RonnyPfannschmidt was also considering tackling this effort (discussion in #importlib-metadata channel on PyPA discord). |
dimbleby commentedApr 15, 2023
Cool. I'm mostly just aiming for the low-hanging fruit here and perhaps testing the waters for receptiveness to further work. The pipeline and I both are currently happy; I reckon I'm done fiddling with this one now. |
RonnyPfannschmidt commentedApr 15, 2023
I have not yet started own work, great to see this start |
jaraco left a comment
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.
This looks good and nearly ready to merge. Just a few concerns to address.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
dimbleby commentedApr 18, 2023
OK, I've pushed change that - I hope - err in the direction of avoiding and deferring any difficult questions
|
jaraco commentedApr 22, 2023
Yes. |
dimbleby commentedApr 22, 2023
the code that you have merged still used importlib_metadata/importlib_metadata/__init__.py Lines 796 to 798 in705a757
|
jaraco commentedApr 22, 2023
Aah. I was looking at the wrong thing (because it wasn't in the diff). I think |
jaraco commentedDec 16, 2023
I realized that the declaration of |
Uh oh!
There was an error while loading.Please reload this page.
It's kind of annoying that this library publishes a py.typed, but most of the API is not type-annotated. Users who check their own code with mypy are obliged to scatter around
# type: ignore[no-untyped-call]comments.Possible points of interest:
joinpathon theSimplePathseems to have been just wrongIterables asIterators, because (i) they are and (ii)Distribution.from_name()relies on this when it callsnext(..)rather thannext(iter(..))This MR doesn't annotate the whole API: I've ducked the slightly difficult ones like
distributions(),select()andmatches(). typeshed has annotations that are presumably satisfactory in practice, but it looks as though applying them here would be more invasive than I intend to be in this commit.https://github.com/python/typeshed/blob/main/stdlib/importlib/metadata/__init__.pyiThis MR is a long way from annotating the whole project -
mypy --strict importlib_metadatareports 171 errors, so it would take a bit more of a campaign to work through that.