Skip to content

Commit ac594a0

Browse files
authored
feat: regenerate asset w/ dependencies using generator v1.32.0 (#17153)
Updates post processing to account for dropping support for Python 3.7, 3.8, 3.9 and impacts that has on using 3.10 for lower bounds testing. Adds `google-cloud-org-policy` to `post-processing` for insertion into `google-cloud-asset` files: * `setup.py` * `constraints-3.10.txt` `google-cloud-asset` was failing to regenerate successfully due to missing dependency on org-policy. Partially corrects #17152 🦕
1 parent 01d3127 commit ac594a0

18 files changed

Lines changed: 154 additions & 254 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright 2023 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
description: Resolves asset dependency issue by adding google-cloud-org-policy
15+
url: https://github.com/googleapis/google-cloud-python/issues/17152
16+
replacements:
17+
- paths: [
18+
packages/google-cloud-asset/setup.py
19+
]
20+
before: |
21+
dependencies = \[
22+
"google-api-core\[grpc\] >= 2.17.1, <3.0.0",
23+
# Exclude incompatible versions of `google-auth`
24+
# See https://github.com/googleapis/google-cloud-python/issues/12364
25+
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",
26+
"grpcio >= 1.44.0, < 2.0.0",
27+
after: |
28+
dependencies = [
29+
"google-api-core[grpc] >= 2.17.1, <3.0.0",
30+
# Exclude incompatible versions of `google-auth`
31+
# See https://github.com/googleapis/google-cloud-python/issues/12364
32+
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",
33+
"google-cloud-org-policy >= 1.11.1, <2.0.0",
34+
"grpcio >= 1.44.0, < 2.0.0",
35+
36+
count: 1
37+
- paths: [
38+
packages/google-cloud-asset/testing/constraints-3.10.txt
39+
]
40+
before: |
41+
google-api-core==2.17.1
42+
google-auth==2.14.1
43+
after: |
44+
google-api-core==2.17.1
45+
google-cloud-org-policy==1.11.1
46+
google-auth==2.14.1
47+
count: 1

librarian.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,6 @@ libraries:
391391
- path: google/cloud/asset/v1p5beta1
392392
- path: google/cloud/asset/v1p2beta1
393393
- path: google/cloud/asset/v1p1beta1
394-
skip_generate: true
395394
python:
396395
opt_args_by_api:
397396
google/cloud/asset/v1:

packages/google-cloud-asset/docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2025 Google LLC
2+
# Copyright 2026 Google LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -83,7 +83,7 @@
8383

8484
# General information about the project.
8585
project = "google-cloud-asset"
86-
copyright = "2025, Google, LLC"
86+
copyright = "2026, Google, LLC"
8787
author = "Google APIs"
8888

8989
# The version info for the project you're documenting, acts as replacement for

packages/google-cloud-asset/google/cloud/asset_v1/__init__.py

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2025 Google LLC
2+
# Copyright 2026 Google LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -21,13 +21,7 @@
2121

2222
__version__ = package_version.__version__
2323

24-
if sys.version_info >= (3, 8): # pragma: NO COVER
25-
from importlib import metadata
26-
else: # pragma: NO COVER
27-
# TODO(https://github.com/googleapis/python-api-core/issues/835): Remove
28-
# this code path once we drop support for Python 3.7
29-
import importlib_metadata as metadata
30-
24+
from importlib import metadata
3125

3226
from .services.asset_service import AssetServiceAsyncClient, AssetServiceClient
3327
from .types.asset_enrichment_resourceowners import ResourceOwners
@@ -125,28 +119,17 @@
125119
# An older version of api_core is installed which does not define the
126120
# functions above. We do equivalent checks manually.
127121
try:
128-
import sys
129122
import warnings
130123

131124
_py_version_str = sys.version.split()[0]
132125
_package_label = "google.cloud.asset_v1"
133-
if sys.version_info < (3, 9):
126+
if sys.version_info < (3, 10):
134127
warnings.warn(
135128
"You are using a non-supported Python version "
136129
+ f"({_py_version_str}). Google will not post any further "
137130
+ f"updates to {_package_label} supporting this Python version. "
138131
+ "Please upgrade to the latest Python version, or at "
139-
+ f"least to Python 3.9, and then update {_package_label}.",
140-
FutureWarning,
141-
)
142-
if sys.version_info[:2] == (3, 9):
143-
warnings.warn(
144-
f"You are using a Python version ({_py_version_str}) "
145-
+ f"which Google will stop supporting in {_package_label} in "
146-
+ "January 2026. Please "
147-
+ "upgrade to the latest Python version, or at "
148-
+ "least to Python 3.10, before then, and "
149-
+ f"then update {_package_label}.",
132+
+ f"least to Python 3.10, and then update {_package_label}.",
150133
FutureWarning,
151134
)
152135

packages/google-cloud-asset/google/cloud/asset_v1/services/asset_service/async_client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2025 Google LLC
2+
# Copyright 2026 Google LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -358,11 +358,11 @@ async def sample_export_assets():
358358
)
359359
360360
# Make the request
361-
operation = client.export_assets(request=request)
361+
operation = await client.export_assets(request=request)
362362
363363
print("Waiting for operation to complete...")
364364
365-
response = (await operation).result()
365+
response = await operation.result()
366366
367367
# Handle the response
368368
print(response)
@@ -1849,11 +1849,11 @@ async def sample_analyze_iam_policy_longrunning():
18491849
)
18501850
18511851
# Make the request
1852-
operation = client.analyze_iam_policy_longrunning(request=request)
1852+
operation = await client.analyze_iam_policy_longrunning(request=request)
18531853
18541854
print("Waiting for operation to complete...")
18551855
1856-
response = (await operation).result()
1856+
response = await operation.result()
18571857
18581858
# Handle the response
18591859
print(response)

packages/google-cloud-asset/google/cloud/asset_v1p1beta1/__init__.py

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2025 Google LLC
2+
# Copyright 2026 Google LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -21,13 +21,7 @@
2121

2222
__version__ = package_version.__version__
2323

24-
if sys.version_info >= (3, 8): # pragma: NO COVER
25-
from importlib import metadata
26-
else: # pragma: NO COVER
27-
# TODO(https://github.com/googleapis/python-api-core/issues/835): Remove
28-
# this code path once we drop support for Python 3.7
29-
import importlib_metadata as metadata
30-
24+
from importlib import metadata
3125

3226
from .services.asset_service import AssetServiceAsyncClient, AssetServiceClient
3327
from .types.asset_service import (
@@ -47,28 +41,17 @@
4741
# An older version of api_core is installed which does not define the
4842
# functions above. We do equivalent checks manually.
4943
try:
50-
import sys
5144
import warnings
5245

5346
_py_version_str = sys.version.split()[0]
5447
_package_label = "google.cloud.asset_v1p1beta1"
55-
if sys.version_info < (3, 9):
48+
if sys.version_info < (3, 10):
5649
warnings.warn(
5750
"You are using a non-supported Python version "
5851
+ f"({_py_version_str}). Google will not post any further "
5952
+ f"updates to {_package_label} supporting this Python version. "
6053
+ "Please upgrade to the latest Python version, or at "
61-
+ f"least to Python 3.9, and then update {_package_label}.",
62-
FutureWarning,
63-
)
64-
if sys.version_info[:2] == (3, 9):
65-
warnings.warn(
66-
f"You are using a Python version ({_py_version_str}) "
67-
+ f"which Google will stop supporting in {_package_label} in "
68-
+ "January 2026. Please "
69-
+ "upgrade to the latest Python version, or at "
70-
+ "least to Python 3.10, before then, and "
71-
+ f"then update {_package_label}.",
54+
+ f"least to Python 3.10, and then update {_package_label}.",
7255
FutureWarning,
7356
)
7457

packages/google-cloud-asset/google/cloud/asset_v1p2beta1/__init__.py

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2025 Google LLC
2+
# Copyright 2026 Google LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -21,13 +21,7 @@
2121

2222
__version__ = package_version.__version__
2323

24-
if sys.version_info >= (3, 8): # pragma: NO COVER
25-
from importlib import metadata
26-
else: # pragma: NO COVER
27-
# TODO(https://github.com/googleapis/python-api-core/issues/835): Remove
28-
# this code path once we drop support for Python 3.7
29-
import importlib_metadata as metadata
30-
24+
from importlib import metadata
3125

3226
from .services.asset_service import AssetServiceAsyncClient, AssetServiceClient
3327
from .types.asset_service import (
@@ -57,28 +51,17 @@
5751
# An older version of api_core is installed which does not define the
5852
# functions above. We do equivalent checks manually.
5953
try:
60-
import sys
6154
import warnings
6255

6356
_py_version_str = sys.version.split()[0]
6457
_package_label = "google.cloud.asset_v1p2beta1"
65-
if sys.version_info < (3, 9):
58+
if sys.version_info < (3, 10):
6659
warnings.warn(
6760
"You are using a non-supported Python version "
6861
+ f"({_py_version_str}). Google will not post any further "
6962
+ f"updates to {_package_label} supporting this Python version. "
7063
+ "Please upgrade to the latest Python version, or at "
71-
+ f"least to Python 3.9, and then update {_package_label}.",
72-
FutureWarning,
73-
)
74-
if sys.version_info[:2] == (3, 9):
75-
warnings.warn(
76-
f"You are using a Python version ({_py_version_str}) "
77-
+ f"which Google will stop supporting in {_package_label} in "
78-
+ "January 2026. Please "
79-
+ "upgrade to the latest Python version, or at "
80-
+ "least to Python 3.10, before then, and "
81-
+ f"then update {_package_label}.",
64+
+ f"least to Python 3.10, and then update {_package_label}.",
8265
FutureWarning,
8366
)
8467

packages/google-cloud-asset/google/cloud/asset_v1p5beta1/__init__.py

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2025 Google LLC
2+
# Copyright 2026 Google LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -21,13 +21,7 @@
2121

2222
__version__ = package_version.__version__
2323

24-
if sys.version_info >= (3, 8): # pragma: NO COVER
25-
from importlib import metadata
26-
else: # pragma: NO COVER
27-
# TODO(https://github.com/googleapis/python-api-core/issues/835): Remove
28-
# this code path once we drop support for Python 3.7
29-
import importlib_metadata as metadata
30-
24+
from importlib import metadata
3125

3226
from .services.asset_service import AssetServiceAsyncClient, AssetServiceClient
3327
from .types.asset_service import ContentType, ListAssetsRequest, ListAssetsResponse
@@ -42,28 +36,17 @@
4236
# An older version of api_core is installed which does not define the
4337
# functions above. We do equivalent checks manually.
4438
try:
45-
import sys
4639
import warnings
4740

4841
_py_version_str = sys.version.split()[0]
4942
_package_label = "google.cloud.asset_v1p5beta1"
50-
if sys.version_info < (3, 9):
43+
if sys.version_info < (3, 10):
5144
warnings.warn(
5245
"You are using a non-supported Python version "
5346
+ f"({_py_version_str}). Google will not post any further "
5447
+ f"updates to {_package_label} supporting this Python version. "
5548
+ "Please upgrade to the latest Python version, or at "
56-
+ f"least to Python 3.9, and then update {_package_label}.",
57-
FutureWarning,
58-
)
59-
if sys.version_info[:2] == (3, 9):
60-
warnings.warn(
61-
f"You are using a Python version ({_py_version_str}) "
62-
+ f"which Google will stop supporting in {_package_label} in "
63-
+ "January 2026. Please "
64-
+ "upgrade to the latest Python version, or at "
65-
+ "least to Python 3.10, before then, and "
66-
+ f"then update {_package_label}.",
49+
+ f"least to Python 3.10, and then update {_package_label}.",
6750
FutureWarning,
6851
)
6952

packages/google-cloud-asset/noxfile.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2025 Google LLC
2+
# Copyright 2026 Google LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -31,7 +31,6 @@
3131
LINT_PATHS.append("samples")
3232

3333
ALL_PYTHON = [
34-
"3.9",
3534
"3.10",
3635
"3.11",
3736
"3.12",
@@ -390,7 +389,6 @@ def docs(session):
390389
shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
391390
session.run(
392391
"sphinx-build",
393-
"-W", # warnings as errors
394392
"-T", # show full traceback on exception
395393
"-N", # no colors
396394
"-b",

packages/google-cloud-asset/samples/generated_samples/cloudasset_v1_generated_asset_service_analyze_iam_policy_longrunning_async.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2025 Google LLC
2+
# Copyright 2026 Google LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -51,11 +51,11 @@ async def sample_analyze_iam_policy_longrunning():
5151
)
5252

5353
# Make the request
54-
operation = client.analyze_iam_policy_longrunning(request=request)
54+
operation = await client.analyze_iam_policy_longrunning(request=request)
5555

5656
print("Waiting for operation to complete...")
5757

58-
response = (await operation).result()
58+
response = await operation.result()
5959

6060
# Handle the response
6161
print(response)

0 commit comments

Comments
 (0)