Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

abravalheri
Copy link
Contributor

@abravalheri abravalheri commented May 2, 2024

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

  1. Technically speaking, "a bit more correct". Because importlib_metadata collects 3rd-party implementations via find_distributions everything can happen.

@abravalheri abravalheri changed the title Adopt more realistic type annotations Adopt "more sound" type annotations May 2, 2024
@abravalheri abravalheri marked this pull request as ready for review May 2, 2024 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant