-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 to Python package for PEP 561 compliance #3704
Conversation
PEP 561 specifies that packages which contain either inline type hints or type stubs should indicate their support for type hints via including a file named `py.typed` in the root of the package. Since Pulumi already includes inline type hints, adding `py.typed` to the Python SDK simply allows these hints to be used by mypy.
Hi @csssuf Thanks so much for the PR here Can you tell me what this does? I’m not a python person at all and am wondering if this needs to go into our sdk generation for all of the providers as well Thanks Paul |
Sure! Essentially, mypy won't try to read type hints from a package unless that package specifies that it supports type hints via the |
@csssuf thanks for the explanation - so we just need an empty file and this will work? Wow! Thanks for that :) I can add this to the system and will ping you when it's done Thanks Paul |
Btw - we should also probably run mypy in either tests or the build process to ensure that our type annotations are clean/correct relative to mypy. I don’t think we do that yet today. (And so if we turn this on for users, they may see issues we haven’t ourselves tested for). |
I opened #3710 to track this. We do indeed have ~150 type errors in our existing SDK because we haven't been actually running any typechecker over them to-date. |
cc @bincyber I'm in the progress of getting this added to all of our providers, but you should be able to test this out in the meantime. |
Thanks for all the work on getting the type hints in good shape! Very excited to start taking advantage of them. |
PEP 561 specifies that packages which contain either inline type hints
or type stubs should indicate their support for type hints via
including a file named
py.typed
in the root of the package. SincePulumi already includes inline type hints, adding
py.typed
to thePython SDK simply allows these hints to be used by mypy.