-
Notifications
You must be signed in to change notification settings - Fork 15
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 Python type-hinting throughout Pulumi codebase #1390
Add Python type-hinting throughout Pulumi codebase #1390
Conversation
@JimMadge : this is mostly ready to review (just two files that aren't passing |
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.
I think that is looking better. Painful to add now but I hope in the future this will,
- Help avoid errors/bugs due to types mismatching
- Ensure that input is properly parsed/sanitised
Are the .pyi
files necessary? They are for modules we import?
These are effectively header files for libraries we import that don't have native type hinting (or don't advertise that they do). For common libraries you can normally install a |
I hope the starting point was automatically generated somehow 😱. Sorry, I asked the wrong question. I think what I'm really trying to ask is,
Also, did you get |
It complains about missing stubs (eg.
Not really.
Yes, but it's not a bug since type-hinting is still very optional.
Yes.
Yes, the trick is actually to use a I now have everything working with the stub files. I can try removing them if you prefer this? |
I think we should try and make that work, especially as we agree there is no desire to maintain these stub files. As type hinting is, and presumably will remain, optional I think it makes most sense to not type untyped libraries ourselves. |
@JimMadge : Now ready for review with type-hinting stubs removed and |
c947093
to
8b86a86
Compare
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 👍
I think the Pulumi stub file is a good idea to help type checking finish in a reasonable time without overwriting Pulumi's own typing hints.
59ff0fa
to
b50b141
Compare
✅ Checklist
Enable foobar integration
rather than515 foobar
).developpython-migration branch.developpython-migration branch (you probably started your branch fromdevelop
but it may have changed since then)../tests/AutoFormat_Powershell.ps1 -TargetPath <path to file or directory>
.🌂 Related issues
Fix unresolved issues from #1375
🔬 Tests
Tested by running
mypy
locally.