Skip to content
Draft
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,46 @@
# 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: Mypy error in asset golden files when adding dependency for google-cloud-org-policy
url: https://github.com/googleapis/gapic-generator-python/issues/1806
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 +22 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.

medium

The replacement pattern uses hardcoded version strings (e.g., 2.17.1, 2.14.1, 1.44.0). Per the general rules, flexible regex patterns should be used instead to ensure the replacement logic remains functional when dependency versions are updated in the source files.

          "google-api-core\[grpc\] >= [\d.]+, <3.0.0",
          # Exclude incompatible versions of `google-auth`
          # See https://github.com/googleapis/google-cloud-python/issues/12364
          "google-auth >= [\d.]+, <3.0.0,!=2.24.0,!=2.25.0",
          "grpcio >= [\d.]+, < 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 +41
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 replacement pattern uses hardcoded version strings. Per the general rules, flexible regex patterns should be used instead to maintain compatibility with future version updates.

      google-api-core==[\d.]+
      google-auth==[\d.]+
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: |
google-api-core==2.17.1
google-cloud-org-policy==1.11.1
google-auth==2.14.1
count: 1
2 changes: 0 additions & 2 deletions 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 Expand Up @@ -433,7 +432,6 @@ libraries:
- google/cloud/automl_v1beta1/services/tables/__init__.py
- google/cloud/automl_v1beta1/services/tables/gcs_client.py
- google/cloud/automl_v1beta1/services/tables/tables_client.py
skip_generate: true
python:
library_type: GAPIC_COMBO
metadata_name_override: automl
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",
Comment on lines 34 to 36
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

Since the project is adding dependency markers for Python 3.13 and 3.14 in setup.py, it is recommended to add Python 3.13 to the ALL_PYTHON list to ensure it is included in the test matrix.

Suggested change
"3.10",
"3.11",
"3.12",
"3.10",
"3.11",
"3.12",
"3.13",

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
"-N", # no colors
"-b",
Comment on lines 391 to 394
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. This allows documentation builds to succeed even if there are warnings (e.g., broken links, malformed docstrings), which can lead to a degradation in documentation quality over time. It is recommended to keep this flag enabled and address any specific warnings if they occur.

Suggested change
"sphinx-build",
"-W", # warnings as errors
"-T", # show full traceback on exception
"-N", # no colors
"-b",
"sphinx-build",
"-W", # warnings as errors
"-T", # show full traceback on exception
"-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