Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
description: Resolves asset dependency issue by adding google-cloud-org-policy
url: https://github.com/googleapis/google-cloud-python/issues/17152
replacements:
- paths: [
packages/google-cloud-asset/setup.py
]
before: |
dependencies = \[
"google-api-core\[grpc\] >= 2.17.1, <3.0.0",
# Exclude incompatible versions of `google-auth`
# See https://github.com/googleapis/google-cloud-python/issues/12364
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",
"grpcio >= 1.44.0, < 2.0.0",
Comment on lines +20 to +26
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The before block uses hardcoded versions which makes the replacement fragile. Per the repository rules, use flexible regex patterns like [\s\S]* to match version strings instead of hardcoding specific versions. This ensures the replacement logic remains functional even when dependency versions are updated in the source files, preventing match failures.

    before: |
      dependencies = [
          "google-api-core[grpc] >= [\s\S]*, <3.0.0",
          # Exclude incompatible versions of `google-auth`
          # See https://github.com/googleapis/google-cloud-python/issues/12364
          "google-auth >= [\s\S]*, <3.0.0,!=2.24.0,!=2.25.0",
          "grpcio >= [\s\S]*, < 2.0.0",
References
  1. When defining search patterns for automated code replacements in librarian post-processing YAML files, use flexible regex patterns (such as [\s\S]*) to match version strings instead of hardcoding specific versions.

after: |
dependencies = [
"google-api-core[grpc] >= 2.17.1, <3.0.0",
# Exclude incompatible versions of `google-auth`
# See https://github.com/googleapis/google-cloud-python/issues/12364
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",
"google-cloud-org-policy >= 1.11.1, <2.0.0",
"grpcio >= 1.44.0, < 2.0.0",

count: 1
- paths: [
packages/google-cloud-asset/testing/constraints-3.10.txt
]
before: |
google-api-core==2.17.1
google-auth==2.14.1
Comment on lines +40 to +42
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The before block for constraints-3.10.txt expects pinned versions (google-api-core==2.17.1), but the source file (as seen in the diff's LEFT side) contains unpinned library names. This replacement will likely fail to match and apply if the generator still outputs unpinned names.

    before: |
      google-api-core
      google-auth

after: |
google-api-core==2.17.1
google-cloud-org-policy==1.11.1
google-auth==2.14.1
count: 1
1 change: 0 additions & 1 deletion librarian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ libraries:
- path: google/cloud/asset/v1p5beta1
- path: google/cloud/asset/v1p2beta1
- path: google/cloud/asset/v1p1beta1
skip_generate: true
python:
opt_args_by_api:
google/cloud/asset/v1:
Expand Down
4 changes: 2 additions & 2 deletions packages/google-cloud-asset/docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2025 Google LLC
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -83,7 +83,7 @@

# General information about the project.
project = "google-cloud-asset"
copyright = "2025, Google, LLC"
copyright = "2026, Google, LLC"
author = "Google APIs"

# The version info for the project you're documenting, acts as replacement for
Expand Down
25 changes: 4 additions & 21 deletions packages/google-cloud-asset/google/cloud/asset_v1/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2025 Google LLC
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -21,13 +21,7 @@

__version__ = package_version.__version__

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

from importlib import metadata

from .services.asset_service import AssetServiceAsyncClient, AssetServiceClient
from .types.asset_enrichment_resourceowners import ResourceOwners
Expand Down Expand Up @@ -125,28 +119,17 @@
# An older version of api_core is installed which does not define the
# functions above. We do equivalent checks manually.
try:
import sys
import warnings

_py_version_str = sys.version.split()[0]
_package_label = "google.cloud.asset_v1"
if sys.version_info < (3, 9):
if sys.version_info < (3, 10):
warnings.warn(
"You are using a non-supported Python version "
+ f"({_py_version_str}). Google will not post any further "
+ f"updates to {_package_label} supporting this Python version. "
+ "Please upgrade to the latest Python version, or at "
+ f"least to Python 3.9, and then update {_package_label}.",
FutureWarning,
)
if sys.version_info[:2] == (3, 9):
warnings.warn(
f"You are using a Python version ({_py_version_str}) "
+ f"which Google will stop supporting in {_package_label} in "
+ "January 2026. Please "
+ "upgrade to the latest Python version, or at "
+ "least to Python 3.10, before then, and "
+ f"then update {_package_label}.",
+ f"least to Python 3.10, and then update {_package_label}.",
FutureWarning,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2025 Google LLC
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -358,11 +358,11 @@ async def sample_export_assets():
)

# Make the request
operation = client.export_assets(request=request)
operation = await client.export_assets(request=request)

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

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down Expand Up @@ -1849,11 +1849,11 @@ async def sample_analyze_iam_policy_longrunning():
)

# Make the request
operation = client.analyze_iam_policy_longrunning(request=request)
operation = await client.analyze_iam_policy_longrunning(request=request)

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

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2025 Google LLC
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -21,13 +21,7 @@

__version__ = package_version.__version__

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

from importlib import metadata

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

_py_version_str = sys.version.split()[0]
_package_label = "google.cloud.asset_v1p1beta1"
if sys.version_info < (3, 9):
if sys.version_info < (3, 10):
warnings.warn(
"You are using a non-supported Python version "
+ f"({_py_version_str}). Google will not post any further "
+ f"updates to {_package_label} supporting this Python version. "
+ "Please upgrade to the latest Python version, or at "
+ f"least to Python 3.9, and then update {_package_label}.",
FutureWarning,
)
if sys.version_info[:2] == (3, 9):
warnings.warn(
f"You are using a Python version ({_py_version_str}) "
+ f"which Google will stop supporting in {_package_label} in "
+ "January 2026. Please "
+ "upgrade to the latest Python version, or at "
+ "least to Python 3.10, before then, and "
+ f"then update {_package_label}.",
+ f"least to Python 3.10, and then update {_package_label}.",
FutureWarning,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2025 Google LLC
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -21,13 +21,7 @@

__version__ = package_version.__version__

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

from importlib import metadata

from .services.asset_service import AssetServiceAsyncClient, AssetServiceClient
from .types.asset_service import (
Expand Down Expand Up @@ -57,28 +51,17 @@
# An older version of api_core is installed which does not define the
# functions above. We do equivalent checks manually.
try:
import sys
import warnings

_py_version_str = sys.version.split()[0]
_package_label = "google.cloud.asset_v1p2beta1"
if sys.version_info < (3, 9):
if sys.version_info < (3, 10):
warnings.warn(
"You are using a non-supported Python version "
+ f"({_py_version_str}). Google will not post any further "
+ f"updates to {_package_label} supporting this Python version. "
+ "Please upgrade to the latest Python version, or at "
+ f"least to Python 3.9, and then update {_package_label}.",
FutureWarning,
)
if sys.version_info[:2] == (3, 9):
warnings.warn(
f"You are using a Python version ({_py_version_str}) "
+ f"which Google will stop supporting in {_package_label} in "
+ "January 2026. Please "
+ "upgrade to the latest Python version, or at "
+ "least to Python 3.10, before then, and "
+ f"then update {_package_label}.",
+ f"least to Python 3.10, and then update {_package_label}.",
FutureWarning,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2025 Google LLC
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -21,13 +21,7 @@

__version__ = package_version.__version__

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

from importlib import metadata

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

_py_version_str = sys.version.split()[0]
_package_label = "google.cloud.asset_v1p5beta1"
if sys.version_info < (3, 9):
if sys.version_info < (3, 10):
warnings.warn(
"You are using a non-supported Python version "
+ f"({_py_version_str}). Google will not post any further "
+ f"updates to {_package_label} supporting this Python version. "
+ "Please upgrade to the latest Python version, or at "
+ f"least to Python 3.9, and then update {_package_label}.",
FutureWarning,
)
if sys.version_info[:2] == (3, 9):
warnings.warn(
f"You are using a Python version ({_py_version_str}) "
+ f"which Google will stop supporting in {_package_label} in "
+ "January 2026. Please "
+ "upgrade to the latest Python version, or at "
+ "least to Python 3.10, before then, and "
+ f"then update {_package_label}.",
+ f"least to Python 3.10, and then update {_package_label}.",
FutureWarning,
)

Expand Down
4 changes: 1 addition & 3 deletions packages/google-cloud-asset/noxfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2025 Google LLC
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -31,7 +31,6 @@
LINT_PATHS.append("samples")

ALL_PYTHON = [
"3.9",
"3.10",
"3.11",
"3.12",
Expand Down Expand Up @@ -390,7 +389,6 @@ def docs(session):
shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
session.run(
"sphinx-build",
"-W", # warnings as errors
"-T", # show full traceback on exception
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The -W flag (warnings as errors) has been removed from the sphinx-build command. Changes to shared configurations should be applied consistently across all relevant packages in a dedicated, universal change rather than piecemeal in individual pull requests. If this flag needs to be changed, it should be done as a repository-wide update.

References
  1. Changes to shared configurations, like mypy flags, should be applied consistently across all relevant packages in a dedicated, universal change rather than piecemeal in individual pull requests.

"-N", # no colors
"-b",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2025 Google LLC
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -51,11 +51,11 @@ async def sample_analyze_iam_policy_longrunning():
)

# Make the request
operation = client.analyze_iam_policy_longrunning(request=request)
operation = await client.analyze_iam_policy_longrunning(request=request)

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

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2025 Google LLC
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -48,11 +48,11 @@ async def sample_export_assets():
)

# Make the request
operation = client.export_assets(request=request)
operation = await client.export_assets(request=request)

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

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down
Loading
Loading