Repository: ni/nimi-python (language: python)

Issue:
Please document and/or lock version of grpcio-tools and protobuf used for codegen
### Description of issue

It is difficult to tell which version of `grpcio-tools` and `protobuf` were used for the nimi-python protobuf/gRPC codegen.

This matters because the Python `protobuf` module broke compatibility between versions 3.20 and 4.21 (hence the updated major version). This isn't a total compatibility break: 3.19-3.20 codegen works with 4.21 and 4.21 codegen works with 3.20 if you set an environment variable. See https://developers.google.com/protocol-buffers/docs/news/2022-05-06 for more info.

### System report

N/A

### Steps to reproduce issue

N/A


Discussion / hints:

Fix patch:
diff --git a/build/templates/setup.py.mako b/build/templates/setup.py.mako
index afa2b33dd..2edba2593 100644
--- a/build/templates/setup.py.mako
+++ b/build/templates/setup.py.mako
@@ -5,6 +5,7 @@
 import build.helper as helper
 
 config         = template_parameters['metadata'].config
+grpc_supported = template_parameters['include_grpc_support']
 module_version = config['module_version']
 %>
 
@@ -53,6 +54,15 @@ setup(
         'nitclk',
         % endif
     ],
+    % if grpc_supported:
+    extras_require={
+        'grpc': [
+            'grpcio>=1.49.1,<2.0,!=1.53;python_version=="3.7"',  # no 32-bit wheel for 1.53.0
+            'grpcio>=1.49.1,<2.0;python_version>"3.7"',
+            'protobuf>=4.21,<5.0'
+        ],
+    },
+    % endif
     setup_requires=['pytest-runner', ],
     tests_require=['pytest'],
     test_suite='tests',
diff --git a/generated/nidcpower/setup.py b/generated/nidcpower/setup.py
index 9415b206c..262dca656 100644
--- a/generated/nidcpower/setup.py
+++ b/generated/nidcpower/setup.py
@@ -45,6 +45,13 @@ def read_contents(file_to_read):
     install_requires=[
         'hightime>=0.2.0',
     ],
+    extras_require={
+        'grpc': [
+            'grpcio>=1.49.1,<2.0,!=1.53;python_version=="3.7"',  # no 32-bit wheel for 1.53.0
+            'grpcio>=1.49.1,<2.0;python_version>"3.7"',
+            'protobuf>=4.21,<5.0'
+        ],
+    },
     setup_requires=['pytest-runner', ],
     tests_require=['pytest'],
     test_suite='tests',
diff --git a/generated/nidigital/setup.py b/generated/nidigital/setup.py
index ac074558e..74fda7ee9 100644
--- a/generated/nidigital/setup.py
+++ b/generated/nidigital/setup.py
@@ -46,6 +46,13 @@ def read_contents(file_to_read):
         'hightime>=0.2.0',
         'nitclk',
     ],
+    extras_require={
+        'grpc': [
+            'grpcio>=1.49.1,<2.0,!=1.53;python_version=="3.7"',  # no 32-bit wheel for 1.53.0
+            'grpcio>=1.49.1,<2.0;python_version>"3.7"',
+            'protobuf>=4.21,<5.0'
+        ],
+    },
     setup_requires=['pytest-runner', ],
     tests_require=['pytest'],
     test_suite='tests',
diff --git a/generated/nidmm/setup.py b/generated/nidmm/setup.py
index 5b8d9ff85..83cfd0b24 100644
--- a/generated/nidmm/setup.py
+++ b/generated/nidmm/setup.py
@@ -45,6 +45,13 @@ def read_contents(file_to_read):
     install_requires=[
         'hightime>=0.2.0',
     ],
+    extras_require={
+        'grpc': [
+            'grpcio>=1.49.1,<2.0,!=1.53;python_version=="3.7"',  # no 32-bit wheel for 1.53.0
+            'grpcio>=1.49.1,<2.0;python_version>"3.7"',
+            'protobuf>=4.21,<5.0'
+        ],
+    },
     setup_requires=['pytest-runner', ],
     tests_require=['pytest'],
     test_suite='tests',
diff --git a/generated/nifake/setup.py b/generated/nifake/setup.py
index 3127d7ceb..0b87fb4c9 100644
--- a/generated/nifake/setup.py
+++ b/generated/nifake/setup.py
@@ -46,6 +46,13 @@ def read_contents(file_to_read):
         'hightime>=0.2.0',
         'nitclk',
     ],
+    extras_require={
+        'grpc': [
+            'grpcio>=1.49.1,<2.0,!=1.53;python_version=="3.7"',  # no 32-bit wheel for 1.53.0
+            'grpcio>=1.49.1,<2.0;python_version>"3.7"',
+            'protobuf>=4.21,<5.0'
+        ],
+    },
     setup_requires=['pytest-runner', ],
     tests_require=['pytest'],
     test_suite='tests',
