From 456a464b2581c52cad2b0b48596f5c19ad1db23f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Fri, 15 Aug 2025 23:35:54 +0200 Subject: [PATCH 1/3] requirements: Relax protobuf version constraint All generated code since 3.20.0 will be supported until at least 8.x.y. https://protobuf.dev/support/cross-version-runtime-guarantee/ https://github.com/protocolbuffers/protobuf/commit/1af7fd407c85c9c1f34b6ca8441cfb3a72d4f5ea --- requirements/requirements.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/requirements.in b/requirements/requirements.in index 5a53c918e..c710a6c63 100644 --- a/requirements/requirements.in +++ b/requirements/requirements.in @@ -4,7 +4,7 @@ Jinja2 >= 2.10 importlib_metadata >= 3.6; python_version < "3.10" packaging pluginbase -protobuf <6.0dev,>=5.29 +protobuf <9,>=5.29 psutil ruamel.yaml >= 0.16.7 ruamel.yaml.clib >= 0.1.2 From 38cb948f3bdc0b658405c51ef3af1c032a3c53ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Sat, 16 Aug 2025 14:52:01 +0200 Subject: [PATCH 2/3] Revert "Add note to update the requirements whenever the grpc code is regenerated" This reverts commit 5e9eb76017fc875461ee86f3ff6f398be3ee0b7f. --- doc/source/hacking/grpc_protocols.rst | 3 --- setup.py | 6 ------ 2 files changed, 9 deletions(-) diff --git a/doc/source/hacking/grpc_protocols.rst b/doc/source/hacking/grpc_protocols.rst index b0f9b414d..0ca4c743b 100644 --- a/doc/source/hacking/grpc_protocols.rst +++ b/doc/source/hacking/grpc_protocols.rst @@ -36,6 +36,3 @@ To actually regenerate the code:: ./setup.py build_grpc -The ``requirements/requirements.in`` file needs to be updated to match the -protobuf version requirements of the ``grpcio-tools`` version used to -generate the code. diff --git a/setup.py b/setup.py index fac86b726..1e5887fec 100755 --- a/setup.py +++ b/setup.py @@ -202,12 +202,6 @@ def run(self): with open(path, "w", encoding="utf-8") as f: f.write(code) - print( - "\n" - "NOTE: Please update requirements/requirements.in to match the protobuf\n" - "requirement in the grpcio-tools version you used." - ) - def get_cmdclass(): cmdclass = { From 491cc815606fedd3116feabf8fc7e434bb5073c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Sat, 16 Aug 2025 14:22:47 +0200 Subject: [PATCH 3/3] Add tox environment `build-grpc` We need to make sure that the right version of `grpcio-tools` is used to regenerate protobuf and grpc code to not depend on too recent versions of protobuf or grpc. Define a tox environment to make this more convenient and less error-prone. --- doc/source/hacking/grpc_protocols.rst | 11 ++++------- tox.ini | 11 +++++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/doc/source/hacking/grpc_protocols.rst b/doc/source/hacking/grpc_protocols.rst index 0ca4c743b..ca385cce1 100644 --- a/doc/source/hacking/grpc_protocols.rst +++ b/doc/source/hacking/grpc_protocols.rst @@ -27,12 +27,9 @@ git repository to avoid depending on grpcio-tools for user installations. Regenerating code ~~~~~~~~~~~~~~~~~ When ``.proto`` files are modified, the corresponding Python code needs to -be regenerated. As a prerequisite for code generation you need to install -``grpcio-tools`` using pip or some other mechanism:: +be regenerated:: - pip3 install --user grpcio-tools - -To actually regenerate the code:: - - ./setup.py build_grpc + tox -e build-grpc +This installs the correct version of ``grpcio-tools`` and regenerates the +protobuf and grpc code. diff --git a/tox.ini b/tox.ini index ae887a6ef..d73c4b5ba 100644 --- a/tox.ini +++ b/tox.ini @@ -258,3 +258,14 @@ deps = # installed by the base environment. [testenv:.package] deps = + + +# +# Regenerate protobuf and grpc code +# +[testenv:build-grpc] +skip_install = True +commands = python setup.py build_grpc +deps = + grpcio-tools==1.69.0 # Requires protobuf >= 5.29 + Cython