Skip to content
Merged
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
4 changes: 2 additions & 2 deletions packages/google-cloud-spanner/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ Supported Python Versions
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
Python.

Python >= 3.9, including 3.14
Python >= 3.10, including 3.14

.. _active: https://devguide.python.org/devcycle/#in-development-main-branch
.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches

Unsupported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Python <= 3.8
Python <= 3.9

If you are using an `end-of-life`_
version of Python, we recommend that you update as soon as possible to an actively supported version.
Expand Down
4 changes: 2 additions & 2 deletions packages/google-cloud-spanner/docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ Supported Python Versions
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
Python.

Python >= 3.9, including 3.14
Python >= 3.10, including 3.14

.. _active: https://devguide.python.org/devcycle/#in-development-main-branch
.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches

Unsupported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Python <= 3.8
Python <= 3.9

If you are using an `end-of-life`_
version of Python, we recommend that you update as soon as possible to an actively supported version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@

__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 .services.database_admin import DatabaseAdminAsyncClient, DatabaseAdminClient
from .types.backup import (
Expand Down Expand Up @@ -106,92 +99,18 @@
api_core.check_python_version("google.cloud.spanner_admin_database_v1") # type: ignore
api_core.check_dependency_versions("google.cloud.spanner_admin_database_v1") # type: ignore
else: # pragma: NO COVER
# 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.spanner_admin_database_v1"
if sys.version_info < (3, 9):
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}.",
FutureWarning,
)

def parse_version_to_tuple(version_string: str):
"""Safely converts a semantic version string to a comparable tuple of integers.
Example: "4.25.8" -> (4, 25, 8)
Ignores non-numeric parts and handles common version formats.
Args:
version_string: Version string in the format "x.y.z" or "x.y.z<suffix>"
Returns:
Tuple of integers for the parsed version string.
"""
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.
break
return tuple(parts)

def _get_version(dependency_name):
try:
version_string: str = metadata.version(dependency_name)
parsed_version = parse_version_to_tuple(version_string)
return (parsed_version, version_string)
except Exception:
# Catch exceptions from metadata.version() (e.g., PackageNotFoundError)
# or errors during parse_version_to_tuple
return (None, "--")
import warnings

_dependency_package = "google.protobuf"
_next_supported_version = "4.25.8"
_next_supported_version_tuple = (4, 25, 8)
_recommendation = " (we recommend 6.x)"
(_version_used, _version_used_string) = _get_version(_dependency_package)
if _version_used and _version_used < _next_supported_version_tuple:
warnings.warn(
f"Package {_package_label} depends on "
+ f"{_dependency_package}, currently installed at version "
+ f"{_version_used_string}. Future updates to "
+ f"{_package_label} will require {_dependency_package} at "
+ f"version {_next_supported_version} or higher{_recommendation}."
+ " Please ensure "
+ "that either (a) your Python environment doesn't pin the "
+ f"version of {_dependency_package}, so that updates to "
+ f"{_package_label} can require the higher version, or "
+ "(b) you manually update your Python environment to use at "
+ f"least version {_next_supported_version} of "
+ f"{_dependency_package}.",
FutureWarning,
)
except Exception:
_py_version_str = sys.version.split()[0]
# version-scanner: ignore-next-line
if sys.version_info < (3, 10):
warnings.warn(
"Could not determine the version of Python "
+ "currently being used. To continue receiving "
+ "updates for {_package_label}, ensure you are "
+ "using a supported version of Python; see "
+ "https://devguide.python.org/versions/"
"You are using a non-supported Python version "
+ f"({_py_version_str}). Google will not post any further "
+ "updates to google.cloud.spanner_admin_database_v1 supporting this Python version. "
+ "Please upgrade to the latest Python version, or at "
+ "least to Python 3.10, and then update google.cloud.spanner_admin_database_v1.",
FutureWarning,
)

__all__ = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@

__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 .services.instance_admin import InstanceAdminAsyncClient, InstanceAdminClient
from .types.common import FulfillmentPeriod, OperationProgress, ReplicaSelection
Expand Down Expand Up @@ -78,92 +71,18 @@
api_core.check_python_version("google.cloud.spanner_admin_instance_v1") # type: ignore
api_core.check_dependency_versions("google.cloud.spanner_admin_instance_v1") # type: ignore
else: # pragma: NO COVER
# 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.spanner_admin_instance_v1"
if sys.version_info < (3, 9):
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}.",
FutureWarning,
)

def parse_version_to_tuple(version_string: str):
"""Safely converts a semantic version string to a comparable tuple of integers.
Example: "4.25.8" -> (4, 25, 8)
Ignores non-numeric parts and handles common version formats.
Args:
version_string: Version string in the format "x.y.z" or "x.y.z<suffix>"
Returns:
Tuple of integers for the parsed version string.
"""
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.
break
return tuple(parts)

def _get_version(dependency_name):
try:
version_string: str = metadata.version(dependency_name)
parsed_version = parse_version_to_tuple(version_string)
return (parsed_version, version_string)
except Exception:
# Catch exceptions from metadata.version() (e.g., PackageNotFoundError)
# or errors during parse_version_to_tuple
return (None, "--")
import warnings

