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
Expand Up @@ -63,6 +63,30 @@ from .types.{{ proto.module_name }} import {{ enum.name }}
api_core.check_python_version("{{package_path}}")
api_core.check_dependency_versions("{{package_path}}")

try:
from google.api_core._python_package_support import (
warn_deprecation_for_versions_less_than,
)

_PQC_GRPC_WARNING_TEMPLATE = (
"Package {consumer_package} depends on {dependency_package}, currently installed at version {version_used_string}. "
"grpcio < 1.83.0 does not support Post-Quantum Cryptography (PQC). "
"Support for non-PQC environments is deprecated. In October 2026, "
"Google Cloud Python client libraries will raise their minimum requirements "
"(including google-api-core, grpcio, and grpcio-status) to enforce grpcio >= 1.83.0. "
"For more details on Google Cloud's post-quantum security migration, visit: "
"https://cloud.google.com/security/resources/post-quantum-cryptography"
)

warn_deprecation_for_versions_less_than(
"{{package_path}}",
"grpcio",
"1.83.0",
message_template=_PQC_GRPC_WARNING_TEMPLATE,
)
except Exception:
pass

{# Define __all__.
This requires the full set of imported names, so we iterate over
them again.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,30 @@
api_core.check_python_version("google.cloud.asset_v1")
api_core.check_dependency_versions("google.cloud.asset_v1")

try:
from google.api_core._python_package_support import (
warn_deprecation_for_versions_less_than,
)

_PQC_GRPC_WARNING_TEMPLATE = (
"Package {consumer_package} depends on {dependency_package}, currently installed at version {version_used_string}. "
"grpcio < 1.83.0 does not support Post-Quantum Cryptography (PQC). "
"Support for non-PQC environments is deprecated. In October 2026, "
"Google Cloud Python client libraries will raise their minimum requirements "
"(including google-api-core, grpcio, and grpcio-status) to enforce grpcio >= 1.83.0. "
"For more details on Google Cloud's post-quantum security migration, visit: "
"https://cloud.google.com/security/resources/post-quantum-cryptography"
)

warn_deprecation_for_versions_less_than(
"google.cloud.asset_v1",
"grpcio",
"1.83.0",
message_template=_PQC_GRPC_WARNING_TEMPLATE,
)
except Exception:
pass

__all__ = (
'AssetServiceAsyncClient',
'AnalyzeIamPolicyLongrunningMetadata',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,30 @@
api_core.check_python_version("google.iam.credentials_v1")
api_core.check_dependency_versions("google.iam.credentials_v1")

try:
from google.api_core._python_package_support import (
warn_deprecation_for_versions_less_than,
)

_PQC_GRPC_WARNING_TEMPLATE = (
"Package {consumer_package} depends on {dependency_package}, currently installed at version {version_used_string}. "
"grpcio < 1.83.0 does not support Post-Quantum Cryptography (PQC). "
"Support for non-PQC environments is deprecated. In October 2026, "
"Google Cloud Python client libraries will raise their minimum requirements "
"(including google-api-core, grpcio, and grpcio-status) to enforce grpcio >= 1.83.0. "
"For more details on Google Cloud's post-quantum security migration, visit: "
"https://cloud.google.com/security/resources/post-quantum-cryptography"
)

warn_deprecation_for_versions_less_than(
"google.iam.credentials_v1",
"grpcio",
"1.83.0",
message_template=_PQC_GRPC_WARNING_TEMPLATE,
)
except Exception:
pass

__all__ = (
'IAMCredentialsAsyncClient',
'GenerateAccessTokenRequest',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,30 @@
api_core.check_python_version("google.cloud.eventarc_v1")
api_core.check_dependency_versions("google.cloud.eventarc_v1")

try:
from google.api_core._python_package_support import (
warn_deprecation_for_versions_less_than,
)

_PQC_GRPC_WARNING_TEMPLATE = (
"Package {consumer_package} depends on {dependency_package}, currently installed at version {version_used_string}. "
"grpcio < 1.83.0 does not support Post-Quantum Cryptography (PQC). "
"Support for non-PQC environments is deprecated. In October 2026, "
"Google Cloud Python client libraries will raise their minimum requirements "
"(including google-api-core, grpcio, and grpcio-status) to enforce grpcio >= 1.83.0. "
"For more details on Google Cloud's post-quantum security migration, visit: "
"https://cloud.google.com/security/resources/post-quantum-cryptography"
)

warn_deprecation_for_versions_less_than(
"google.cloud.eventarc_v1",
"grpcio",
"1.83.0",
message_template=_PQC_GRPC_WARNING_TEMPLATE,
)
except Exception:
pass

__all__ = (
'EventarcAsyncClient',
'Channel',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,30 @@
api_core.check_python_version("google.cloud.logging_v2")
api_core.check_dependency_versions("google.cloud.logging_v2")

try:
from google.api_core._python_package_support import (
warn_deprecation_for_versions_less_than,
)

_PQC_GRPC_WARNING_TEMPLATE = (
"Package {consumer_package} depends on {dependency_package}, currently installed at version {version_used_string}. "
"grpcio < 1.83.0 does not support Post-Quantum Cryptography (PQC). "
"Support for non-PQC environments is deprecated. In October 2026, "
"Google Cloud Python client libraries will raise their minimum requirements "
"(including google-api-core, grpcio, and grpcio-status) to enforce grpcio >= 1.83.0. "
"For more details on Google Cloud's post-quantum security migration, visit: "
"https://cloud.google.com/security/resources/post-quantum-cryptography"
)

warn_deprecation_for_versions_less_than(
"google.cloud.logging_v2",
"grpcio",
"1.83.0",
message_template=_PQC_GRPC_WARNING_TEMPLATE,
)
except Exception:
pass

__all__ = (
'ConfigServiceV2AsyncClient',
'LoggingServiceV2AsyncClient',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,30 @@
api_core.check_python_version("google.cloud.logging_v2")
api_core.check_dependency_versions("google.cloud.logging_v2")

try:
from google.api_core._python_package_support import (
warn_deprecation_for_versions_less_than,
)

_PQC_GRPC_WARNING_TEMPLATE = (
"Package {consumer_package} depends on {dependency_package}, currently installed at version {version_used_string}. "
"grpcio < 1.83.0 does not support Post-Quantum Cryptography (PQC). "
"Support for non-PQC environments is deprecated. In October 2026, "
"Google Cloud Python client libraries will raise their minimum requirements "
"(including google-api-core, grpcio, and grpcio-status) to enforce grpcio >= 1.83.0. "
"For more details on Google Cloud's post-quantum security migration, visit: "
"https://cloud.google.com/security/resources/post-quantum-cryptography"
)

warn_deprecation_for_versions_less_than(
"google.cloud.logging_v2",
"grpcio",
"1.83.0",
message_template=_PQC_GRPC_WARNING_TEMPLATE,
)
except Exception:
pass

__all__ = (
'BaseConfigServiceV2AsyncClient',
'BaseMetricsServiceV2AsyncClient',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,30 @@
api_core.check_python_version("google.cloud.redis_v1")
api_core.check_dependency_versions("google.cloud.redis_v1")

try:
from google.api_core._python_package_support import (
warn_deprecation_for_versions_less_than,
)

_PQC_GRPC_WARNING_TEMPLATE = (
"Package {consumer_package} depends on {dependency_package}, currently installed at version {version_used_string}. "
"grpcio < 1.83.0 does not support Post-Quantum Cryptography (PQC). "
"Support for non-PQC environments is deprecated. In October 2026, "
"Google Cloud Python client libraries will raise their minimum requirements "
"(including google-api-core, grpcio, and grpcio-status) to enforce grpcio >= 1.83.0. "
"For more details on Google Cloud's post-quantum security migration, visit: "
"https://cloud.google.com/security/resources/post-quantum-cryptography"
)

warn_deprecation_for_versions_less_than(
"google.cloud.redis_v1",
"grpcio",
"1.83.0",
message_template=_PQC_GRPC_WARNING_TEMPLATE,
)
except Exception:
pass

__all__ = (
'CloudRedisAsyncClient',
'CloudRedisClient',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,30 @@
api_core.check_python_version("google.cloud.redis_v1")
api_core.check_dependency_versions("google.cloud.redis_v1")

try:
from google.api_core._python_package_support import (
warn_deprecation_for_versions_less_than,
)

_PQC_GRPC_WARNING_TEMPLATE = (
"Package {consumer_package} depends on {dependency_package}, currently installed at version {version_used_string}. "
"grpcio < 1.83.0 does not support Post-Quantum Cryptography (PQC). "
"Support for non-PQC environments is deprecated. In October 2026, "
"Google Cloud Python client libraries will raise their minimum requirements "
"(including google-api-core, grpcio, and grpcio-status) to enforce grpcio >= 1.83.0. "
"For more details on Google Cloud's post-quantum security migration, visit: "
"https://cloud.google.com/security/resources/post-quantum-cryptography"
)

warn_deprecation_for_versions_less_than(
"google.cloud.redis_v1",
"grpcio",
"1.83.0",
message_template=_PQC_GRPC_WARNING_TEMPLATE,
)
except Exception:
pass

__all__ = (
'CloudRedisAsyncClient',
'CloudRedisClient',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,30 @@
api_core.check_python_version("google.cloud.storagebatchoperations_v1")
api_core.check_dependency_versions("google.cloud.storagebatchoperations_v1")

try:
from google.api_core._python_package_support import (
warn_deprecation_for_versions_less_than,
)

_PQC_GRPC_WARNING_TEMPLATE = (
"Package {consumer_package} depends on {dependency_package}, currently installed at version {version_used_string}. "
"grpcio < 1.83.0 does not support Post-Quantum Cryptography (PQC). "
"Support for non-PQC environments is deprecated. In October 2026, "
"Google Cloud Python client libraries will raise their minimum requirements "
"(including google-api-core, grpcio, and grpcio-status) to enforce grpcio >= 1.83.0. "
"For more details on Google Cloud's post-quantum security migration, visit: "
"https://cloud.google.com/security/resources/post-quantum-cryptography"
)

warn_deprecation_for_versions_less_than(
"google.cloud.storagebatchoperations_v1",
"grpcio",
"1.83.0",
message_template=_PQC_GRPC_WARNING_TEMPLATE,
)
except Exception:
pass

__all__ = (
'StorageBatchOperationsAsyncClient',
'BucketList',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,37 @@
# about deprecated and unsupported versions.
DependencyConstraint = namedtuple(
"DependencyConstraint",
["package_name", "minimum_fully_supported_version", "recommended_version"],
[
"package_name",
"minimum_fully_supported_version",
"recommended_version",
"message_template",
],
defaults=(None, None),
)

PQC_GRPC_WARNING_TEMPLATE = (
"Package {consumer_package} depends on {dependency_package}, currently installed at version {version_used_string}. "
"grpcio < 1.83.0 does not support Post-Quantum Cryptography (PQC). "
"Support for non-PQC environments is deprecated. In October 2026, "
"Google Cloud Python packages will raise their minimum requirements "
"(including google-api-core, grpcio, and grpcio-status) to enforce grpcio >= 1.83.0. "
"For more details on Google Cloud's post-quantum security migration, visit: "
"https://cloud.google.com/security/resources/post-quantum-cryptography"
)

_PACKAGE_DEPENDENCY_WARNINGS = [
DependencyConstraint(
"google.protobuf",
minimum_fully_supported_version="6.33.5",
recommended_version="6.x",
)
),
DependencyConstraint(
"grpcio",
minimum_fully_supported_version="1.83.0",
recommended_version="1.83.x",
message_template=PQC_GRPC_WARNING_TEMPLATE,
),
]


Expand All @@ -50,8 +73,8 @@
def parse_version_to_tuple(version_string: str) -> ParsedVersion:
"""Safely converts a semantic version string to a comparable tuple of integers.

Example: "6.33.5" -> (6, 33, 5)
Ignores non-numeric parts and handles common version formats.
Example: "6.33.5" -> (6, 33, 5), "1.83.1rc1" -> (1, 83, 1)
Parses leading digits of each component to correctly handle pre-releases.

Args:
version_string: Version string in the format "x.y.z" or "x.y.z<suffix>"
Expand All @@ -61,12 +84,14 @@ def parse_version_to_tuple(version_string: str) -> ParsedVersion:
"""
parts = []
for part in version_string.split("."):
try:
parts.append(int(part))
except ValueError:
# If it's a non-numeric part (e.g., '1.0.0b1' -> 'b1'), stop here.
# This is a simplification compared to 'packaging.parse_version', but sufficient
# for comparing strictly numeric semantic versions.
digits = ""
for c in part:
if not c.isdigit():
break
digits += c
if digits:
parts.append(int(digits))
else:
break
return tuple(parts)

Expand Down Expand Up @@ -162,7 +187,7 @@ def warn_deprecation_for_versions_less_than(
) = _get_distribution_and_import_packages(consumer_import_package)

recommendation = (
" (we recommend {recommended_version})" if recommended_version else ""
f" (we recommend {recommended_version})" if recommended_version else ""
)
message_template = message_template or _flatten_message(
"""
Expand Down Expand Up @@ -222,4 +247,5 @@ def check_dependency_versions(
package_info.package_name,
package_info.minimum_fully_supported_version,
recommended_version=package_info.recommended_version,
message_template=package_info.message_template,
)
Loading