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

Add py.typed marker #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

leonsmith
Copy link

When pulling this project into a typed project, mypy refuses to use the types present becuase its missing the py.typed marker.

You end up with the following error:

error: Skipping analyzing "typeid": module is installed, but missing library stubs or py.typed marker  [import-untyped]
note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports

Super simple to fix by adding a py.typed file to the project.

You can of course bypass this and force mypy to still use the types with the following config but it would be nice to work out of the box considering it already has types 😄

[[tool.mypy.overrides]]
module = ["typeid.*"]
follow_untyped_imports = true

More reading:
https://mypy.readthedocs.io/en/stable/installed_packages.html#creating-pep-561-compatible-packages
https://blog.whtsky.me/tech/2021/dont-forget-py.typed-for-your-typed-python-package/
https://peps.python.org/pep-0561/

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.

1 participant