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
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,22 @@ replacements:
\g<3>\g<4>
count: 1
- paths: [packages/google-cloud-spanner/setup.py]
before: '(?s)dependencies = \[.*?\]\nextras = \{\}'
before: '(?s)dependencies = \[.*?\]\nextras = \{\s*\}'
after: |
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.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-core >= 2.0.0, < 3.0.0",
"grpcio >= 1.49.1, < 2.0.0",
"grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'",
"grpc-google-iam-v1 >= 0.12.4, <1.0.0",
"proto-plus >= 1.22.0, <2.0.0",
"sqlparse >= 0.4.4",
"proto-plus >= 1.22.2, <2.0.0; python_version>='3.11'",
"proto-plus >= 1.22.3, <2.0.0",
"proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'",
"protobuf >= 4.25.8, < 8.0.0",
"grpc-interceptor >= 0.15.4",
"sqlparse >= 0.4.4",
# Make OpenTelemetry a core dependency
"opentelemetry-api >= 1.22.0",
"opentelemetry-sdk >= 1.22.0",
Expand Down Expand Up @@ -601,6 +606,40 @@ replacements:

Next Steps
count: 1

- paths: [
packages/google-cloud-spanner/README.rst
]
before: |
Supported Python Versions
\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^\^
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
Python\.

Python >= 3\.9, 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
after: |
Supported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
Python.

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.9
count: 1

# Note: noxfile.py is heavily customized so we clobber the whole file.
- paths: [
packages/google-cloud-spanner/noxfile.py
Expand All @@ -627,7 +666,6 @@ replacements:
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.12"]

ALL_PYTHON: List[str] = [
"3.9",
"3.10",
"3.11",
"3.12",
Expand Down Expand Up @@ -667,7 +705,6 @@ replacements:
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()

nox.options.sessions = [
"unit-3.9",
"unit-3.10",
"unit-3.11",
"unit-3.12",
Expand Down Expand Up @@ -816,8 +853,6 @@ replacements:
def unit(session, protobuf_implementation):
# Install all test dependencies, then install this package in-place.

if session.python in ("3.7",):
session.skip("Python 3.7 is no longer supported")
if protobuf_implementation == "cpp" and session.python in (
"3.11",
"3.12",
Expand Down Expand Up @@ -1379,4 +1414,27 @@ replacements:
)
def core_deps_from_source(session, protobuf_implementation):
"""Run all tests with core dependencies installed from source,
count: 1
- paths: [packages/google-cloud-spanner/testing/constraints-3.10.txt]
before: '(?s)protobuf==4.25.8\n(?!google-cloud-core)'
after: |
protobuf==4.25.8
google-cloud-core==2.0.0
grpc-google-iam-v1==0.12.4
sqlparse==0.4.4
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
googleapis-common-protos==1.60.0
count: 1
- paths: [packages/google-cloud-spanner/testing/constraints-3.10.txt]
before: 'grpcio==1\.44\.0\n(?!grpcio-status)'
after: |
grpcio==1.49.1
grpcio-status==1.49.1
count: 1
1 change: 0 additions & 1 deletion librarian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1909,7 +1909,6 @@ libraries:
- docs/spanner_v1/table.rst
- docs/spanner_v1/transaction.rst
- tests/unit/gapic/conftest.py
skip_generate: true
python:
library_type: GAPIC_COMBO
opt_args_by_api:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Python 3",
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"args": { "VARIANT": "3.8" },
"args": { "VARIANT": "3.10" },
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "Dockerfile"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.8 # version-scanner: ignore
# by the following command:
#
# pip-compile --generate-hashes requirements.in
Expand Down
4 changes: 2 additions & 2 deletions packages/google-cloud-spanner/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-spanner"
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
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ async def async_func(self, arg: int) -> int:
import concurrent.futures
import inspect
import queue
import sys
import threading
import time
import typing
Expand Down Expand Up @@ -269,7 +268,7 @@ def create_task(
sync_executor: ThreadPoolExecutor to use for sync operations. Ignored in async version
"""
task: CrossSync.Task[T] = asyncio.create_task(fn(*fn_args, **fn_kwargs))
if task_name and sys.version_info >= (3, 8):
if task_name:
task.set_name(task_name)
return task

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,6 +21,7 @@

__version__ = package_version.__version__

from importlib import metadata

from .services.database_admin import DatabaseAdminAsyncClient, DatabaseAdminClient
from .types.backup import (
Expand Down Expand Up @@ -99,18 +100,81 @@
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
import warnings
# An older version of api_core is installed which does not define the
# functions above. We do equivalent checks manually.
try:
import warnings

_py_version_str = sys.version.split()[0]
# version-scanner: ignore-next-line
if sys.version_info < (3, 10):
_py_version_str = sys.version.split()[0]
_package_label = "google.cloud.spanner_admin_database_v1"
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.10, and 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, "--")

_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:
warnings.warn(
"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,
"Could not determine the version of Python "
+ "currently being used. To continue receiving "
+ "updates for {_package_label}, ensure you are "
Comment thread
chalmerlowe marked this conversation as resolved.
+ "using a supported version of Python; see "
+ "https://devguide.python.org/versions/"
)

__all__ = (
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 @@ -518,11 +518,11 @@ async def sample_create_database():
)

# Make the request
operation = client.create_database(request=request)
operation = await client.create_database(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 @@ -814,11 +814,11 @@ async def sample_update_database():
)

# Make the request
operation = client.update_database(request=request)
operation = await client.update_database(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 @@ -964,11 +964,11 @@ async def sample_update_database_ddl():
)

# Make the request
operation = client.update_database_ddl(request=request)
operation = await client.update_database_ddl(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 @@ -1778,11 +1778,11 @@ async def sample_create_backup():
)

# Make the request
operation = client.create_backup(request=request)
operation = await client.create_backup(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 @@ -1944,11 +1944,11 @@ async def sample_copy_backup():
)

# Make the request
operation = client.copy_backup(request=request)
operation = await client.copy_backup(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 @@ -2602,11 +2602,11 @@ async def sample_restore_database():
)

# Make the request
operation = client.restore_database(request=request)
operation = await client.restore_database(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