[email protected] On Tue, Aug 22, 2017 at 6:06 AM, Amit Saha <[email protected]> wrote:
> Hey all,
>
> Consider the sample .proto file:
>
>
> ```
> syntax = "proto3";
>
> // The greeting service definition.
> service Greeter {
> // Sends a greeting
> rpc SayHello (HelloRequest) returns (HelloReply) {}
> // Sends another greeting
> rpc SayHelloAgain (HelloRequest) returns (HelloReply) {}
> }
>
> // The request message containing the user's name.
> message HelloRequest {
> string name = 1;
> }
>
> // The response message containing the greetings
> message HelloReply {
> string message = 1;
> }
> ```
>
> When I generate the client and server:
>
> ```
> $ python -m grpc_tools.protoc -I../protos --python_out=.
> --grpc_python_out=. ../protos/service.proto
> ```
>
> The filenames are service_pb2.py and service_pb2_grpc.py. Should I not
> be expecting `pb3` in the filenames consider I am declaring the syntax to
> be proto3?
>
> Relevant packages + versions:
>
> ```
> $ pip list
> grpcio (1.4.0)
> grpcio-tools (1.4.0)
> protobuf (3.4.0)
> setuptools (28.8.0)
> ```
>
This is a Protocol Buffers thing much more than it is a gRPC thing, and I
could be wrong about the reason, but my impression is that the "2" in
"_pb2.py" (and thus in "_pb2_grpc.py", because we on the gRPC side just
wanted to match what was being done on the Protocol Buffers side) denotes
the *API version of the generated Python code*, not the .proto syntax
version and also not the Protocol Buffers implementation version.
There may not be much available documentation about API version 1 of the
generated Python code (files ending in "_pb.py") because it was a long time
ago. Also because it may only have ever been Google-internal.
Generated-Python-code API Version 2 is definitely much better.
Protocol Buffers Team, please confirm/correct this account?
-Nathaniel (gRPC Python developer; not authoritatively knowledgable about
Protocol Buffers Python)
--
You received this message because you are subscribed to the Google Groups
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/CAEOYnAS6j%3DzEYtzVSN5WnLix1H0gxbZbhpOLW2K3%3D25L2eM4Ow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
smime.p7s
Description: S/MIME Cryptographic Signature