diff --git a/generated/nifgen/setup.py b/generated/nifgen/setup.py
index 83727b680..6a4e6c255 100644
--- a/generated/nifgen/setup.py
+++ b/generated/nifgen/setup.py
@@ -46,6 +46,13 @@ def read_contents(file_to_read):
         'hightime>=0.2.0',
         'nitclk',
     ],
+    extras_require={
+        'grpc': [
+            'grpcio>=1.49.1,<2.0,!=1.53;python_version=="3.7"',  # no 32-bit wheel for 1.53.0
+            'grpcio>=1.49.1,<2.0;python_version>"3.7"',
+            'protobuf>=4.21,<5.0'
+        ],
+    },
     setup_requires=['pytest-runner', ],
     tests_require=['pytest'],
     test_suite='tests',
diff --git a/generated/niscope/setup.py b/generated/niscope/setup.py
index 567f36797..07e06fc62 100644
--- a/generated/niscope/setup.py
+++ b/generated/niscope/setup.py
@@ -46,6 +46,13 @@ def read_contents(file_to_read):
         'hightime>=0.2.0',
         'nitclk',
     ],
+    extras_require={
+        'grpc': [
+            'grpcio>=1.49.1,<2.0,!=1.53;python_version=="3.7"',  # no 32-bit wheel for 1.53.0
+            'grpcio>=1.49.1,<2.0;python_version>"3.7"',
+            'protobuf>=4.21,<5.0'
+        ],
+    },
     setup_requires=['pytest-runner', ],
     tests_require=['pytest'],
     test_suite='tests',
diff --git a/generated/niswitch/setup.py b/generated/niswitch/setup.py
index 22bcb014f..46cdf58f1 100644
--- a/generated/niswitch/setup.py
+++ b/generated/niswitch/setup.py
@@ -45,6 +45,13 @@ def read_contents(file_to_read):
     install_requires=[
         'hightime>=0.2.0',
     ],
+    extras_require={
+        'grpc': [
+            'grpcio>=1.49.1,<2.0,!=1.53;python_version=="3.7"',  # no 32-bit wheel for 1.53.0
+            'grpcio>=1.49.1,<2.0;python_version>"3.7"',
+            'protobuf>=4.21,<5.0'
+        ],
+    },
     setup_requires=['pytest-runner', ],
     tests_require=['pytest'],
     test_suite='tests',
diff --git a/tox-travis.ini b/tox-travis.ini
index d31e25076..ba889d8bb 100644
--- a/tox-travis.ini
+++ b/tox-travis.ini
@@ -125,7 +125,7 @@ deps =
     test: mako
     test: numpy
     test: hightime
-    test: grpcio-tools
+    test: grpcio-tools == 1.49.1
     build_test: pytest
     build_test: coverage
     build_test: mako
@@ -133,7 +133,7 @@ deps =
     build_test: pep8-naming
     codegen: mako
     codegen: packaging
-    codegen: grpcio-tools
+    codegen: grpcio-tools == 1.49.1
     installers: wheel
     installers: setuptools
     installers: packaging
diff --git a/tox.ini b/tox.ini
index cbee9219e..186453bba 100644
--- a/tox.ini
+++ b/tox.ini
@@ -125,7 +125,7 @@ deps =
     test: mako
     test: numpy
     test: hightime
-    test: grpcio-tools
+    test: grpcio-tools == 1.49.1
     build_test: pytest
     build_test: coverage
     build_test: mako
@@ -133,7 +133,7 @@ deps =
     build_test: pep8-naming
     codegen: mako
     codegen: packaging
-    codegen: grpcio-tools
+    codegen: grpcio-tools == 1.49.1
     installers: wheel
     installers: setuptools
     installers: packaging


Test patch:
diff --git a/build/templates/tox-system_tests.ini.mako b/build/templates/tox-system_tests.ini.mako
index 5778c2f0b..f367e4a78 100644
--- a/build/templates/tox-system_tests.ini.mako
+++ b/build/templates/tox-system_tests.ini.mako
@@ -81,8 +81,7 @@ deps =
     ${module_name}-system_tests: fasteners
     ${module_name}-system_tests: pytest-json
 % if grpc_supported:
-    ${module_name}-system_tests: grpcio != 1.53 # no Python 3.7 win32 wheel
-    ${module_name}-system_tests: protobuf
+    ${module_name}-system_tests: .[grpc]
 % endif
 
     ${module_name}-coverage: coverage
