You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the mypy config from the example, running mypy yields:
$ python -m poetry run mypy --show-error-codes --show-error-context tests/test_conflicting_ns.py:80: note: In module imported here:generated/protol/_plgen/example/v1/messages_pb2.pyi: note: In member "field_b" of class "Something":generated/protol/_plgen/example/v1/messages_pb2.pyi:24: error: Name "io.cloudevents.v1.cloudevents_pb2.CloudEvent" is not defined [name-defined]generated/protol/_plgen/example/v1/messages_pb2.pyi: note: In member "__init__" of class "Something":generated/protol/_plgen/example/v1/messages_pb2.pyi:27: error: Name "io.cloudevents.v1.cloudevents_pb2.CloudEvent" is not defined [name-defined]Found 2 errors in 1 file (checked 5 source files)make: *** [Makefile:78: python-validate-static] Error 1
The specific part of the transformation that is causing the problem is this I believe:
If I change this by hand to instead do from ...io.cloudevents.v1 import cloudevents_pb2 as io_dot_cloudevents_dot_v1_dot_cloudevents__pb2 and make corresponding changes in the rest of the file to use io_dot_cloudevents_dot_v1_dot_cloudevents__pb2 instead of io.cloudevents.v1.cloudevents_pb2 then mypy is entirely happy.
The text was updated successfully, but these errors were encountered:
This project is a great, thank you very much for making and maintaining it.
I have tried using it with typing however and I notice that mypy is not entirely happy with the rewriting of
.pyi
files.I have setup an example here: https://github.com/aucampia/issue-20221116-python_protobuf_cloudevents/tree/a245d29c2b1600b6580c6db861b4b715e72b9b51
The specific
.pyi
file that upsets mypy isgenerated/protol/_plgen/example/v1/messages_pb2.pyi
and the untransformed file isgenerated/proto/example/v1/messages_pb2.pyi
With the mypy config from the example, running mypy yields:
The specific part of the transformation that is causing the problem is this I believe:
If I change this by hand to instead do
from ...io.cloudevents.v1 import cloudevents_pb2 as io_dot_cloudevents_dot_v1_dot_cloudevents__pb2
and make corresponding changes in the rest of the file to useio_dot_cloudevents_dot_v1_dot_cloudevents__pb2
instead ofio.cloudevents.v1.cloudevents_pb2
then mypy is entirely happy.The text was updated successfully, but these errors were encountered: