Closed linzhp closed 3 months ago
I am also looking for an update on this issue. Could it be possible to add the same default as for protobuf generation which generates by default the subdirectories automatically?
I don't mind fixing the issue if you give me the go on how you want it fixed.
@aaliddell what do you think?
So I had a dig through the protobuf and grpc code to see where this was coming from when I was reviewing your PR. This is the draft message I was part way through writing and haven't had time recently to come back to sorry:
I've been looking through the Python compiler protoc plugins for protobuf and grpc and this seems like a bug in the grpc plugin, since it makes no attempt to replace the dots to make an importable path here:
The protobuf plugin does however patch dots into slashes:
And the grpc plugin is aware that the protouf plugin does this:
So if anything, the lack of support for dotted paths here is a symptom of a problem elsewhere and the relevant bug is here: https://github.com/grpc/grpc/issues/23978
So regarding the PR, I'm hesitant to put in a fix that makes the plugins behave differently here than they do elsewhere, as that then becomes a divergent implementation.
On that last point: what's the non-Bazel gRPC way of solving this with Python? i.e if you are running grpcio-tools yourself, how would you be expected to fix this? The hesitancy comes having to patch the import paths and introduce some "magic" that doesn't work outside of Bazel, especially since the code is changing the way NO_PREFIX_FLAT is behaving too.
I'll try to get a patch merged upstream so that it fixes at least the path problem on gRPC
Closed by #310
Issue Description
The the path of proto files has dot (e.g., k8s.io/apimachinery/pkg/runtime/generated.proto), the Python modules generated by
python_grpc_library
cannot be importedLog Output
Notice the k8s/io vs k8s.io in the paths. The former can be imported, the latter cannot.
rules_proto_grpc Version
5.0.0-alpha3
Bazel Version
7.0.0
OS
Linux
Link to Demo Repo
No response
MODULE.bazel or WORKSPACE Content
BUILD Content
Proto Content
Any Other Content