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

Signal support for type checking via py.typed #35

Merged
merged 2 commits into from
Feb 14, 2025

Conversation

timhallmann
Copy link
Contributor

Otherwise some type checkers (e.g. mypy) assume the project to be untyped.

@lilioid
Copy link
Member

lilioid commented Feb 13, 2025

hmmm 🤔, there was a reason I didn't include that initially. I can't remember why right now though.
I'll look into it again

@lilioid
Copy link
Member

lilioid commented Feb 13, 2025

Ahh yes, I have look at the documentation and found the following requirement:

Package maintainers who wish to support type checking of their code MUST add a marker file named py.typed to their package supporting typing. This marker applies recursively: if a top-level package includes it, all its sub-packages MUST support type checking as well.

I am not sure if all our dependencies support this by now but this was why we didn't add the py.typed file initially.

@timhallmann
Copy link
Contributor Author

I don't think that refers to dependencies but e.g. to namespace packages such as when you have a package foo that includes the separately installable sub-packages foo.bar and foo.baz.

mypy certainly doesn't mind cryptojwt, furl and requests lacking a py.typed, and pyright generally attempts to infer as much as possible, even when there aren't any type hints. Though I do not know what pyre is doing.

@lilioid lilioid merged commit 006c5f6 into fsinfuhh:main Feb 14, 2025
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.

2 participants