Skip to content

Commit cb777a1

Browse files
fix: for backwards compatibility, expose legacy retry imports (#577)
This exposes the legacy google imports that were previously exposed by this package, even though they are not needed now. (Note that standard imports that are no longer needed are NOT exposed; they should be imported directly.) --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent ebc2635 commit cb777a1

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

google/api_core/retry/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Copyright 2017 Google LLC
2-
32
#
43
# Licensed under the Apache License, Version 2.0 (the "License");
54
# you may not use this file except in compliance with the License.
@@ -29,6 +28,13 @@
2928
from .retry_streaming_async import AsyncStreamingRetry
3029
from .retry_streaming_async import retry_target_stream as retry_target_stream_async
3130

31+
# The following imports are for backwards compatibility with https://github.com/googleapis/python-api-core/blob/4d7d2edee2c108d43deb151e6e0fdceb56b73275/google/api_core/retry.py
32+
#
33+
# TODO: Revert these imports on the next major version release (https://github.com/googleapis/python-api-core/issues/576)
34+
from google.api_core import datetime_helpers # noqa: F401
35+
from google.api_core import exceptions # noqa: F401
36+
from google.auth import exceptions as auth_exceptions # noqa: F401
37+
3238
__all__ = (
3339
"exponential_sleep_generator",
3440
"if_exception_type",
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
def test_legacy_imports_retry_unary_sync():
17+
# TODO: Delete this test when when we revert these imports on the
18+
# next major version release
19+
# (https://github.com/googleapis/python-api-core/issues/576)
20+
from google.api_core.retry import datetime_helpers # noqa: F401
21+
from google.api_core.retry import exceptions # noqa: F401
22+
from google.api_core.retry import auth_exceptions # noqa: F401
23+
24+
25+
def test_legacy_imports_retry_unary_async():
26+
# TODO: Delete this test when when we revert these imports on the
27+
# next major version release
28+
# (https://github.com/googleapis/python-api-core/issues/576)
29+
from google.api_core import retry_async # noqa: F401

0 commit comments

Comments
 (0)