Skip to content
Closed
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 .librarian/state.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:8e2c32496077054105bd06c54a59d6a6694287bc053588e24debe6da6920ad91
image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:8b2565040b8f040cbdad8eb4f861a7f2156c6a87965c7baa2d942eb16a57ff19
libraries:
- id: google-cloud-bigtable
version: 2.34.0
last_generated_commit: a17b84add8318f780fcc8a027815d5fee644b9f7
last_generated_commit: 4eccddb5094aadc369f349cd468222adc5d01a91
apis:
- path: google/bigtable/v2
service_config: bigtable_v2.yaml
Expand Down
3 changes: 3 additions & 0 deletions docs/admin_client/bigtable_instance_admin.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`

BigtableInstanceAdmin
---------------------------------------

Expand Down
3 changes: 3 additions & 0 deletions docs/admin_client/bigtable_table_admin.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`

BigtableTableAdmin
------------------------------------

Expand Down
3 changes: 3 additions & 0 deletions docs/admin_client/services_.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`

Services for Google Cloud Bigtable Admin v2 API
===============================================
.. toctree::
Expand Down
3 changes: 3 additions & 0 deletions docs/admin_client/types_.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`

Types for Google Cloud Bigtable Admin v2 API
============================================

Expand Down
4 changes: 4 additions & 0 deletions google/cloud/bigtable_admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`

from google.cloud.bigtable_admin import gapic_version as package_version

__version__ = package_version.__version__
Expand Down
4 changes: 4 additions & 0 deletions google/cloud/bigtable_admin/gapic_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`

__version__ = "2.34.0" # {x-release-please-version}
4 changes: 4 additions & 0 deletions google/cloud/bigtable_admin/py.typed
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# Marker file for PEP 561.
# The google-cloud-bigtable-admin package uses inline types.

# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`

108 changes: 108 additions & 0 deletions google/cloud/bigtable_admin_v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`

from google.cloud.bigtable_admin_v2 import gapic_version as package_version

import google.api_core as api_core
import sys

__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.bigtable_instance_admin import BigtableInstanceAdminClient
from .services.bigtable_instance_admin import BigtableInstanceAdminAsyncClient
Expand Down Expand Up @@ -143,6 +157,100 @@
from .types.table import RestoreSourceType
from .types.types import Type

if hasattr(api_core, "check_python_version") and hasattr(
api_core, "check_dependency_versions"
): # pragma: NO COVER
api_core.check_python_version("google.cloud.bigtable_admin_v2") # type: ignore
api_core.check_dependency_versions("google.cloud.bigtable_admin_v2") # 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 warnings
import sys

_py_version_str = sys.version.split()[0]
_package_label = "google.cloud.bigtable_admin_v2"
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)
Comment on lines +194 to +212

Choose a reason for hiding this comment

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

high

The current implementation of parse_version_to_tuple is not robust and can lead to incorrect version comparisons. For example, a version string like "4.25.9-beta1" would be parsed as (4, 25), which is incorrectly evaluated as less than (4, 25, 8). This can be fixed by using regular expressions to extract the numeric part of each version component.

Suggested change
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 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.
"""
import re
parts = []
for part in version_string.split("."):
numeric_part = re.match(r"(\d+)", part)
if numeric_part:
parts.append(int(numeric_part.group(1)))
else:
# If part is not numeric, stop parsing.
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(
"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/"
)

__all__ = (
"BaseBigtableTableAdminAsyncClient",
"BigtableInstanceAdminAsyncClient",
Expand Down
4 changes: 4 additions & 0 deletions google/cloud/bigtable_admin_v2/gapic_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`

__version__ = "2.34.0" # {x-release-please-version}
4 changes: 4 additions & 0 deletions google/cloud/bigtable_admin_v2/py.typed
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# Marker file for PEP 561.
# The google-cloud-bigtable-admin package uses inline types.

# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`

3 changes: 3 additions & 0 deletions google/cloud/bigtable_admin_v2/services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`

from .client import BigtableInstanceAdminClient
from .async_client import BigtableInstanceAdminAsyncClient

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`

import logging as std_logging
from collections import OrderedDict
import re
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`

from collections import OrderedDict
from http import HTTPStatus
import json
Expand Down Expand Up @@ -161,6 +165,34 @@ def _get_default_mtls_endpoint(api_endpoint):
_DEFAULT_ENDPOINT_TEMPLATE = "bigtableadmin.{UNIVERSE_DOMAIN}"
_DEFAULT_UNIVERSE = "googleapis.com"

@staticmethod
def _use_client_cert_effective():
"""Returns whether client certificate should be used for mTLS if the
google-auth version supports should_use_client_cert automatic mTLS enablement.

Alternatively, read from the GOOGLE_API_USE_CLIENT_CERTIFICATE env var.

Returns:
bool: whether client certificate should be used for mTLS
Raises:
ValueError: (If using a version of google-auth without should_use_client_cert and
GOOGLE_API_USE_CLIENT_CERTIFICATE is set to an unexpected value.)
"""
# check if google-auth version supports should_use_client_cert for automatic mTLS enablement
if hasattr(mtls, "should_use_client_cert"): # pragma: NO COVER
return mtls.should_use_client_cert()
else: # pragma: NO COVER
# if unsupported, fallback to reading from env var
use_client_cert_str = os.getenv(
"GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
).lower()
if use_client_cert_str not in ("true", "false"):
raise ValueError(
"Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be"
" either `true` or `false`"
)
return use_client_cert_str == "true"

@classmethod
def from_service_account_info(cls, info: dict, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
Expand Down Expand Up @@ -503,20 +535,16 @@ def get_mtls_endpoint_and_cert_source(
)
if client_options is None:
client_options = client_options_lib.ClientOptions()
use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")
use_client_cert = BigtableInstanceAdminClient._use_client_cert_effective()
use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto")
if use_client_cert not in ("true", "false"):
raise ValueError(
"Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
)
if use_mtls_endpoint not in ("auto", "never", "always"):
raise MutualTLSChannelError(
"Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
)

# Figure out the client cert source to use.
client_cert_source = None
if use_client_cert == "true":
if use_client_cert:
if client_options.client_cert_source:
client_cert_source = client_options.client_cert_source
elif mtls.has_default_client_cert_source():
Expand Down Expand Up @@ -548,20 +576,14 @@ def _read_environment_variables():
google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT
is not any of ["auto", "never", "always"].
"""
use_client_cert = os.getenv(
"GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
).lower()
use_client_cert = BigtableInstanceAdminClient._use_client_cert_effective()
use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower()
universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN")
if use_client_cert not in ("true", "false"):
raise ValueError(
"Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
)
if use_mtls_endpoint not in ("auto", "never", "always"):
raise MutualTLSChannelError(
"Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
)
return use_client_cert == "true", use_mtls_endpoint, universe_domain_env
return use_client_cert, use_mtls_endpoint, universe_domain_env

@staticmethod
def _get_client_cert_source(provided_cert_source, use_cert_flag):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`

from google.api_core import gapic_v1
from google.api_core import retry as retries
from google.api_core import retry_async as retries_async
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`


transport inheritance structure
_______________________________
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`

from collections import OrderedDict
from typing import Dict, Type

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`

import abc
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`

import json
import logging as std_logging
import pickle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

# DO NOT EDIT THIS FILE OUTSIDE OF `.librarian/generator-input`
# The source of truth for this file is `.librarian/generator-input`

import inspect
import json
import pickle
Expand Down
Loading
Loading