diff --git a/generated/nidcpower/tox-system_tests.ini b/generated/nidcpower/tox-system_tests.ini
index 0b316cc54..aac42a9c0 100644
--- a/generated/nidcpower/tox-system_tests.ini
+++ b/generated/nidcpower/tox-system_tests.ini
@@ -40,8 +40,7 @@ deps =
     nidcpower-system_tests: hightime
     nidcpower-system_tests: fasteners
     nidcpower-system_tests: pytest-json
-    nidcpower-system_tests: grpcio != 1.53 # no Python 3.7 win32 wheel
-    nidcpower-system_tests: protobuf
+    nidcpower-system_tests: .[grpc]
 
     nidcpower-coverage: coverage
     nidcpower-coverage: codecov
diff --git a/generated/nidigital/tox-system_tests.ini b/generated/nidigital/tox-system_tests.ini
index 10238dd8f..c772e7686 100644
--- a/generated/nidigital/tox-system_tests.ini
+++ b/generated/nidigital/tox-system_tests.ini
@@ -47,8 +47,7 @@ deps =
     nidigital-system_tests: hightime
     nidigital-system_tests: fasteners
     nidigital-system_tests: pytest-json
-    nidigital-system_tests: grpcio != 1.53 # no Python 3.7 win32 wheel
-    nidigital-system_tests: protobuf
+    nidigital-system_tests: .[grpc]
 
     nidigital-coverage: coverage
     nidigital-coverage: codecov
diff --git a/generated/nidmm/tox-system_tests.ini b/generated/nidmm/tox-system_tests.ini
index 2cc4b7666..2de805bb0 100644
--- a/generated/nidmm/tox-system_tests.ini
+++ b/generated/nidmm/tox-system_tests.ini
@@ -40,8 +40,7 @@ deps =
     nidmm-system_tests: hightime
     nidmm-system_tests: fasteners
     nidmm-system_tests: pytest-json
-    nidmm-system_tests: grpcio != 1.53 # no Python 3.7 win32 wheel
-    nidmm-system_tests: protobuf
+    nidmm-system_tests: .[grpc]
 
     nidmm-coverage: coverage
     nidmm-coverage: codecov
diff --git a/generated/nifake/tox-system_tests.ini b/generated/nifake/tox-system_tests.ini
index 9b824d60c..73bdcb0f1 100644
--- a/generated/nifake/tox-system_tests.ini
+++ b/generated/nifake/tox-system_tests.ini
@@ -47,8 +47,7 @@ deps =
     nifake-system_tests: hightime
     nifake-system_tests: fasteners
     nifake-system_tests: pytest-json
-    nifake-system_tests: grpcio != 1.53 # no Python 3.7 win32 wheel
-    nifake-system_tests: protobuf
+    nifake-system_tests: .[grpc]
 
     nifake-coverage: coverage
     nifake-coverage: codecov
diff --git a/generated/nifgen/tox-system_tests.ini b/generated/nifgen/tox-system_tests.ini
index a7f677854..9ffcae0d2 100644
--- a/generated/nifgen/tox-system_tests.ini
+++ b/generated/nifgen/tox-system_tests.ini
@@ -47,8 +47,7 @@ deps =
     nifgen-system_tests: hightime
     nifgen-system_tests: fasteners
     nifgen-system_tests: pytest-json
-    nifgen-system_tests: grpcio != 1.53 # no Python 3.7 win32 wheel
-    nifgen-system_tests: protobuf
+    nifgen-system_tests: .[grpc]
 
     nifgen-coverage: coverage
     nifgen-coverage: codecov
diff --git a/generated/niscope/tox-system_tests.ini b/generated/niscope/tox-system_tests.ini
index 16d9819aa..38ef22420 100644
--- a/generated/niscope/tox-system_tests.ini
+++ b/generated/niscope/tox-system_tests.ini
@@ -47,8 +47,7 @@ deps =
     niscope-system_tests: hightime
     niscope-system_tests: fasteners
     niscope-system_tests: pytest-json
-    niscope-system_tests: grpcio != 1.53 # no Python 3.7 win32 wheel
-    niscope-system_tests: protobuf
+    niscope-system_tests: .[grpc]
 
     niscope-coverage: coverage
     niscope-coverage: codecov
diff --git a/generated/niswitch/tox-system_tests.ini b/generated/niswitch/tox-system_tests.ini
index 4ca844db9..8933cc0b2 100644
--- a/generated/niswitch/tox-system_tests.ini
+++ b/generated/niswitch/tox-system_tests.ini
@@ -40,8 +40,7 @@ deps =
     niswitch-system_tests: hightime
     niswitch-system_tests: fasteners
     niswitch-system_tests: pytest-json
-    niswitch-system_tests: grpcio != 1.53 # no Python 3.7 win32 wheel
-    niswitch-system_tests: protobuf
+    niswitch-system_tests: .[grpc]
 
     niswitch-coverage: coverage
     niswitch-coverage: codecov