-
-
Notifications
You must be signed in to change notification settings - Fork 636
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
Python code generation for protobufs and gRPC #6974
Conversation
…ture/grpcio-plugin
…ture/grpcio-plugin
@marcinex7 : Thanks for the contribution! A few of the CI failures look relevant: you can fetch the failing targets and logs using: |
Thank you @stuhood for that hint 👍 I'm still not sure, what's causing those failures. Need to play a bit with grpcio library versions |
…ture/grpcio-plugin
…ture/grpcio-plugin
…ture/grpcio-plugin
Any thoughts, why at some tests I am getting wheel translation errors? It seems to work for most of the checks, but in 3 of them, tests are failing with the following error:
this grpcio package, is prepared on PyPi for Python 2.7 and Python 3.x (https://grpc.io/docs/quickstart/python.html), and I was playing with different versions - all have the same error like mentioned above. |
@marcinex7 : Thanks again for the contribution! I've looked into this a bit: at least one of the tests that is failing seems to be failing to build the A fair amount has changed in master recently: the I'm not sure that this will resolve the issue bootstrapping the tool for multiple platforms, but I have a suspicion that it should be a blocker for landing anyway, so worth fixing now and seeing whether it resolves the CI issue. |
@marcinex7 : Looks like you had a few flaky tests, but CI is otherwise likely to be green. Huzzah! |
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, this looks great! There are two substantial comments left from my last review: if you could resolve those, we can land this.
from pants.util.contextutil import pushd | ||
|
||
|
||
class GrpcioRun(SimpleCodegenTask): |
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 is still an issue.
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, this looks great!
The OSX shard failure is odd. Have restarted it. |
@stuhood do you have any idea, why I was playing with different grpcio versions, and merged master just today. |
@marcinex7 : Unfortunately I don't have time to look into this today, but to debug that shard, you should be able to edit
...results in the following gist, with additional output for the |
@stuhood Thanks for the tip! 👍 |
@stuhood finally I have all checks passed! 👍 Can you please, have a look once again into this PR, and merge it if it's fine? |
@@ -15,3 +16,10 @@ class GrpcioInstance(PythonToolInstance): | |||
class GrpcioPrep(PythonToolPrepBase): | |||
tool_subsystem_cls = Grpcio | |||
tool_instance_cls = GrpcioInstance | |||
|
|||
def execute(self): | |||
targets = self.get_targets(lambda target: isinstance(target, PythonGrpcioLibrary)) |
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.
Heh. I'm fine with this!
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.
Thank you so much for continuing to iterate on this PR!
Problem
I would like to have a task, to generate python code from protobufs and grpc services.
Solution
There is a new codegen task grpcio-run, to execute python's grpcio library https://grpc.io/ and generate python code from .proto files.
Example:
Respectful examples can be found in /examples/src/python/example/grpcio
to create a gRPC server execute
./pants run examples/src/python/example/grpcio/server
and when it's running, run client example:
./pants run examples/src/python/example/grpcio/client
generated code can be found as usual in pants output directory:
/.pants.d/gen/grpcio-run/current/examples.src.protobuf.org.pantsbuild.example.service.service/current/org/pantsbuild/example/service