Skip to content

Add py.typed marker#19

Merged
akhundMurad merged 1 commit intoakhundMurad:mainfrom
leonsmith:signal-package-is-typed
Mar 10, 2025
Merged

Add py.typed marker#19
akhundMurad merged 1 commit intoakhundMurad:mainfrom
leonsmith:signal-package-is-typed

Conversation

@leonsmith
Copy link
Copy Markdown
Contributor

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/

Copy link
Copy Markdown
Owner

@akhundMurad akhundMurad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point, thank you!

@akhundMurad akhundMurad added the bug Something isn't working label Mar 10, 2025
@akhundMurad akhundMurad merged commit 912172a into akhundMurad:main Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants