Skip to content

Commit ab7ab74

Browse files
committed
chore: bump google-api-core to 2.28.0
1 parent 32fd479 commit ab7ab74

36 files changed

Lines changed: 44 additions & 651 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ else:
2929
release_status = "Development Status :: 5 - Production/Stable"
3030

3131
dependencies = [
32-
"google-api-core[grpc] >= 2.25.0, < 3.0.0",
32+
"google-api-core[grpc] >= 2.28.0, < 3.0.0",
3333
"google-auth >= 2.14.1, <3.0.0",
3434
"googleapis-common-protos >= 1.53.0",
3535
"grpcio >= 1.59.0, < 2.0.0",

packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/__init__.py.j2

Lines changed: 2 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@
66
from {{package_path}} import gapic_version as package_version
77

88
import google.api_core as api_core
9-
import sys
109

1110
__version__ = package_version.__version__
1211

13-
from importlib import metadata
14-
1512
# PEP 0810: Explicit Lazy Imports
1613
# Python 3.15+ natively intercepts and defers these imports.
1714
# Developers can disable this behavior and force eager imports.
@@ -63,87 +60,8 @@ from .types.{{ proto.module_name }} import {{ enum.name }}
6360
{% endfor %}
6461
{% endfor %}
6562

66-
if hasattr(api_core, "check_python_version") and hasattr(api_core, "check_dependency_versions"): # pragma: NO COVER
67-
{# TODO(api_core): remove `type:ignore` below when minimum version of api_core makes the else clause unnecessary. #}
68-
api_core.check_python_version("{{package_path}}") # type: ignore
69-
api_core.check_dependency_versions("{{package_path}}") # type: ignore
70-
else: # pragma: NO COVER
71-
{# TODO(api_core): Remove this try-catch when we require api-core at a version that
72-
supports the changes in https://github.com/googleapis/python-api-core/pull/832
73-
74-
In the meantime, please ensure the functionality here mirrors the
75-
equivalent functionality in api_core, in those two functions above.
76-
#}
77-
# An older version of api_core is installed which does not define the
78-
# functions above. We do equivalent checks manually.
79-
try:
80-
import warnings
81-
82-
_py_version_str = sys.version.split()[0]
83-
_package_label = "{{package_path}}"
84-
if sys.version_info < (3, 10):
85-
warnings.warn("You are using a non-supported Python version " +
86-
f"({_py_version_str}). Google will not post any further " +
87-
f"updates to {_package_label} supporting this Python version. " +
88-
"Please upgrade to the latest Python version, or at " +
89-
f"least to Python 3.10, and then update {_package_label}.",
90-
FutureWarning)
91-
92-
def parse_version_to_tuple(version_string: str):
93-
"""Safely converts a semantic version string to a comparable tuple of integers.
94-
Example: "6.33.5" -> (6, 33, 5)
95-
Ignores non-numeric parts and handles common version formats.
96-
Args:
97-
version_string: Version string in the format "x.y.z" or "x.y.z<suffix>"
98-
Returns:
99-
Tuple of integers for the parsed version string.
100-
"""
101-
parts = []
102-
for part in version_string.split("."):
103-
try:
104-
parts.append(int(part))
105-
except ValueError:
106-
# If it's a non-numeric part (e.g., '1.0.0b1' -> 'b1'), stop here.
107-
# This is a simplification compared to 'packaging.parse_version', but sufficient
108-
# for comparing strictly numeric semantic versions.
109-
break
110-
return tuple(parts)
111-
112-
def _get_version(dependency_name):
113-
try:
114-
version_string: str = metadata.version(dependency_name)
115-
parsed_version = parse_version_to_tuple(version_string)
116-
return (parsed_version, version_string)
117-
except Exception:
118-
# Catch exceptions from metadata.version() (e.g., PackageNotFoundError)
119-
# or errors during parse_version_to_tuple
120-
return (None, "--")
121-
122-
_dependency_package = "google.protobuf"
123-
_next_supported_version = "6.33.5"
124-
_next_supported_version_tuple = (6, 33, 5)
125-
_recommendation = " (we recommend 7.x)"
126-
(_version_used, _version_used_string) = _get_version(_dependency_package)
127-
if _version_used and _version_used < _next_supported_version_tuple:
128-
warnings.warn(f"Package {_package_label} depends on " +
129-
f"{_dependency_package}, currently installed at version " +
130-
f"{_version_used_string}. Future updates to " +
131-
f"{_package_label} will require {_dependency_package} at " +
132-
f"version {_next_supported_version} or higher{_recommendation}." +
133-
" Please ensure " +
134-
"that either (a) your Python environment doesn't pin the " +
135-
f"version of {_dependency_package}, so that updates to " +
136-
f"{_package_label} can require the higher version, or " +
137-
"(b) you manually update your Python environment to use at " +
138-
f"least version {_next_supported_version} of " +
139-
f"{_dependency_package}.",
140-
FutureWarning)
141-
except Exception:
142-
warnings.warn("Could not determine the version of Python " +
143-
"currently being used. To continue receiving " +
144-
"updates for {_package_label}, ensure you are " +
145-
"using a supported version of Python; see " +
146-
"https://devguide.python.org/versions/")
63+
api_core.check_python_version("{{package_path}}")
64+
api_core.check_dependency_versions("{{package_path}}")
14765

14866
{# Define __all__.
14967
This requires the full set of imported names, so we iterate over

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ else:
3636
release_status = "Development Status :: 5 - Production/Stable"
3737

3838
dependencies = [
39-
"google-api-core[grpc] >= 2.25.0, <3.0.0",
39+
"google-api-core[grpc] >= 2.28.0, <3.0.0",
4040
# Exclude incompatible versions of `google-auth`
4141
# See https://github.com/googleapis/google-cloud-python/issues/12364
4242
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",

packages/gapic-generator/gapic/templates/testing/constraints-3.10-async-rest.txt.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# pinning their versions to their lower bounds.
99
# For example, if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0",
1010
# then this file should have google-cloud-foo==1.14.0
11-
google-api-core==2.25.0
11+
google-api-core==2.28.0
1212
google-auth==2.35.0
1313
grpcio==1.59.0
1414
proto-plus==1.26.1

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
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.25.0
8+
google-api-core==2.28.0
99
google-auth==2.14.1
1010
grpcio==1.59.0
1111
proto-plus==1.26.1

packages/gapic-generator/tests/integration/goldens/asset/google/cloud/asset_v1/__init__.py

Lines changed: 2 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
from google.cloud.asset_v1 import gapic_version as package_version
1717

1818
import google.api_core as api_core
19-
import sys
2019

2120
__version__ = package_version.__version__
2221

23-
from importlib import metadata
24-
2522
# PEP 0810: Explicit Lazy Imports
2623
# Python 3.15+ natively intercepts and defers these imports.
2724
# Developers can disable this behavior and force eager imports.
@@ -121,80 +118,8 @@
121118
from .types.assets import TimeWindow
122119
from .types.assets import VersionedResource
123120

124-
if hasattr(api_core, "check_python_version") and hasattr(api_core, "check_dependency_versions"): # pragma: NO COVER
125-
api_core.check_python_version("google.cloud.asset_v1") # type: ignore
126-
api_core.check_dependency_versions("google.cloud.asset_v1") # type: ignore
127-
else: # pragma: NO COVER
128-
# An older version of api_core is installed which does not define the
129-
# functions above. We do equivalent checks manually.
130-
try:
131-
import warnings
132-
133-
_py_version_str = sys.version.split()[0]
134-
_package_label = "google.cloud.asset_v1"
135-
if sys.version_info < (3, 10):
136-
warnings.warn("You are using a non-supported Python version " +
137-
f"({_py_version_str}). Google will not post any further " +
138-
f"updates to {_package_label} supporting this Python version. " +
139-
"Please upgrade to the latest Python version, or at " +
140-
f"least to Python 3.10, and then update {_package_label}.",
141-
FutureWarning)
142-
143-
def parse_version_to_tuple(version_string: str):
144-
"""Safely converts a semantic version string to a comparable tuple of integers.
145-
Example: "6.33.5" -> (6, 33, 5)
146-
Ignores non-numeric parts and handles common version formats.
147-
Args:
148-
version_string: Version string in the format "x.y.z" or "x.y.z<suffix>"
149-
Returns:
150-
Tuple of integers for the parsed version string.
151-
"""
152-
parts = []
153-
for part in version_string.split("."):
154-
try:
155-
parts.append(int(part))
156-
except ValueError:
157-
# If it's a non-numeric part (e.g., '1.0.0b1' -> 'b1'), stop here.
158-
# This is a simplification compared to 'packaging.parse_version', but sufficient
159-
# for comparing strictly numeric semantic versions.
160-
break
161-
return tuple(parts)
162-
163-
def _get_version(dependency_name):
164-
try:
165-
version_string: str = metadata.version(dependency_name)
166-
parsed_version = parse_version_to_tuple(version_string)
167-
return (parsed_version, version_string)
168-
except Exception:
169-
# Catch exceptions from metadata.version() (e.g., PackageNotFoundError)
170-
# or errors during parse_version_to_tuple
171-
return (None, "--")
172-
173-
_dependency_package = "google.protobuf"
174-
_next_supported_version = "6.33.5"
175-
_next_supported_version_tuple = (6, 33, 5)
176-
_recommendation = " (we recommend 7.x)"
177-
(_version_used, _version_used_string) = _get_version(_dependency_package)
178-
if _version_used and _version_used < _next_supported_version_tuple:
179-
warnings.warn(f"Package {_package_label} depends on " +
180-
f"{_dependency_package}, currently installed at version " +
181-
f"{_version_used_string}. Future updates to " +
182-
f"{_package_label} will require {_dependency_package} at " +
183-
f"version {_next_supported_version} or higher{_recommendation}." +
184-
" Please ensure " +
185-
"that either (a) your Python environment doesn't pin the " +
186-
f"version of {_dependency_package}, so that updates to " +
187-
f"{_package_label} can require the higher version, or " +
188-
"(b) you manually update your Python environment to use at " +
189-
f"least version {_next_supported_version} of " +
190-
f"{_dependency_package}.",
191-
FutureWarning)
192-
except Exception:
193-
warnings.warn("Could not determine the version of Python " +
194-
"currently being used. To continue receiving " +
195-
"updates for {_package_label}, ensure you are " +
196-
"using a supported version of Python; see " +
197-
"https://devguide.python.org/versions/")
121+
api_core.check_python_version("google.cloud.asset_v1")
122+
api_core.check_dependency_versions("google.cloud.asset_v1")
198123

199124
__all__ = (
200125
'AssetServiceAsyncClient',

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
release_status = "Development Status :: 5 - Production/Stable"
4343

4444
dependencies = [
45-
"google-api-core[grpc] >= 2.25.0, <3.0.0",
45+
"google-api-core[grpc] >= 2.28.0, <3.0.0",
4646
# Exclude incompatible versions of `google-auth`
4747
# See https://github.com/googleapis/google-cloud-python/issues/12364
4848
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# pinning their versions to their lower bounds.
55
# For example, if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0",
66
# then this file should have google-cloud-foo==1.14.0
7-
google-api-core==2.25.0
7+
google-api-core==2.28.0
88
google-auth==2.14.1
99
grpcio==1.59.0
1010
proto-plus==1.26.1

packages/gapic-generator/tests/integration/goldens/credentials/google/iam/credentials_v1/__init__.py

Lines changed: 2 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
from google.iam.credentials_v1 import gapic_version as package_version
1717

1818
import google.api_core as api_core
19-
import sys
2019

2120
__version__ = package_version.__version__
2221

23-
from importlib import metadata
24-
2522
# PEP 0810: Explicit Lazy Imports
2623
# Python 3.15+ natively intercepts and defers these imports.
2724
# Developers can disable this behavior and force eager imports.
@@ -47,80 +44,8 @@
4744
from .types.common import SignJwtRequest
4845
from .types.common import SignJwtResponse
4946

50-
if hasattr(api_core, "check_python_version") and hasattr(api_core, "check_dependency_versions"): # pragma: NO COVER
51-
api_core.check_python_version("google.iam.credentials_v1") # type: ignore
52-
api_core.check_dependency_versions("google.iam.credentials_v1") # type: ignore
53-
else: # pragma: NO COVER
54-
# An older version of api_core is installed which does not define the
55-
# functions above. We do equivalent checks manually.
56-
try:
57-
import warnings
58-
59-
_py_version_str = sys.version.split()[0]
60-
_package_label = "google.iam.credentials_v1"
61-
if sys.version_info < (3, 10):
62-
warnings.warn("You are using a non-supported Python version " +
63-
f"({_py_version_str}). Google will not post any further " +
64-
f"updates to {_package_label} supporting this Python version. " +
65-
"Please upgrade to the latest Python version, or at " +
66-
f"least to Python 3.10, and then update {_package_label}.",
67-
FutureWarning)
68-
69-
def parse_version_to_tuple(version_string: str):
70-
"""Safely converts a semantic version string to a comparable tuple of integers.
71-
Example: "6.33.5" -> (6, 33, 5)
72-
Ignores non-numeric parts and handles common version formats.
73-
Args:
74-
version_string: Version string in the format "x.y.z" or "x.y.z<suffix>"
75-
Returns:
76-
Tuple of integers for the parsed version string.
77-
"""
78-
parts = []
79-
for part in version_string.split("."):
80-
try:
81-
parts.append(int(part))
82-
except ValueError:
83-
# If it's a non-numeric part (e.g., '1.0.0b1' -> 'b1'), stop here.
84-
# This is a simplification compared to 'packaging.parse_version', but sufficient
85-
# for comparing strictly numeric semantic versions.
86-
break
87-
return tuple(parts)
88-
89-
def _get_version(dependency_name):
90-
try:
91-
version_string: str = metadata.version(dependency_name)
92-
parsed_version = parse_version_to_tuple(version_string)
93-
return (parsed_version, version_string)
94-
except Exception:
95-
# Catch exceptions from metadata.version() (e.g., PackageNotFoundError)
96-
# or errors during parse_version_to_tuple
97-
return (None, "--")
98-
99-
_dependency_package = "google.protobuf"
100-
_next_supported_version = "6.33.5"
101-
_next_supported_version_tuple = (6, 33, 5)
102-
_recommendation = " (we recommend 7.x)"
103-
(_version_used, _version_used_string) = _get_version(_dependency_package)
104-
if _version_used and _version_used < _next_supported_version_tuple:
105-
warnings.warn(f"Package {_package_label} depends on " +
106-
f"{_dependency_package}, currently installed at version " +
107-
f"{_version_used_string}. Future updates to " +
108-
f"{_package_label} will require {_dependency_package} at " +
109-
f"version {_next_supported_version} or higher{_recommendation}." +
110-
" Please ensure " +
111-
"that either (a) your Python environment doesn't pin the " +
112-
f"version of {_dependency_package}, so that updates to " +
113-
f"{_package_label} can require the higher version, or " +
114-
"(b) you manually update your Python environment to use at " +
115-
f"least version {_next_supported_version} of " +
116-
f"{_dependency_package}.",
117-
FutureWarning)
118-
except Exception:
119-
warnings.warn("Could not determine the version of Python " +
120-
"currently being used. To continue receiving " +
121-
"updates for {_package_label}, ensure you are " +
122-
"using a supported version of Python; see " +
123-
"https://devguide.python.org/versions/")
47+
api_core.check_python_version("google.iam.credentials_v1")
48+
api_core.check_dependency_versions("google.iam.credentials_v1")
12449

12550
__all__ = (
12651
'IAMCredentialsAsyncClient',

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
release_status = "Development Status :: 5 - Production/Stable"
4343

4444
dependencies = [
45-
"google-api-core[grpc] >= 2.25.0, <3.0.0",
45+
"google-api-core[grpc] >= 2.28.0, <3.0.0",
4646
# Exclude incompatible versions of `google-auth`
4747
# See https://github.com/googleapis/google-cloud-python/issues/12364
4848
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",

0 commit comments

Comments
 (0)