Skip to content

Commit 521bfd0

Browse files
chore: testing constraints target minimum supported versions (#2590)
Co-authored-by: Kevin Zheng <147537668+gkevinzheng@users.noreply.github.com>
1 parent 2b3b06c commit 521bfd0

File tree

20 files changed

+103
-63
lines changed

20 files changed

+103
-63
lines changed

packages/gapic-generator/gapic/templates/setup.py.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ else:
3333
release_status = "Development Status :: 5 - Production/Stable"
3434

3535
dependencies = [
36-
"google-api-core[grpc] >= 2.11.0, <3.0.0",
36+
"google-api-core[grpc] >= 2.17.1, <3.0.0",
3737
# Exclude incompatible versions of `google-auth`
3838
# See https://github.com/googleapis/google-cloud-python/issues/12364
3939
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",
40-
"grpcio >= 1.33.2, < 2.0.0",
40+
"grpcio >= 1.44.0, < 2.0.0",
4141
"grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'",
4242
"proto-plus >= 1.22.3, <2.0.0",
4343
"proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'",
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{% set rest_async_io_enabled = api.all_library_settings[api.naming.proto_package].python_settings.experimental_features.rest_async_io_enabled %}
2+
{% if rest_async_io_enabled %}
3+
# -*- coding: utf-8 -*-
4+
{% from '_pypi_packages.j2' import pypi_packages %}
5+
# This constraints file is used to check that lower bounds
6+
# are correct in setup.py
7+
# List all library dependencies and extras in this file,
8+
# pinning their versions to their lower bounds.
9+
# For example, if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0",
10+
# then this file should have google-cloud-foo==1.14.0
11+
google-api-core==2.21.0
12+
google-auth==2.35.0
13+
grpcio==1.44.0
14+
proto-plus==1.22.3
15+
protobuf==4.25.8
16+
{% for package_tuple, package_info in pypi_packages.items() %}
17+
{# 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. #}
18+
{% if api.naming.warehouse_package_name != package_info.package_name %}
19+
{% if api.requires_package(package_tuple) %}
20+
{{ package_info.package_name }}=={{ package_info.lower_bound }}
21+
{% endif %}
22+
{% endif %}
23+
{% endfor %}
24+
{% endif %}

packages/gapic-generator/gapic/templates/testing/constraints-3.9.txt.j2

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
# pinning their versions to their lower bounds.
77
# For example, if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0",
88
# then this file should have google-cloud-foo==1.14.0
9-
google-api-core==2.21.0
10-
google-auth==2.35.0
11-
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2453)
12-
# Add the minimum supported version of grpcio to constraints files
9+
google-api-core==2.17.1
10+
google-auth==2.14.1
11+
grpcio==1.44.0
1312
proto-plus==1.22.3
1413
protobuf==4.25.8
1514
{% for package_tuple, package_info in pypi_packages.items() %}

packages/gapic-generator/noxfile.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -357,21 +357,21 @@ def showcase_library(
357357
constraints_path = str(
358358
f"{tmp_dir}/testing/constraints-{session.python}.txt"
359359
)
360-
# Install the library with a constraints file.
361-
session.install(
362-
"-e",
363-
tmp_dir + ("[async_rest]" if rest_async_io_enabled else ""),
364-
"-r",
365-
constraints_path,
366-
)
367-
# Exclude `google-auth==2.40.0` which contains a regression
368-
# https://github.com/googleapis/gapic-generator-python/issues/2385
369-
session.install(
370-
"--no-cache-dir",
371-
"--force-reinstall",
372-
"--upgrade",
373-
"google-auth[aiohttp]!=2.40.0",
374-
)
360+
extras = ""
361+
if rest_async_io_enabled:
362+
async_rest_constraints_path = str(
363+
f"{tmp_dir}/testing/constraints-{session.python}-async-rest.txt"
364+
)
365+
if os.path.exists(async_rest_constraints_path):
366+
# use async-rest constraints if available
367+
constraints_path = async_rest_constraints_path
368+
else:
369+
session.log(
370+
f"{async_rest_constraints_path} not found. Using base constraints file"
371+
)
372+
extras = "[async_rest]"
373+
374+
session.install("-e", f"{tmp_dir}{extras}", "-r", constraints_path)
375375
else:
376376
# The ads templates do not have constraints files.
377377
# See https://github.com/googleapis/gapic-generator-python/issues/1788

packages/gapic-generator/tests/integration/goldens/asset/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@
3939
release_status = "Development Status :: 5 - Production/Stable"
4040

4141
dependencies = [
42-
"google-api-core[grpc] >= 2.11.0, <3.0.0",
42+
"google-api-core[grpc] >= 2.17.1, <3.0.0",
4343
# Exclude incompatible versions of `google-auth`
4444
# See https://github.com/googleapis/google-cloud-python/issues/12364
4545
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",
46-
"grpcio >= 1.33.2, < 2.0.0",
46+
"grpcio >= 1.44.0, < 2.0.0",
4747
"grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'",
4848
"proto-plus >= 1.22.3, <2.0.0",
4949
"proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'",

packages/gapic-generator/tests/integration/goldens/asset/testing/constraints-3.9.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
# pinning their versions to their lower bounds.
66
# For example, if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0",
77
# then this file should have google-cloud-foo==1.14.0
8-
google-api-core==2.21.0
9-
google-auth==2.35.0
10-
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2453)
11-
# Add the minimum supported version of grpcio to constraints files
8+
google-api-core==2.17.1
9+
google-auth==2.14.1
10+
grpcio==1.44.0
1211
proto-plus==1.22.3
1312
protobuf==4.25.8
1413
google-cloud-access-context-manager==0.2.0

packages/gapic-generator/tests/integration/goldens/credentials/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@
3939
release_status = "Development Status :: 5 - Production/Stable"
4040

4141
dependencies = [
42-
"google-api-core[grpc] >= 2.11.0, <3.0.0",
42+
"google-api-core[grpc] >= 2.17.1, <3.0.0",
4343
# Exclude incompatible versions of `google-auth`
4444
# See https://github.com/googleapis/google-cloud-python/issues/12364
4545
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",
46-
"grpcio >= 1.33.2, < 2.0.0",
46+
"grpcio >= 1.44.0, < 2.0.0",
4747
"grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'",
4848
"proto-plus >= 1.22.3, <2.0.0",
4949
"proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'",

packages/gapic-generator/tests/integration/goldens/credentials/testing/constraints-3.9.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
# pinning their versions to their lower bounds.
66
# For example, if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0",
77
# then this file should have google-cloud-foo==1.14.0
8-
google-api-core==2.21.0
9-
google-auth==2.35.0
10-
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2453)
11-
# Add the minimum supported version of grpcio to constraints files
8+
google-api-core==2.17.1
9+
google-auth==2.14.1
10+
grpcio==1.44.0
1211
proto-plus==1.22.3
1312
protobuf==4.25.8

packages/gapic-generator/tests/integration/goldens/eventarc/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@
3939
release_status = "Development Status :: 5 - Production/Stable"
4040

4141
dependencies = [
42-
"google-api-core[grpc] >= 2.11.0, <3.0.0",
42+
"google-api-core[grpc] >= 2.17.1, <3.0.0",
4343
# Exclude incompatible versions of `google-auth`
4444
# See https://github.com/googleapis/google-cloud-python/issues/12364
4545
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",
46-
"grpcio >= 1.33.2, < 2.0.0",
46+
"grpcio >= 1.44.0, < 2.0.0",
4747
"grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'",
4848
"proto-plus >= 1.22.3, <2.0.0",
4949
"proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'",

packages/gapic-generator/tests/integration/goldens/eventarc/testing/constraints-3.9.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
# pinning their versions to their lower bounds.
66
# For example, if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0",
77
# then this file should have google-cloud-foo==1.14.0
8-
google-api-core==2.21.0
9-
google-auth==2.35.0
10-
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2453)
11-
# Add the minimum supported version of grpcio to constraints files
8+
google-api-core==2.17.1
9+
google-auth==2.14.1
10+
grpcio==1.44.0
1211
proto-plus==1.22.3
1312
protobuf==4.25.8
1413
grpc-google-iam-v1==0.14.0

0 commit comments

Comments
 (0)