Conversation
|
@juraj-juraj Sorry for the delay! Would you mind adding a test case, or describing it here if you don't want to do that? |
|
@cpcloud This change basically adds an import statement. So because of that, the tests will fail. I think to test this enough would be to just fix the tests. Sadly I wasn't able to make tests work, otherwise I would've done it. |
|
Ok, I can take a look at the failures. |
cpcloud
left a comment
There was a problem hiding this comment.
This is currently generating invalid Python code.
0004eed to
4047fc2
Compare
|
Ok, I got the tests passing, but I think the rules are incorrect. The rewrite should only apply to |
|
@juraj-juraj can you paste here the following:
From those I can build a test to verify the desired behavior |
|
I'm including whole hierarchy of protofiles used protofiles.zip. The bug is only apparent in pyi files, where import simply isn't fixed. The rule which I introduced applies to all files, not just .pyi. I didn't know whether it would break something, and it worked for me. So that's why it is fixed like it is. python3 -m grpc_tools.protoc -I./ --python_out=./src/phx_grpc_interface --grpc_python_out=./src/phx_grpc_interface --pyi_out=./src/phx_grpc_interface ./phonexia/common/core.proto ./phonexia/common/health_check.proto ./phonexia/technologies/genderid/v1beta/gid.proto ./phonexia/technologies/speakerid/v1beta/sid.protoThe protol invocation: protol -o ./src/phx_grpc_interface --in-place protoc --proto-path=./ ./phonexia/common/core.proto ./phonexia/common/health_check.proto ./phonexia/technologies/genderid/v1beta/gid.proto ./phonexia/technologies/speakerid/v1beta/sid.proto |
|
Just stumbled upon this issue in one of our projects. The proposed rewrite rule doesn't seem right: There is no bare But the bigger problem is that this change does not account for name collisions. Imagine that you have packages The |
|
👋 What is the conclusion here? |
|
@cpcloud Are there any plans to move forward with this? |
This pull request fixes issue #850.
Imports in pyi file generated by grpc_tools.protoc are different, thus rewrite rules do not catch it.
New rule was added to account for that.