diff --git a/gapic/templates/setup.py.j2 b/gapic/templates/setup.py.j2 index 6573b942db..b49aa68ea7 100644 --- a/gapic/templates/setup.py.j2 +++ b/gapic/templates/setup.py.j2 @@ -42,7 +42,10 @@ dependencies = [ "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", {# Explicitly exclude protobuf versions mentioned in https://cloud.google.com/support/bulletins#GCP-2022-019 #} - "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", + "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5; python_version == '3.7'", + "protobuf>=4.21.6,<7.0.0; python_version == '3.8'", + "protobuf>=5.0.0,<7.0.0; python_version == '3.9'", + "protobuf>=6.0.0,<7.0.0; python_version >= '3.10'", {% for package_tuple, package_info in pypi_packages.items() %} {# Quick check to make sure `package_info.package_name` is not the package being generated so we don't circularly include this package in its own constraints file. #} {% if api.naming.warehouse_package_name != package_info.package_name %} diff --git a/tests/integration/goldens/asset/setup.py b/tests/integration/goldens/asset/setup.py index db0a03c590..dade3a8592 100755 --- a/tests/integration/goldens/asset/setup.py +++ b/tests/integration/goldens/asset/setup.py @@ -47,7 +47,10 @@ "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", - "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", + "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5; python_version == '3.7'", + "protobuf>=4.21.6,<7.0.0; python_version == '3.8'", + "protobuf>=5.0.0,<7.0.0; python_version == '3.9'", + "protobuf>=6.0.0,<7.0.0; python_version >= '3.10'", "google-cloud-access-context-manager >= 0.1.2, <1.0.0", "google-cloud-os-config >= 1.0.0, <2.0.0", "grpc-google-iam-v1 >= 0.14.0, <1.0.0", diff --git a/tests/integration/goldens/credentials/setup.py b/tests/integration/goldens/credentials/setup.py index eaba6dcd0c..1149590b57 100755 --- a/tests/integration/goldens/credentials/setup.py +++ b/tests/integration/goldens/credentials/setup.py @@ -47,7 +47,10 @@ "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", - "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", + "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5; python_version == '3.7'", + "protobuf>=4.21.6,<7.0.0; python_version == '3.8'", + "protobuf>=5.0.0,<7.0.0; python_version == '3.9'", + "protobuf>=6.0.0,<7.0.0; python_version >= '3.10'", ] extras = { } diff --git a/tests/integration/goldens/eventarc/setup.py b/tests/integration/goldens/eventarc/setup.py index 8f8887b4d5..e0716eb8bf 100755 --- a/tests/integration/goldens/eventarc/setup.py +++ b/tests/integration/goldens/eventarc/setup.py @@ -47,7 +47,10 @@ "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", - "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", + "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5; python_version == '3.7'", + "protobuf>=4.21.6,<7.0.0; python_version == '3.8'", + "protobuf>=5.0.0,<7.0.0; python_version == '3.9'", + "protobuf>=6.0.0,<7.0.0; python_version >= '3.10'", "grpc-google-iam-v1 >= 0.14.0, <1.0.0", ] extras = { diff --git a/tests/integration/goldens/logging/setup.py b/tests/integration/goldens/logging/setup.py index cb6015c69b..b8d4a25f4c 100755 --- a/tests/integration/goldens/logging/setup.py +++ b/tests/integration/goldens/logging/setup.py @@ -47,7 +47,10 @@ "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", - "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", + "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5; python_version == '3.7'", + "protobuf>=4.21.6,<7.0.0; python_version == '3.8'", + "protobuf>=5.0.0,<7.0.0; python_version == '3.9'", + "protobuf>=6.0.0,<7.0.0; python_version >= '3.10'", ] extras = { } diff --git a/tests/integration/goldens/logging_internal/setup.py b/tests/integration/goldens/logging_internal/setup.py index cb6015c69b..b8d4a25f4c 100755 --- a/tests/integration/goldens/logging_internal/setup.py +++ b/tests/integration/goldens/logging_internal/setup.py @@ -47,7 +47,10 @@ "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", - "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", + "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5; python_version == '3.7'", + "protobuf>=4.21.6,<7.0.0; python_version == '3.8'", + "protobuf>=5.0.0,<7.0.0; python_version == '3.9'", + "protobuf>=6.0.0,<7.0.0; python_version >= '3.10'", ] extras = { } diff --git a/tests/integration/goldens/redis/setup.py b/tests/integration/goldens/redis/setup.py index 026674b2d3..0a8daf99fc 100755 --- a/tests/integration/goldens/redis/setup.py +++ b/tests/integration/goldens/redis/setup.py @@ -47,7 +47,10 @@ "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", - "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", + "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5; python_version == '3.7'", + "protobuf>=4.21.6,<7.0.0; python_version == '3.8'", + "protobuf>=5.0.0,<7.0.0; python_version == '3.9'", + "protobuf>=6.0.0,<7.0.0; python_version >= '3.10'", ] extras = { "async_rest": [ diff --git a/tests/integration/goldens/redis_selective/setup.py b/tests/integration/goldens/redis_selective/setup.py index 026674b2d3..0a8daf99fc 100755 --- a/tests/integration/goldens/redis_selective/setup.py +++ b/tests/integration/goldens/redis_selective/setup.py @@ -47,7 +47,10 @@ "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", - "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", + "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5; python_version == '3.7'", + "protobuf>=4.21.6,<7.0.0; python_version == '3.8'", + "protobuf>=5.0.0,<7.0.0; python_version == '3.9'", + "protobuf>=6.0.0,<7.0.0; python_version >= '3.10'", ] extras = { "async_rest": [