Skip to content

Commit af1b456

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#73)
* fix(deps): Require google-api-core >=1.34.0, >=2.11.0 fix: Drop usage of pkg_resources fix: Fix timeout default values docs(samples): Snippetgen should call await on the operation coroutine before calling result PiperOrigin-RevId: 493260409 Source-Link: googleapis/googleapis@fea4387 Source-Link: googleapis/googleapis-gen@387b734 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add gapic_version.py * add gapic_version.py Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 64aac5b commit af1b456

33 files changed

Lines changed: 191 additions & 240 deletions

packages/google-cloud-run/.coveragerc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,3 @@ exclude_lines =
1010
pragma: NO COVER
1111
# Ignore debug-only repr
1212
def __repr__
13-
# Ignore pkg_resources exceptions.
14-
# This is added at the module level as a safeguard for if someone
15-
# generates the code and tries to run it without pip installing. This
16-
# makes it virtually impossible to test properly.
17-
except pkg_resources.DistributionNotFound
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
__version__ = "0.4.2" # {x-release-please-version}

packages/google-cloud-run/google/cloud/run_v2/services/executions/async_client.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
from google.api_core.client_options import ClientOptions
3535
from google.auth import credentials as ga_credentials # type: ignore
3636
from google.oauth2 import service_account # type: ignore
37-
import pkg_resources
37+
38+
from google.cloud.run_v2 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -230,7 +231,7 @@ async def get_execution(
230231
*,
231232
name: Optional[str] = None,
232233
retry: OptionalRetry = gapic_v1.method.DEFAULT,
233-
timeout: Optional[float] = None,
234+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
234235
metadata: Sequence[Tuple[str, str]] = (),
235236
) -> execution.Execution:
236237
r"""Gets information about an Execution.
@@ -338,7 +339,7 @@ async def list_executions(
338339
*,
339340
parent: Optional[str] = None,
340341
retry: OptionalRetry = gapic_v1.method.DEFAULT,
341-
timeout: Optional[float] = None,
342+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
342343
metadata: Sequence[Tuple[str, str]] = (),
343344
) -> pagers.ListExecutionsAsyncPager:
344345
r"""Lists Executions from a Job.
@@ -458,7 +459,7 @@ async def delete_execution(
458459
*,
459460
name: Optional[str] = None,
460461
retry: OptionalRetry = gapic_v1.method.DEFAULT,
461-
timeout: Optional[float] = None,
462+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
462463
metadata: Sequence[Tuple[str, str]] = (),
463464
) -> operation_async.AsyncOperation:
464465
r"""Deletes an Execution.
@@ -488,7 +489,7 @@ async def sample_delete_execution():
488489
489490
print("Waiting for operation to complete...")
490491
491-
response = await operation.result()
492+
response = (await operation).result()
492493
493494
# Handle the response
494495
print(response)
@@ -577,7 +578,7 @@ async def list_operations(
577578
request: Optional[operations_pb2.ListOperationsRequest] = None,
578579
*,
579580
retry: OptionalRetry = gapic_v1.method.DEFAULT,
580-
timeout: Optional[float] = None,
581+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
581582
metadata: Sequence[Tuple[str, str]] = (),
582583
) -> operations_pb2.ListOperationsResponse:
583584
r"""Lists operations that match the specified filter in the request.
@@ -631,7 +632,7 @@ async def get_operation(
631632
request: Optional[operations_pb2.GetOperationRequest] = None,
632633
*,
633634
retry: OptionalRetry = gapic_v1.method.DEFAULT,
634-
timeout: Optional[float] = None,
635+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
635636
metadata: Sequence[Tuple[str, str]] = (),
636637
) -> operations_pb2.Operation:
637638
r"""Gets the latest state of a long-running operation.
@@ -685,7 +686,7 @@ async def delete_operation(
685686
request: Optional[operations_pb2.DeleteOperationRequest] = None,
686687
*,
687688
retry: OptionalRetry = gapic_v1.method.DEFAULT,
688-
timeout: Optional[float] = None,
689+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
689690
metadata: Sequence[Tuple[str, str]] = (),
690691
) -> None:
691692
r"""Deletes a long-running operation.
@@ -742,14 +743,9 @@ async def __aexit__(self, exc_type, exc, tb):
742743
await self.transport.close()
743744

744745

745-
try:
746-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
747-
gapic_version=pkg_resources.get_distribution(
748-
"google-cloud-run",
749-
).version,
750-
)
751-
except pkg_resources.DistributionNotFound:
752-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
746+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
747+
gapic_version=package_version.__version__
748+
)
753749

