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

Fix autogenerated protobuf stub's nonexistent import #4815

Closed
gvanrossum opened this issue Dec 13, 2020 · 4 comments · Fixed by #4850
Closed

Fix autogenerated protobuf stub's nonexistent import #4815

gvanrossum opened this issue Dec 13, 2020 · 4 comments · Fixed by #4850

Comments

@gvanrossum
Copy link
Member

My PR (#4814) is failing tests in a part I didn't touch:

running mypy --python-version 3.9 --strict-optional --no-site-packages --show-traceback --no-implicit-optional --disallow-any-generics --disallow-subclassing-any --platform linux # with 1042 files
third_party/2and3/google/protobuf/util/json_format_proto3_pb2.pyi:45: error: Cannot find implementation or library stub for module named 'google.protobuf.unittest_pb2'
third_party/2and3/google/protobuf/util/json_format_proto3_pb2.pyi:45: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1042 source files)

(and repeated for other versions). The same seems to be happening for other recent PRs, e.g. #4813 and #4811.

@gvanrossum gvanrossum added the priority: high This issue is more important than most label Dec 13, 2020
@hauntsaninja
Copy link
Collaborator

Did some investigating, it looks like the trigger for this was syncing typeshed: python/mypy#9794
The error looks legitimate, the file was removed in https://github.com/python/typeshed/pull/4785/files#diff-328c07f017a31da756c9b78484dbeab4ec7757a29092a2ba2c9afe2d4bc63a50 but continues to be imported. I assume mypy managed to continue to find the file in its bundled typeshed, which is a little weird (maybe mypy_test should pass in --custom-typeshed-dir).

I'm not sure how to fix, since the file is autogenerated, so cc @nipunn1313

@hauntsaninja
Copy link
Collaborator

hauntsaninja commented Dec 13, 2020

(In case Nipunn doesn't see this soon, just removing third_party/2and3/google/protobuf/util/json_format_proto3_pb2.pyi entirely seems to be enough to get things green in a pinch)

hauntsaninja pushed a commit to hauntsaninja/typeshed that referenced this issue Dec 13, 2020
I think this should helps prevent issues like python#4815
JelleZijlstra pushed a commit that referenced this issue Dec 14, 2020
I think this should helps prevent issues like #4815

Co-authored-by: hauntsaninja <>
srittau added a commit to srittau/typeshed that referenced this issue Dec 14, 2020
Works around python#4815, although a proper fix is needed.
srittau added a commit that referenced this issue Dec 14, 2020
Works around #4815, although a proper fix is needed.
@srittau
Copy link
Collaborator

srittau commented Dec 14, 2020

I have replaced the missing import with Any for now. This should work, but of course still needs a proper fix.

@hauntsaninja hauntsaninja removed the priority: high This issue is more important than most label Dec 14, 2020
@hauntsaninja hauntsaninja changed the title Tests seem to be failing Fix autogenerated protobuf stub's nonexistent import Dec 14, 2020
@nipunn1313
Copy link
Contributor

Fixed! My mistake.
Thanks for the report @gvanrossum - and thanks for the quick fix @srittau - bought me time to look into a proper fix.

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 a pull request may close this issue.

4 participants