-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
Adopt "more sound" type annotations #487
base: main
Are you sure you want to change the base?
Conversation
Thanks for the proposal. I'm going to have to think about this more. This library is merged back into CPython as Is there any way to achieve the objectives either by:
|
Thanks @jaraco for the code review.
Unfortunately I don't think so. In this sense only
I gave it a try... don't know if that is exactly what you had in mind, but I tried to do my best. I am not good with names, so if you have suggestions regarding names please let me know. |
Motivated by #486.
This PR just provides more realistic type annotations1 to improve the type checking soundness of the package.
It does not solve #486: all the limitations are still present, but at least type checkers would help to notify users when they are trying to use new APIs that are not safe (not necessary all the time, but better than now).
It is a bit of a pain, but these annotations should be a bit more sound than they currently are.
This should also prevent future versions of this library from introducing incompatible behaviour (thanks to
pytest-mypy
).Footnotes
Technically speaking, "a bit more correct". Because
importlib_metadata
collects 3rd-party implementations viafind_distributions
everything can happen. ↩