Open AntoniaAdler opened 2 years ago
Released grpclib==0.4.3rc3
with updated *_pb2.py
files
shouldn't protobuf be listed in the package dependencies? For example, without the protobuf package installed it's impossible to use the Healthcheck as it imports google.protobuf
.
@upcFrost gRPC states that protobuf
is not the only way to serialise requests and replies, so in grpclib
it is optional 🤷🏻♂️ Health checks are also optional as some other features, grpclib
just wants to have some batteries to be included.
BTW, Google's grpcio
also doesn't have protobuf
as a dependency, only as an optional dependency.
Google's
grpcio
also doesn't haveprotobuf
as a dependency, only as an optional dependency
Why not make it an optional dependency as well, i.e. grpcio[protobuf]
? It will allow the flexibility of specifying which protobuf version are supported. For example, Google's grpcio-tools
specifically say that they work with protobuf [required: >=3.12.0,<4.0dev]
.
Python is currently trying to move towards proper dependency resolution, with pip 22+ and tools like poetry, so imho that'd be a nice change to do, and also a pretty small one. Something like this in setup.cfg
should do:
diff --git a/setup.cfg b/setup.cfg
index 3dffb2b..62cd44a 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -29,6 +29,10 @@ python_requires = >=3.7
install_requires=
h2<5,>=3.1.0
multidict
+
+[options.extras_require]
+protobuf =
+ protobuf<4.21.0
[options.entry_points]
console_scripts =
I think that Google's protobuf
and grpcio
projects have some problems with versioning. Two times they broke backward compatibility in protobuf
.
Right now grpcio-tools
requires protobuf<4.0dev,>=3.12.0
, so even if grpcio-tools
can work with protobuf>4
it will require a new release just to fix this.
Also right now grpcio-health-checking
requires protobuf>=3.12.0
and your project will fail to import stubs from this package if you have say protobuf==3.12.2
.
So I added protobuf
as an optional dependency with only minimum version specified.
With protobuf update from version 3.20.1 to 4.21.0, the following error is thrown
Setting the protobuf version to 3.20.1 fixes the problem.