Hi Jens,

The grpcio package <https://pypi.org/project/grpcio/> itself is completely 
agnostic to protobuf. It only has byte-oriented interfaces. Protobuf 
integration only happens within the generated code (e.g. 
helloworld_pb2_grpc.py 
<https://github.com/grpc/grpc/blob/86d7c8125e8210fd96c0b8b2288bc3c96d7cf390/examples/python/helloworld/helloworld_pb2_grpc.py#L20>).
 
This generated code comes from running the grpcio-tools package 
<https://pypi.org/project/grpcio-tools/>, which *does *have a dependency on 
protobuf. The compatibility range with protobuf is defined by this 
package's dependency range on protobuf and can be seen by either looking at its 
setup.py file 
<https://github.com/grpc/grpc/blob/86d7c8125e8210fd96c0b8b2288bc3c96d7cf390/tools/distrib/python/grpcio_tools/setup.py#L326>
 
or using a dependency inspection tool such as pipdeptree:

(venv) rbellevi-macbookpro:tmp.m984j04o rbellevi$ python3 -m pipdeptree
grpcio-tools==1.56.0
├── grpcio [required: >=1.56.0, installed: 1.56.0]
├── protobuf [required: >=4.21.6,<5.0dev, installed: 4.23.4]
└── setuptools [required: Any, installed: 67.8.0]

In general, you can use the heuristic that if you do pip install 
grpcio-tools and generate your code, you'll have the right version of 
protobuf already installed.

This isn't ideal since many people generate their code only once and then 
rebuild their application many times, potentially forgetting the version of 
protobuf that they originally used to generate their code. In practice, 
even these people are generally fine, only getting bitten when protobuf 
does a major version bump, which has happened once in the past 5 years.
On Sunday, July 9, 2023 at 6:37:06 PM UTC-7 Jens Troeger wrote:

> Hello,
>
> Following this question 
> <https://groups.google.com/g/protobuf/c/Nq3km8llYbc> I’m trying to find 
> the documentation that defines which versions of the grpcio 
> <https://github.com/grpc/grpc> package implement which version of the 
> Protocol Buffers language.
>
> And, in that context, how do the Google API common protos 
> <https://github.com/googleapis/api-common-protos> (and its generated 
> Python package <https://github.com/googleapis/python-api-common-protos>) 
> relate to the different Protobuf versions?
>
> Much thanks!
> Jens
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/ca9bb3d7-8459-4e9b-a0bd-c4e622bf85b9n%40googlegroups.com.

Reply via email to