_dependency_package = "google.protobuf"
_next_supported_version = "4.25.8"
_next_supported_version_tuple = (4, 25, 8)
_recommendation = " (we recommend 6.x)"
(_version_used, _version_used_string) = _get_version(_dependency_package)
if _version_used and _version_used < _next_supported_version_tuple:
warnings.warn(
f"Package {_package_label} depends on "
+ f"{_dependency_package}, currently installed at version "
+ f"{_version_used_string}. Future updates to "
+ f"{_package_label} will require {_dependency_package} at "
+ f"version {_next_supported_version} or higher{_recommendation}."
+ " Please ensure "
+ "that either (a) your Python environment doesn't pin the "
+ f"version of {_dependency_package}, so that updates to "
+ f"{_package_label} can require the higher version, or "
+ "(b) you manually update your Python environment to use at "
+ f"least version {_next_supported_version} of "
+ f"{_dependency_package}.",
FutureWarning,
)
except Exception:
_py_version_str = sys.version.split()[0]
# version-scanner: ignore-next-line
if sys.version_info < (3, 10):
warnings.warn(
"Could not determine the version of Python "
+ "currently being used. To continue receiving "
+ "updates for {_package_label}, ensure you are "
+ "using a supported version of Python; see "
+ "https://devguide.python.org/versions/"
"You are using a non-supported Python version "
+ f"({_py_version_str}). Google will not post any further "
+ "updates to google.cloud.spanner_admin_instance_v1 supporting this Python version. "
+ "Please upgrade to the latest Python version, or at "
+ "least to Python 3.10, and then update google.cloud.spanner_admin_instance_v1.",
FutureWarning,
)

__all__ = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
from datetime import datetime

from opentelemetry import trace
from opentelemetry.semconv.attributes.otel_attributes import (
OTEL_SCOPE_NAME,
OTEL_SCOPE_VERSION,
)

from opentelemetry.trace.status import Status, StatusCode

from google.cloud.spanner_v1._helpers import (
Expand Down Expand Up @@ -99,9 +96,9 @@ def trace_call(
"db.url": SpannerClient.DEFAULT_ENDPOINT,
"db.instance": db_name,
"net.host.name": SpannerClient.DEFAULT_ENDPOINT,
OTEL_SCOPE_NAME: TRACER_NAME,
"otel.scope.name": TRACER_NAME,
"cloud.region": cloud_region,
OTEL_SCOPE_VERSION: TRACER_VERSION,
"otel.scope.version": TRACER_VERSION,
# Standard GCP attributes for OTel, attributes are used for internal purpose and are subjected to change
"gcp.client.service": "spanner",
"gcp.client.version": TRACER_VERSION,
Expand Down
1 change: 0 additions & 1 deletion packages/google-cloud-spanner/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.12"]

ALL_PYTHON: List[str] = [
"3.9",
"3.10",
"3.11",
"3.12",
Expand Down
10 changes: 4 additions & 6 deletions packages/google-cloud-spanner/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@
release_status = "Development Status :: 5 - Production/Stable"

dependencies = [
"google-api-core[grpc] >= 1.34.0, <3.0.0,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*",
"google-cloud-core >= 1.4.4, < 3.0.0",
"google-api-core[grpc] >= 2.19.0, <3.0.0",
"google-cloud-core >= 2.0.0, < 3.0.0",
"grpc-google-iam-v1 >= 0.12.4, <1.0.0",
"proto-plus >= 1.22.0, <2.0.0",
"proto-plus >= 1.22.3, <2.0.0",
"sqlparse >= 0.4.4",
"proto-plus >= 1.22.2, <2.0.0; python_version>='3.11'",
"protobuf >= 4.25.8, < 8.0.0",
"grpc-interceptor >= 0.15.4",
# Make OpenTelemetry a core dependency
Expand Down Expand Up @@ -86,7 +85,6 @@
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand All @@ -97,7 +95,7 @@
],
platforms="Posix; MacOS X; Windows",
packages=packages,
python_requires=">=3.9",
python_requires=">=3.10",
install_requires=dependencies,
extras_require=extras,
include_package_data=True,
Expand Down
30 changes: 20 additions & 10 deletions packages/google-cloud-spanner/testing/constraints-3.10.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
# -*- coding: utf-8 -*-
# This constraints file is required for unit tests.
# List all library dependencies and extras in this file.
google-api-core
google-auth
grpcio
proto-plus
protobuf
# cryptography is a direct dependency of google-auth
cryptography
# This constraints file is used to check that lower bounds
# are correct in setup.py
# List all library dependencies and extras in this file,
# pinning their versions to their lower bounds.
# For example, if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0",
# then this file should have google-cloud-foo==1.14.0
google-api-core==2.19.0
google-cloud-core==2.0.0
grpc-google-iam-v1==0.12.4
proto-plus==1.22.3
sqlparse==0.4.4
protobuf==4.25.8
grpc-interceptor==0.15.4
opentelemetry-api==1.22.0
opentelemetry-sdk==1.22.0
opentelemetry-semantic-conventions==0.43b0
opentelemetry-resourcedetector-gcp==1.8.0a0
google-cloud-monitoring==2.16.0
mmh3==4.1.0
libcst==0.2.5
13 changes: 0 additions & 13 deletions packages/google-cloud-spanner/testing/constraints-3.9.txt

This file was deleted.

Loading
Loading