From f1f720c498f8b2f36b176ddfd3594804bbe2a286 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 30 Jan 2024 12:30:04 +0000 Subject: [PATCH 1/4] fix: fix broken import for AsyncRetry --- tests/unit/retry/test_retry_imports.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/unit/retry/test_retry_imports.py b/tests/unit/retry/test_retry_imports.py index 5d035be4..597909fc 100644 --- a/tests/unit/retry/test_retry_imports.py +++ b/tests/unit/retry/test_retry_imports.py @@ -27,3 +27,7 @@ def test_legacy_imports_retry_unary_async(): # next major version release # (https://github.com/googleapis/python-api-core/issues/576) from google.api_core import retry_async # noqa: F401 + + # See https://github.com/googleapis/python-api-core/issues/586 + # for context on why we need to test this import this explicitly. + from google.api_core.retry_async import AsyncRetry # noqa: F401 From 0a571c088dcbe2d6e288009322a392df885e0c3c Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 30 Jan 2024 12:31:34 +0000 Subject: [PATCH 2/4] fix import for AsyncRetry --- google/api_core/__init__.py | 3 --- google/api_core/retry_async/__init__.py | 34 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 google/api_core/retry_async/__init__.py diff --git a/google/api_core/__init__.py b/google/api_core/__init__.py index 89ce7510..b80ea372 100644 --- a/google/api_core/__init__.py +++ b/google/api_core/__init__.py @@ -20,6 +20,3 @@ from google.api_core import version as api_core_version __version__ = api_core_version.__version__ - -# for backwards compatibility, expose async unary retries as google.api_core.retry_async -from .retry import retry_unary_async as retry_async # noqa: F401 diff --git a/google/api_core/retry_async/__init__.py b/google/api_core/retry_async/__init__.py new file mode 100644 index 00000000..90a2d5ad --- /dev/null +++ b/google/api_core/retry_async/__init__.py @@ -0,0 +1,34 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# The following imports are for backwards compatibility with https://github.com/googleapis/python-api-core/blob/4d7d2edee2c108d43deb151e6e0fdceb56b73275/google/api_core/retry_async.py +# +# TODO: Revert these imports on the next major version release (https://github.com/googleapis/python-api-core/issues/576) +from google.api_core import datetime_helpers # noqa: F401 +from google.api_core import exceptions # noqa: F401 +from google.api_core.retry import exponential_sleep_generator # noqa: F401 +from google.api_core.retry import if_exception_type # noqa: F401 +from google.api_core.retry import if_transient_error # noqa: F401 +from google.api_core.retry.retry_unary_async import AsyncRetry +from google.api_core.retry.retry_unary_async import retry_target + +__all__ = ( + "AsyncRetry", + "datetime_helpers", + "exceptions", + "exponential_sleep_generator", + "if_exception_type", + "if_transient_error", + "retry_target", +) From 45415dfcc6c2d3409ac2bc359bdf1f9911c18213 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 30 Jan 2024 12:54:46 +0000 Subject: [PATCH 3/4] Resolve duplicate object description of google.api_core.retry.retry_unary_async.AsyncRetry --- docs/retry.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/retry.rst b/docs/retry.rst index 97a7f2ca..6e165f56 100644 --- a/docs/retry.rst +++ b/docs/retry.rst @@ -10,4 +10,5 @@ Retry in AsyncIO .. automodule:: google.api_core.retry_async :members: + :noindex: :show-inheritance: From 4f01471820b133ca75850b011526cc26e6172b38 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 30 Jan 2024 17:15:20 +0000 Subject: [PATCH 4/4] move to google/api_core/retry_async.py --- google/api_core/{retry_async/__init__.py => retry_async.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename google/api_core/{retry_async/__init__.py => retry_async.py} (100%) diff --git a/google/api_core/retry_async/__init__.py b/google/api_core/retry_async.py similarity index 100% rename from google/api_core/retry_async/__init__.py rename to google/api_core/retry_async.py