754750

755751
__all__ = ("ExecutionsAsyncClient",)

packages/google-cloud-run/google/cloud/run_v2/services/executions/client.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
from google.auth.transport import mtls # type: ignore
3939
from google.auth.transport.grpc import SslCredentials # type: ignore
4040
from google.oauth2 import service_account # type: ignore
41-
import pkg_resources
41+
42+
from google.cloud.run_v2 import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -562,7 +563,7 @@ def get_execution(
562563
*,
563564
name: Optional[str] = None,
564565
retry: OptionalRetry = gapic_v1.method.DEFAULT,
565-
timeout: Optional[float] = None,
566+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
566567
metadata: Sequence[Tuple[str, str]] = (),
567568
) -> execution.Execution:
568569
r"""Gets information about an Execution.
@@ -670,7 +671,7 @@ def list_executions(
670671
*,
671672
parent: Optional[str] = None,
672673
retry: OptionalRetry = gapic_v1.method.DEFAULT,
673-
timeout: Optional[float] = None,
674+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
674675
metadata: Sequence[Tuple[str, str]] = (),
675676
) -> pagers.ListExecutionsPager:
676677
r"""Lists Executions from a Job.
@@ -790,7 +791,7 @@ def delete_execution(
790791
*,
791792
name: Optional[str] = None,
792793
retry: OptionalRetry = gapic_v1.method.DEFAULT,
793-
timeout: Optional[float] = None,
794+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
794795
metadata: Sequence[Tuple[str, str]] = (),
795796
) -> operation.Operation:
796797
r"""Deletes an Execution.
@@ -922,7 +923,7 @@ def list_operations(
922923
request: Optional[operations_pb2.ListOperationsRequest] = None,
923924
*,
924925
retry: OptionalRetry = gapic_v1.method.DEFAULT,
925-
timeout: Optional[float] = None,
926+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
926927
metadata: Sequence[Tuple[str, str]] = (),
927928
) -> operations_pb2.ListOperationsResponse:
928929
r"""Lists operations that match the specified filter in the request.
@@ -976,7 +977,7 @@ def get_operation(
976977
request: Optional[operations_pb2.GetOperationRequest] = None,
977978
*,
978979
retry: OptionalRetry = gapic_v1.method.DEFAULT,
979-
timeout: Optional[float] = None,
980+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
980981
metadata: Sequence[Tuple[str, str]] = (),
981982
) -> operations_pb2.Operation:
982983
r"""Gets the latest state of a long-running operation.
@@ -1030,7 +1031,7 @@ def delete_operation(
10301031
request: Optional[operations_pb2.DeleteOperationRequest] = None,
10311032
*,
10321033
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1033-
timeout: Optional[float] = None,
1034+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10341035
metadata: Sequence[Tuple[str, str]] = (),
10351036
) -> None:
10361037
r"""Deletes a long-running operation.
@@ -1081,14 +1082,9 @@ def delete_operation(
10811082
)
10821083

10831084

1084-
try:
1085-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1086-
gapic_version=pkg_resources.get_distribution(
1087-
"google-cloud-run",
1088-
).version,
1089-
)
1090-
except pkg_resources.DistributionNotFound:
1091-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
1085+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1086+
gapic_version=package_version.__version__
1087+
)
10921088

10931089

10941090
__all__ = ("ExecutionsClient",)

packages/google-cloud-run/google/cloud/run_v2/services/executions/transports/base.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,13 @@
2525
from google.cloud.location import locations_pb2 # type: ignore
2626
from google.longrunning import operations_pb2 # type: ignore
2727
from google.oauth2 import service_account # type: ignore
28-
import pkg_resources
2928

29+
from google.cloud.run_v2 import gapic_version as package_version
3030
from google.cloud.run_v2.types import execution
3131

32-
try:
33-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
34-
gapic_version=pkg_resources.get_distribution(
35-
"google-cloud-run",
36-
).version,
37-
)
38-
except pkg_resources.DistributionNotFound:
39-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
32+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
33+
gapic_version=package_version.__version__
34+
)
4035

4136

4237
class ExecutionsTransport(abc.ABC):

packages/google-cloud-run/google/cloud/run_v2/services/executions/transports/rest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient:
374374
credentials=self._credentials,
375375
scopes=self._scopes,
376376
http_options=http_options,
377+
path_prefix="v2",
377378
)
378379

379380
self._operations_client = operations_v1.AbstractOperationsClient(

0 commit comments

Comments
 (0)