diff --git a/doc/source/hacking/grpc_protocols.rst b/doc/source/hacking/grpc_protocols.rst index b0f9b414d..ca385cce1 100644 --- a/doc/source/hacking/grpc_protocols.rst +++ b/doc/source/hacking/grpc_protocols.rst @@ -27,15 +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 + tox -e build-grpc -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. +This installs the correct version of ``grpcio-tools`` and regenerates the +protobuf and grpc code. 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 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 = { 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