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
1 change: 0 additions & 1 deletion librarian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,6 @@ libraries:
keep:
- CHANGELOG.md
- docs/CHANGELOG.md
skip_generate: true
python:
opt_args_by_api:
google/cloud/biglake/hive/v1beta:
Expand Down
30 changes: 15 additions & 15 deletions packages/google-cloud-biglake-hive/.repo-metadata.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"api_description": "The BigLake API provides access to BigLake Metastore, a serverless, fully\nmanaged, and highly available metastore for open-source data that can be\nused for querying Apache Iceberg tables in BigQuery.",
"api_id": "biglake.googleapis.com",
"api_shortname": "biglake",
"client_documentation": "https://cloud.google.com/python/docs/reference/google-cloud-biglake-hive/latest",
"default_version": "v1beta",
"distribution_name": "google-cloud-biglake-hive",
"issue_tracker": "https://issuetracker.google.com/issues/new?component=187149&template=1019829",
"language": "python",
"library_type": "GAPIC_AUTO",
"name": "google-cloud-biglake-hive",
"name_pretty": "BigLake API",
"product_documentation": "https://cloud.google.com/bigquery/docs/iceberg-tables#create-using-biglake-metastore",
"release_level": "preview",
"repo": "googleapis/google-cloud-python"
}
"api_description": "The BigLake API provides access to BigLake Metastore, a serverless, fully\nmanaged, and highly available metastore for open-source data that can be\nused for querying Apache Iceberg tables in BigQuery.",
"api_id": "biglake.googleapis.com",
"api_shortname": "biglake",
"client_documentation": "https://cloud.google.com/python/docs/reference/google-cloud-biglake-hive/latest",
"default_version": "v1beta",
"distribution_name": "google-cloud-biglake-hive",
"issue_tracker": "https://issuetracker.google.com/issues/new?component=187149\u0026template=1019829",
"language": "python",
"library_type": "GAPIC_AUTO",
"name": "google-cloud-biglake-hive",
"name_pretty": "BigLake API",
"product_documentation": "https://cloud.google.com/bigquery/docs/iceberg-tables#create-using-biglake-metastore",
"release_level": "preview",
"repo": "googleapis/google-cloud-python"
}
4 changes: 2 additions & 2 deletions packages/google-cloud-biglake-hive/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ Supported Python Versions
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
Python.

Python >= 3.7, including 3.14
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.6
Python <= 3.8

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-biglake-hive/docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ Supported Python Versions
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
Python.

Python >= 3.7, including 3.14
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.6
Python <= 3.8

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 @@ -210,7 +210,7 @@ def transport(self) -> HiveMetastoreServiceTransport:
return self._client.transport

@property
def api_endpoint(self):
def api_endpoint(self) -> str:
"""Return the API endpoint used by the client instance.

Returns:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ class HiveMetastoreServiceClient(metaclass=HiveMetastoreServiceClientMeta):
"""

@staticmethod
def _get_default_mtls_endpoint(api_endpoint):
def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]:
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 parameter api_endpoint is missing a type hint. Since this PR adds a return type hint to this method, the parameter should also be hinted for consistency and better type checking. Based on the docstring, the type is Optional[str].

Suggested change
def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]:
def _get_default_mtls_endpoint(api_endpoint: Optional[str]) -> Optional[str]:
References
  1. PEP 484 – Type Hints (link)

"""Converts api endpoint to mTLS endpoint.

Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to
"*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively.
Args:
api_endpoint (Optional[str]): the api endpoint to convert.
Returns:
str: converted mTLS api endpoint.
Optional[str]: converted mTLS api endpoint.
"""
if not api_endpoint:
return api_endpoint
Expand All @@ -145,6 +145,10 @@ def _get_default_mtls_endpoint(api_endpoint):
)

m = mtls_endpoint_re.match(api_endpoint)
if m is None:
# Could not parse api_endpoint; return as-is.
return api_endpoint

name, mtls, sandbox, googledomain = m.groups()
if mtls or not googledomain:
return api_endpoint
Expand Down Expand Up @@ -493,7 +497,7 @@ def _get_client_cert_source(provided_cert_source, use_cert_flag):
@staticmethod
def _get_api_endpoint(
api_override, client_cert_source, universe_domain, use_mtls_endpoint
):
) -> str:
"""Return the API endpoint used by the client.

Args:
Expand Down Expand Up @@ -590,7 +594,7 @@ def _add_cred_info_for_auth_errors(
error._details.append(json.dumps(cred_info))

@property
def api_endpoint(self):
def api_endpoint(self) -> str:
"""Return the API endpoint used by the client instance.

