google-api-core 2.28.0__tar.gz → 2.28.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {google_api_core-2.28.0/google_api_core.egg-info → google_api_core-2.28.1}/PKG-INFO +2 -1
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/_python_package_support.py +45 -20
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/version.py +1 -1
- {google_api_core-2.28.0 → google_api_core-2.28.1/google_api_core.egg-info}/PKG-INFO +2 -1
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google_api_core.egg-info/requires.txt +3 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/pyproject.toml +3 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_python_package_support.py +28 -35
- {google_api_core-2.28.0 → google_api_core-2.28.1}/LICENSE +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/MANIFEST.in +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/README.rst +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/__init__.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/_python_version_support.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/_rest_streaming_base.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/bidi.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/bidi_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/bidi_base.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/client_info.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/client_logging.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/client_options.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/datetime_helpers.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/exceptions.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/extended_operation.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/future/__init__.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/future/_helpers.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/future/async_future.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/future/base.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/future/polling.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/gapic_v1/__init__.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/gapic_v1/client_info.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/gapic_v1/config.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/gapic_v1/config_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/gapic_v1/method.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/gapic_v1/method_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/gapic_v1/routing_header.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/general_helpers.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/grpc_helpers.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/grpc_helpers_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/iam.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operation.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operation_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/__init__.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/abstract_operations_base_client.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/abstract_operations_client.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/operations_async_client.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/operations_client.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/operations_client_config.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/operations_rest_client_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/pagers.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/pagers_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/pagers_base.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/transports/__init__.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/transports/base.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/transports/rest.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/transports/rest_asyncio.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/page_iterator.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/page_iterator_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/path_template.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/protobuf_helpers.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/py.typed +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/rest_helpers.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/rest_streaming.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/rest_streaming_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/retry/__init__.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/retry/retry_base.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/retry/retry_streaming.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/retry/retry_streaming_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/retry/retry_unary.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/retry/retry_unary_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/retry_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/timeout.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/universe.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/version_header.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google_api_core.egg-info/SOURCES.txt +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google_api_core.egg-info/dependency_links.txt +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/google_api_core.egg-info/top_level.txt +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/setup.cfg +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/setup.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/__init__.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/asyncio/__init__.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/asyncio/future/__init__.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/asyncio/future/test_async_future.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/asyncio/gapic/test_config_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/asyncio/gapic/test_method_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/asyncio/operations_v1/__init__.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/asyncio/operations_v1/test_operations_async_client.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/asyncio/retry/__init__.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/asyncio/retry/test_retry_streaming_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/asyncio/retry/test_retry_unary_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/asyncio/test_bidi_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/asyncio/test_grpc_helpers_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/asyncio/test_operation_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/asyncio/test_page_iterator_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/asyncio/test_rest_streaming_async.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/helpers.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/__init__.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/future/__init__.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/future/test__helpers.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/future/test_polling.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/gapic/test_client_info.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/gapic/test_config.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/gapic/test_method.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/gapic/test_routing_header.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/operations_v1/__init__.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/operations_v1/test_operations_client.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/operations_v1/test_operations_rest_client.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/retry/__init__.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/retry/test_retry_base.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/retry/test_retry_imports.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/retry/test_retry_streaming.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/retry/test_retry_unary.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_bidi.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_client_info.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_client_logging.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_client_options.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_datetime_helpers.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_exceptions.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_extended_operation.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_grpc_helpers.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_iam.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_operation.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_packaging.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_page_iterator.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_path_template.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_protobuf_helpers.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_python_version_support.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_rest_helpers.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_rest_streaming.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_timeout.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_universe.py +0 -0
- {google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/test_version_header.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: google-api-core
|
|
3
|
-
Version: 2.28.
|
|
3
|
+
Version: 2.28.1
|
|
4
4
|
Summary: Google API client core library
|
|
5
5
|
Author-email: Google LLC <googleapis-packages@google.com>
|
|
6
6
|
License: Apache 2.0
|
|
@@ -30,6 +30,7 @@ Requires-Dist: proto-plus<2.0.0,>=1.22.3
|
|
|
30
30
|
Requires-Dist: proto-plus<2.0.0,>=1.25.0; python_version >= "3.13"
|
|
31
31
|
Requires-Dist: google-auth<3.0.0,>=2.14.1
|
|
32
32
|
Requires-Dist: requests<3.0.0,>=2.18.0
|
|
33
|
+
Requires-Dist: importlib_metadata>=1.4; python_version < "3.8"
|
|
33
34
|
Provides-Extra: async-rest
|
|
34
35
|
Requires-Dist: google-auth[aiohttp]<3.0.0,>=2.35.0; extra == "async-rest"
|
|
35
36
|
Provides-Extra: grpc
|
{google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/_python_package_support.py
RENAMED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import warnings
|
|
18
18
|
import sys
|
|
19
|
-
from typing import Optional
|
|
19
|
+
from typing import Optional, Tuple
|
|
20
20
|
|
|
21
21
|
from collections import namedtuple
|
|
22
22
|
|
|
@@ -25,7 +25,14 @@ from ._python_version_support import (
|
|
|
25
25
|
_get_distribution_and_import_packages,
|
|
26
26
|
)
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
if sys.version_info >= (3, 8):
|
|
29
|
+
from importlib import metadata
|
|
30
|
+
else:
|
|
31
|
+
# TODO(https://github.com/googleapis/python-api-core/issues/835): Remove
|
|
32
|
+
# this code path once we drop support for Python 3.7
|
|
33
|
+
import importlib_metadata as metadata
|
|
34
|
+
|
|
35
|
+
ParsedVersion = Tuple[int, ...]
|
|
29
36
|
|
|
30
37
|
# Here we list all the packages for which we want to issue warnings
|
|
31
38
|
# about deprecated and unsupported versions.
|
|
@@ -48,42 +55,56 @@ DependencyVersion = namedtuple("DependencyVersion", ["version", "version_string"
|
|
|
48
55
|
UNKNOWN_VERSION_STRING = "--"
|
|
49
56
|
|
|
50
57
|
|
|
58
|
+
def parse_version_to_tuple(version_string: str) -> ParsedVersion:
|
|
59
|
+
"""Safely converts a semantic version string to a comparable tuple of integers.
|
|
60
|
+
|
|
61
|
+
Example: "4.25.8" -> (4, 25, 8)
|
|
62
|
+
Ignores non-numeric parts and handles common version formats.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
version_string: Version string in the format "x.y.z" or "x.y.z<suffix>"
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
Tuple of integers for the parsed version string.
|
|
69
|
+
"""
|
|
70
|
+
parts = []
|
|
71
|
+
for part in version_string.split("."):
|
|
72
|
+
try:
|
|
73
|
+
parts.append(int(part))
|
|
74
|
+
except ValueError:
|
|
75
|
+
# If it's a non-numeric part (e.g., '1.0.0b1' -> 'b1'), stop here.
|
|
76
|
+
# This is a simplification compared to 'packaging.parse_version', but sufficient
|
|
77
|
+
# for comparing strictly numeric semantic versions.
|
|
78
|
+
break
|
|
79
|
+
return tuple(parts)
|
|
80
|
+
|
|
81
|
+
|
|
51
82
|
def get_dependency_version(
|
|
52
83
|
dependency_name: str,
|
|
53
84
|
) -> DependencyVersion:
|
|
54
85
|
"""Get the parsed version of an installed package dependency.
|
|
55
86
|
|
|
56
87
|
This function checks for an installed package and returns its version
|
|
57
|
-
as a
|
|
88
|
+
as a comparable tuple of integers object for safe comparison. It handles
|
|
58
89
|
both modern (Python 3.8+) and legacy (Python 3.7) environments.
|
|
59
90
|
|
|
60
91
|
Args:
|
|
61
92
|
dependency_name: The distribution name of the package (e.g., 'requests').
|
|
62
93
|
|
|
63
94
|
Returns:
|
|
64
|
-
A DependencyVersion namedtuple with `version` and
|
|
95
|
+
A DependencyVersion namedtuple with `version` (a tuple of integers) and
|
|
65
96
|
`version_string` attributes, or `DependencyVersion(None,
|
|
66
97
|
UNKNOWN_VERSION_STRING)` if the package is not found or
|
|
67
98
|
another error occurs during version discovery.
|
|
68
99
|
|
|
69
100
|
"""
|
|
70
101
|
try:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
version_string = metadata.version(dependency_name)
|
|
75
|
-
return DependencyVersion(parse_version(version_string), version_string)
|
|
76
|
-
|
|
77
|
-
# TODO(https://github.com/googleapis/python-api-core/issues/835): Remove
|
|
78
|
-
# this code path once we drop support for Python 3.7
|
|
79
|
-
else: # pragma: NO COVER
|
|
80
|
-
# Use pkg_resources, which is part of setuptools.
|
|
81
|
-
import pkg_resources
|
|
82
|
-
|
|
83
|
-
version_string = pkg_resources.get_distribution(dependency_name).version
|
|
84
|
-
return DependencyVersion(parse_version(version_string), version_string)
|
|
85
|
-
|
|
102
|
+
version_string: str = metadata.version(dependency_name)
|
|
103
|
+
parsed_version = parse_version_to_tuple(version_string)
|
|
104
|
+
return DependencyVersion(parsed_version, version_string)
|
|
86
105
|
except Exception:
|
|
106
|
+
# Catch exceptions from metadata.version() (e.g., PackageNotFoundError)
|
|
107
|
+
# or errors during parse_version_to_tuple
|
|
87
108
|
return DependencyVersion(None, UNKNOWN_VERSION_STRING)
|
|
88
109
|
|
|
89
110
|
|
|
@@ -132,10 +153,14 @@ def warn_deprecation_for_versions_less_than(
|
|
|
132
153
|
or not minimum_fully_supported_version
|
|
133
154
|
): # pragma: NO COVER
|
|
134
155
|
return
|
|
156
|
+
|
|
135
157
|
dependency_version = get_dependency_version(dependency_import_package)
|
|
136
158
|
if not dependency_version.version:
|
|
137
159
|
return
|
|
138
|
-
|
|
160
|
+
|
|
161
|
+
if dependency_version.version < parse_version_to_tuple(
|
|
162
|
+
minimum_fully_supported_version
|
|
163
|
+
):
|
|
139
164
|
(
|
|
140
165
|
dependency_package,
|
|
141
166
|
dependency_distribution_package,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: google-api-core
|
|
3
|
-
Version: 2.28.
|
|
3
|
+
Version: 2.28.1
|
|
4
4
|
Summary: Google API client core library
|
|
5
5
|
Author-email: Google LLC <googleapis-packages@google.com>
|
|
6
6
|
License: Apache 2.0
|
|
@@ -30,6 +30,7 @@ Requires-Dist: proto-plus<2.0.0,>=1.22.3
|
|
|
30
30
|
Requires-Dist: proto-plus<2.0.0,>=1.25.0; python_version >= "3.13"
|
|
31
31
|
Requires-Dist: google-auth<3.0.0,>=2.14.1
|
|
32
32
|
Requires-Dist: requests<3.0.0,>=2.18.0
|
|
33
|
+
Requires-Dist: importlib_metadata>=1.4; python_version < "3.8"
|
|
33
34
|
Provides-Extra: async-rest
|
|
34
35
|
Requires-Dist: google-auth[aiohttp]<3.0.0,>=2.35.0; extra == "async-rest"
|
|
35
36
|
Provides-Extra: grpc
|
|
@@ -51,6 +51,9 @@ dependencies = [
|
|
|
51
51
|
"proto-plus >= 1.25.0, < 2.0.0; python_version >= '3.13'",
|
|
52
52
|
"google-auth >= 2.14.1, < 3.0.0",
|
|
53
53
|
"requests >= 2.18.0, < 3.0.0",
|
|
54
|
+
# TODO(https://github.com/googleapis/python-api-core/issues/835): Remove
|
|
55
|
+
# `importlib_metadata` once we drop support for Python 3.7
|
|
56
|
+
"importlib_metadata>=1.4; python_version<'3.8'",
|
|
54
57
|
]
|
|
55
58
|
dynamic = ["version"]
|
|
56
59
|
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
|
|
15
15
|
import sys
|
|
16
16
|
import warnings
|
|
17
|
-
from unittest.mock import patch
|
|
17
|
+
from unittest.mock import patch
|
|
18
18
|
|
|
19
19
|
import pytest
|
|
20
|
-
from packaging.version import parse as parse_version
|
|
21
20
|
|
|
22
21
|
from google.api_core._python_package_support import (
|
|
22
|
+
parse_version_to_tuple,
|
|
23
23
|
get_dependency_version,
|
|
24
24
|
warn_deprecation_for_versions_less_than,
|
|
25
25
|
check_dependency_versions,
|
|
@@ -28,39 +28,28 @@ from google.api_core._python_package_support import (
|
|
|
28
28
|
)
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
@pytest.mark.parametrize("version_string_to_test", ["1.2.3", "1.2.3b1"])
|
|
32
|
+
def test_get_dependency_version(mocker, version_string_to_test):
|
|
33
|
+
"""Test get_dependency_version."""
|
|
34
|
+
if sys.version_info >= (3, 8):
|
|
35
|
+
mock_importlib = mocker.patch(
|
|
36
|
+
"importlib.metadata.version", return_value=version_string_to_test
|
|
37
|
+
)
|
|
38
|
+
else:
|
|
39
|
+
# TODO(https://github.com/googleapis/python-api-core/issues/835): Remove
|
|
40
|
+
# `importlib_metadata` once we drop support for Python 3.7
|
|
41
|
+
mock_importlib = mocker.patch(
|
|
42
|
+
"importlib_metadata.version", return_value=version_string_to_test
|
|
43
|
+
)
|
|
44
|
+
expected = DependencyVersion(
|
|
45
|
+
parse_version_to_tuple(version_string_to_test), version_string_to_test
|
|
46
|
+
)
|
|
39
47
|
assert get_dependency_version("some-package") == expected
|
|
40
|
-
mock_version.assert_called_once_with("some-package")
|
|
41
|
-
|
|
42
|
-
# Test package not found
|
|
43
|
-
mock_version.side_effect = ImportError
|
|
44
|
-
assert get_dependency_version("not-a-package") == DependencyVersion(None, "--")
|
|
45
|
-
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
# this test function once we drop support for Python 3.7
|
|
49
|
-
@pytest.mark.skipif(sys.version_info >= (3, 8), reason="requires python3.7")
|
|
50
|
-
@patch("pkg_resources.get_distribution")
|
|
51
|
-
def test_get_dependency_version_py37(mock_get_distribution):
|
|
52
|
-
"""Test get_dependency_version on Python 3.7."""
|
|
53
|
-
mock_dist = MagicMock()
|
|
54
|
-
mock_dist.version = "4.5.6"
|
|
55
|
-
mock_get_distribution.return_value = mock_dist
|
|
56
|
-
expected = DependencyVersion(parse_version("4.5.6"), "4.5.6")
|
|
57
|
-
assert get_dependency_version("another-package") == expected
|
|
58
|
-
mock_get_distribution.assert_called_once_with("another-package")
|
|
49
|
+
mock_importlib.assert_called_once_with("some-package")
|
|
59
50
|
|
|
60
51
|
# Test package not found
|
|
61
|
-
|
|
62
|
-
Exception # pkg_resources has its own exception types
|
|
63
|
-
)
|
|
52
|
+
mock_importlib.side_effect = ImportError
|
|
64
53
|
assert get_dependency_version("not-a-package") == DependencyVersion(None, "--")
|
|
65
54
|
|
|
66
55
|
|
|
@@ -74,7 +63,9 @@ def test_warn_deprecation_for_versions_less_than(mock_get_version, mock_get_pack
|
|
|
74
63
|
("my-package (my.package)", "my-package"),
|
|
75
64
|
]
|
|
76
65
|
|
|
77
|
-
mock_get_version.return_value = DependencyVersion(
|
|
66
|
+
mock_get_version.return_value = DependencyVersion(
|
|
67
|
+
parse_version_to_tuple("1.0.0"), "1.0.0"
|
|
68
|
+
)
|
|
78
69
|
with pytest.warns(FutureWarning) as record:
|
|
79
70
|
warn_deprecation_for_versions_less_than("my.package", "dep.package", "2.0.0")
|
|
80
71
|
assert len(record) == 1
|
|
@@ -90,14 +81,14 @@ def test_warn_deprecation_for_versions_less_than(mock_get_version, mock_get_pack
|
|
|
90
81
|
# Case 2: Installed version is equal to required, should not warn.
|
|
91
82
|
mock_get_packages.reset_mock()
|
|
92
83
|
mock_get_version.return_value = DependencyVersion(
|
|
93
|
-
|
|
84
|
+
parse_version_to_tuple("2.0.0"), "2.0.0"
|
|
94
85
|
)
|
|
95
86
|
warn_deprecation_for_versions_less_than("my.package", "dep.package", "2.0.0")
|
|
96
87
|
|
|
97
88
|
# Case 3: Installed version is greater than required, should not warn.
|
|
98
89
|
mock_get_packages.reset_mock()
|
|
99
90
|
mock_get_version.return_value = DependencyVersion(
|
|
100
|
-
|
|
91
|
+
parse_version_to_tuple("3.0.0"), "3.0.0"
|
|
101
92
|
)
|
|
102
93
|
warn_deprecation_for_versions_less_than("my.package", "dep.package", "2.0.0")
|
|
103
94
|
|
|
@@ -115,7 +106,9 @@ def test_warn_deprecation_for_versions_less_than(mock_get_version, mock_get_pack
|
|
|
115
106
|
("dep-package (dep.package)", "dep-package"),
|
|
116
107
|
("my-package (my.package)", "my-package"),
|
|
117
108
|
]
|
|
118
|
-
mock_get_version.return_value = DependencyVersion(
|
|
109
|
+
mock_get_version.return_value = DependencyVersion(
|
|
110
|
+
parse_version_to_tuple("1.0.0"), "1.0.0"
|
|
111
|
+
)
|
|
119
112
|
template = "Custom warning for {dependency_package} used by {consumer_package}."
|
|
120
113
|
with pytest.warns(FutureWarning) as record:
|
|
121
114
|
warn_deprecation_for_versions_less_than(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/_python_version_support.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/gapic_v1/routing_header.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/operations_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/pagers_async.py
RENAMED
|
File without changes
|
{google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/pagers_base.py
RENAMED
|
File without changes
|
|
File without changes
|
{google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/transports/base.py
RENAMED
|
File without changes
|
{google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/operations_v1/transports/rest.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/retry/retry_streaming_async.py
RENAMED
|
File without changes
|
|
File without changes
|
{google_api_core-2.28.0 → google_api_core-2.28.1}/google/api_core/retry/retry_unary_async.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_api_core-2.28.0 → google_api_core-2.28.1}/google_api_core.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_api_core-2.28.0 → google_api_core-2.28.1}/tests/asyncio/retry/test_retry_streaming_async.py
RENAMED
|
File without changes
|
{google_api_core-2.28.0 → google_api_core-2.28.1}/tests/asyncio/retry/test_retry_unary_async.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_api_core-2.28.0 → google_api_core-2.28.1}/tests/asyncio/test_rest_streaming_async.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_api_core-2.28.0 → google_api_core-2.28.1}/tests/unit/operations_v1/test_operations_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|