-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Protobuf stubs update using mypy-protobuf #4785
Conversation
f7c58cf
to
ae428a9
Compare
Sorry about all the force pushes! Took me a while to figure out how to skip black/isort/pytype/flake8 on these autogenerated files. This should be ready now! |
@@ -0,0 +1,62 @@ | |||
#!/bin/bash |
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.
Could you add a comment explaining the purpose of this file more directly?
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.
yep! I elaborate on the comment - describing that the script autogenerates the _pb2.pyi files
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.
Thanks, sounds good!
ae428a9
to
6794ed2
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.
This looks good to me but leaving it open for a little while in case @rchen152 wants to address the new pytype excludelist entries.
Thanks for the ping! That's a lot of excludelist entries, so yeah, I think I'll want to fix the pytype parser. The Thanksgiving holiday is coming up, so I won't be able to release a fix until sometime next week at the earliest - feel free to merge this now, and I can clean up the pytype excludelist later. |
Thanks friends! |
This started as an attempt to support the stubs added to the pytype exclude list in python/typeshed#4785. Those stubs turned out to be a bit of a hairball, but supporting NewType seems useful anyway. Resolves #597. PiperOrigin-RevId: 345364292
This uses mypy-protobuf to check in up to date stubs for google.protobuf proto
files. The PR is split into two commits, one which checks in a script for generating
these stubs, and second for the generated .pyi stubs.
The current stubs were manually added from a very-old version of mypy-protobuf years ago (before mypy-protobuf was even open source). This PR updates them, and streamlines the process for updating them again in the future. With each release of protobuf, typeshed will have to update the stubs.
Fixes nipunn1313/mypy-protobuf#158
Fixes #2521
Ultimately, much of this can be resolved by integrating mypy-protobuf with protobuf itself, but that's not currently on the horizon - tracked in both
nipunn1313/mypy-protobuf#95
protocolbuffers/protobuf#2638 (comment)