Returns:
Expand Down Expand Up @@ -690,7 +694,7 @@ def __init__(
self._universe_domain = HiveMetastoreServiceClient._get_universe_domain(
universe_domain_opt, self._universe_domain_env
)
self._api_endpoint = None # updated below, depending on `transport`
self._api_endpoint: str = "" # updated below, depending on `transport`

# Initialize the universe domain validation.
self._is_universe_domain_valid = False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
transport inheritance structure
_______________________________

`HiveMetastoreServiceTransport` is the ABC for all transports.
- public child `HiveMetastoreServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`).
- public child `HiveMetastoreServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`).
- private child `_BaseHiveMetastoreServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`).
- public child `HiveMetastoreServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`).
``HiveMetastoreServiceTransport`` is the ABC for all transports.

- public child ``HiveMetastoreServiceGrpcTransport`` for sync gRPC transport (defined in ``grpc.py``).
- public child ``HiveMetastoreServiceGrpcAsyncIOTransport`` for async gRPC transport (defined in ``grpc_asyncio.py``).
- private child ``_BaseHiveMetastoreServiceRestTransport`` for base REST transport with inner classes ``_BaseMETHOD`` (defined in ``rest_base.py``).
- public child ``HiveMetastoreServiceRestTransport`` for sync REST transport with inner classes ``METHOD`` derived from the parent's corresponding ``_BaseMETHOD`` classes (defined in ``rest.py``).
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ def __init__(
your own client library.
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
be used for service account credentials.
api_audience (Optional[str]): The intended audience for the API calls
to the service that will be set when using certain 3rd party
authentication flows. Audience is typically a resource identifier.
If not set, the host value will be used as a default.
"""

# Save the scopes.
Expand Down Expand Up @@ -133,6 +137,8 @@ def __init__(
host += ":443"
self._host = host

self._wrapped_methods: Dict[Callable, Callable] = {}
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 package now requires Python 3.9+, you should use the built-in dict for type hinting instead of typing.Dict, as per PEP 585.

Suggested change
self._wrapped_methods: Dict[Callable, Callable] = {}
self._wrapped_methods: dict[Callable, Callable] = {}
References
  1. PEP 585 – Type Hinting Generics In Standard Collections (link)


@property
def host(self):
return self._host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request):
elif isinstance(request, google.protobuf.message.Message):
request_payload = MessageToJson(request)
else:
request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}"

request_metadata = {
key: value.decode("utf-8") if isinstance(value, bytes) else value
Expand Down Expand Up @@ -90,7 +90,7 @@ def intercept_unary_unary(self, continuation, client_call_details, request):
elif isinstance(result, google.protobuf.message.Message):
response_payload = MessageToJson(result)
else:
response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}"
grpc_response = {
"payload": response_payload,
"metadata": metadata,
Expand Down Expand Up @@ -198,6 +198,10 @@ def __init__(
your own client library.
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
be used for service account credentials.
api_audience (Optional[str]): The intended audience for the API calls
to the service that will be set when using certain 3rd party
authentication flows. Audience is typically a resource identifier.
If not set, the host value will be used as a default.

Raises:
google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request
elif isinstance(request, google.protobuf.message.Message):
request_payload = MessageToJson(request)
else:
request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}"

request_metadata = {
key: value.decode("utf-8") if isinstance(value, bytes) else value
Expand Down Expand Up @@ -96,7 +96,7 @@ async def intercept_unary_unary(self, continuation, client_call_details, request
elif isinstance(result, google.protobuf.message.Message):
response_payload = MessageToJson(result)
else:
response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}"
grpc_response = {
"payload": response_payload,
"metadata": metadata,
Expand Down Expand Up @@ -249,6 +249,10 @@ def __init__(
your own client library.
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
be used for service account credentials.
api_audience (Optional[str]): The intended audience for the API calls
to the service that will be set when using certain 3rd party
authentication flows. Audience is typically a resource identifier.
If not set, the host value will be used as a default.

Raises:
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,12 @@ def __init__(
url_scheme: the protocol scheme for the API endpoint. Normally
"https", but for testing or local servers,
"http" can be specified.
interceptor (Optional[HiveMetastoreServiceRestInterceptor]): Interceptor used
to manipulate requests, request metadata, and responses.
api_audience (Optional[str]): The intended audience for the API calls
to the service that will be set when using certain 3rd party
authentication flows. Audience is typically a resource identifier.
If not set, the host value will be used as a default.
"""
# Run the base constructor
# TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc.
Expand Down
46 changes: 12 additions & 34 deletions packages/google-cloud-biglake-hive/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
LINT_PATHS.append("samples")

ALL_PYTHON = [
"3.7",
"3.8",
"3.9",
"3.10",
"3.11",
Expand Down Expand Up @@ -95,8 +93,9 @@
@nox.session(python=ALL_PYTHON)
def mypy(session):
"""Run the type checker."""
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2579):
# use the latest version of mypy
session.install(
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2410): Use the latest version of mypy
"mypy<1.16.0",
"types-requests",
"types-protobuf",
Expand All @@ -106,6 +105,8 @@ def mypy(session):
"mypy",
"-p",
"google",
"--check-untyped-defs",
*session.posargs,
)


