Uh oh!
There was an error while loading. Please reload this page.
type annotations - #449
Conversation
jaraco
commented
Apr 15, 2023
FYI, @RonnyPfannschmidt was also considering tackling this effort (discussion in #importlib-metadata channel on PyPA discord). |
dimbleby
commented
Apr 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
commented
Apr 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.
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
commented
Apr 18, 2023
OK, I've pushed change that - I hope - err in the direction of avoiding and deferring any difficult questions
|
jaraco
commented
Apr 22, 2023
Yes. |
dimbleby
commented
Apr 22, 2023
the code that you have merged still used importlib_metadata/importlib_metadata/__init__.py Lines 796 to 798 in 705a757 |
jaraco
commented
Apr 22, 2023
Aah. I was looking at the wrong thing (because it wasn't in the diff). I think |
jaraco
commented
Dec 16, 2023
I realized that the declaration of |
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.