-
Notifications
You must be signed in to change notification settings - Fork 333
Add py.typed for marking the library as type checkable #713
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
base: master
Are you sure you want to change the base?
Conversation
Hi. Can this PR not be merged? |
Thanks for surfacing this. I don't think we have added type hints for all the functions, yet. However, since this PR was created we have added type hints to all the new functions. This should be a reasonable change to merge. I will take a look |
Heya, just bumping this so it doesn't get lost (I figure you're busy). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you @heckad for the contribution!
This is bad practice, py.typed should only exist when the package has a type distribution, either a stub file or inline annotations. |
Why? If you add them, mypy will check the typing. Even if there are at least some typings, it’s better than nothing. Now, even existing types won't be checked. |
The Type checkers like You can see more details on this topic in the typing specification Here is an example of a correct implementation of |
If |
@heckad |
Please check before writing. Example:
mypy outputs
Event If I add
Mypy: |
@heckad But the point is that adding from typing import reveal_type
from firebase_admin.app_check import verify_token
v = verify_token(1)
reveal_type(v) Without py.typed markmypy 1.15
pyright 1.1.400
With py.typed markmypy 1.15
pyright 1.1.400
Here what developers expect is that it returns from typing import reveal_type
from firebase_admin import get_app
reveal_type(get_app)
reveal_type(get_app()) |
I think you are confusing hot with soft. The problem with from typing import reveal_type
from firebase_admin import get_app
reveal_type(get_app)
reveal_type(get_app()) mypy's outputs
But this works only if
My point is that |
#569