Expand Down Expand Up @@ -251,32 +252,16 @@ def install_unittest_dependencies(session, *constraints):
@nox.session(python=ALL_PYTHON)
@nox.parametrize(
"protobuf_implementation",
["python", "upb", "cpp"],
["python", "upb"],
)
def unit(session, protobuf_implementation):
# Install all test dependencies, then install this package in-place.

# TODO(https://github.com/googleapis/gapic-generator-python/issues/2388):
# Remove this check once support for Protobuf 3.x is dropped.
if protobuf_implementation == "cpp" and session.python in (
"3.11",
"3.12",
"3.13",
"3.14",
):
session.skip("cpp implementation is not supported in python 3.11+")

constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)
install_unittest_dependencies(session, "-c", constraints_path)

# TODO(https://github.com/googleapis/gapic-generator-python/issues/2388):
# Remove the 'cpp' implementation once support for Protobuf 3.x is dropped.
# The 'cpp' implementation requires Protobuf<4.
if protobuf_implementation == "cpp":
session.install("protobuf<4")

# Run py.test against the unit tests.
session.run(
"py.test",
Expand All @@ -297,7 +282,10 @@ def unit(session, protobuf_implementation):


def install_systemtest_dependencies(session, *constraints):
session.install("--pre", "grpcio")
if session.python >= "3.12":
session.install("--pre", "grpcio>=1.75.1")
else:
session.install("--pre", "grpcio<=1.62.2")

session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints)

Expand Down Expand Up @@ -464,7 +452,7 @@ def docfx(session):
@nox.session(python=PREVIEW_PYTHON_VERSION)
@nox.parametrize(
"protobuf_implementation",
["python", "upb", "cpp"],
["python", "upb"],
)
def prerelease_deps(session, protobuf_implementation):
"""
Expand All @@ -474,16 +462,6 @@ def prerelease_deps(session, protobuf_implementation):
`pip install --pre <package>`.
"""

# TODO(https://github.com/googleapis/gapic-generator-python/issues/2388):
# Remove this check once support for Protobuf 3.x is dropped.
if protobuf_implementation == "cpp" and session.python in (
"3.11",
"3.12",
"3.13",
"3.14",
):
session.skip("cpp implementation is not supported in python 3.11+")

# Install all dependencies
session.install("-e", ".")

Expand Down Expand Up @@ -527,7 +505,7 @@ def prerelease_deps(session, protobuf_implementation):
"google-api-core",
"google-auth",
"grpc-google-iam-v1",
"grpcio",
"grpcio>=1.75.1" if session.python >= "3.12" else "grpcio<=1.62.2",
"grpcio-status",
"protobuf",
"proto-plus",
Expand Down Expand Up @@ -622,7 +600,7 @@ def core_deps_from_source(session, protobuf_implementation):
core_dependencies_from_source = [
"googleapis-common-protos @ git+https://github.com/googleapis/google-cloud-python#egg=googleapis-common-protos&subdirectory=packages/googleapis-common-protos",
"google-api-core @ git+https://github.com/googleapis/google-cloud-python#egg=google-api-core&subdirectory=packages/google-api-core",
"google-auth @ git+https://github.com/googleapis/google-auth-library-python.git",
"google-auth @ git+https://github.com/googleapis/google-cloud-python#egg=google-auth&subdirectory=packages/google-auth",
"grpc-google-iam-v1 @ git+https://github.com/googleapis/google-cloud-python#egg=grpc-google-iam-v1&subdirectory=packages/grpc-google-iam-v1",
"proto-plus @ git+https://github.com/googleapis/google-cloud-python#egg=proto-plus&subdirectory=packages/proto-plus",
]
Expand Down
Loading
Loading