google-maps-routeoptimization 0.1.11__tar.gz → 0.3.0__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_maps_routeoptimization-0.1.11/google_maps_routeoptimization.egg-info → google_maps_routeoptimization-0.3.0}/PKG-INFO +5 -2
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/README.rst +1 -1
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google/maps/routeoptimization/__init__.py +12 -0
- google_maps_routeoptimization-0.3.0/google/maps/routeoptimization/gapic_version.py +16 -0
- google_maps_routeoptimization-0.3.0/google/maps/routeoptimization_v1/__init__.py +201 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google/maps/routeoptimization_v1/gapic_metadata.json +30 -0
- google_maps_routeoptimization-0.3.0/google/maps/routeoptimization_v1/gapic_version.py +16 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google/maps/routeoptimization_v1/services/route_optimization/async_client.py +267 -14
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google/maps/routeoptimization_v1/services/route_optimization/client.py +297 -28
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google/maps/routeoptimization_v1/services/route_optimization/transports/base.py +31 -2
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google/maps/routeoptimization_v1/services/route_optimization/transports/grpc.py +123 -17
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google/maps/routeoptimization_v1/services/route_optimization/transports/grpc_asyncio.py +135 -17
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google/maps/routeoptimization_v1/services/route_optimization/transports/rest.py +464 -16
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google/maps/routeoptimization_v1/services/route_optimization/transports/rest_base.py +124 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google/maps/routeoptimization_v1/types/__init__.py +12 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google/maps/routeoptimization_v1/types/route_optimization_service.py +816 -149
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0/google_maps_routeoptimization.egg-info}/PKG-INFO +5 -2
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google_maps_routeoptimization.egg-info/requires.txt +4 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/setup.py +3 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/tests/unit/gapic/routeoptimization_v1/test_route_optimization.py +1658 -276
- google_maps_routeoptimization-0.1.11/google/maps/routeoptimization/gapic_version.py +0 -16
- google_maps_routeoptimization-0.1.11/google/maps/routeoptimization_v1/__init__.py +0 -85
- google_maps_routeoptimization-0.1.11/google/maps/routeoptimization_v1/gapic_version.py +0 -16
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/LICENSE +0 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/MANIFEST.in +0 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google/maps/routeoptimization/py.typed +0 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google/maps/routeoptimization_v1/py.typed +0 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google/maps/routeoptimization_v1/services/__init__.py +0 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google/maps/routeoptimization_v1/services/route_optimization/__init__.py +0 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google/maps/routeoptimization_v1/services/route_optimization/transports/__init__.py +0 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google_maps_routeoptimization.egg-info/SOURCES.txt +0 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google_maps_routeoptimization.egg-info/dependency_links.txt +0 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google_maps_routeoptimization.egg-info/not-zip-safe +0 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/google_maps_routeoptimization.egg-info/top_level.txt +0 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/setup.cfg +0 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/tests/__init__.py +0 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/tests/unit/__init__.py +0 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/tests/unit/gapic/__init__.py +0 -0
- {google_maps_routeoptimization-0.1.11 → google_maps_routeoptimization-0.3.0}/tests/unit/gapic/routeoptimization_v1/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: google-maps-routeoptimization
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Google Maps Routeoptimization API client library
|
|
5
5
|
Home-page: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-maps-routeoptimization
|
|
6
6
|
Author: Google LLC
|
|
@@ -19,12 +19,15 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
23
|
Classifier: Operating System :: OS Independent
|
|
23
24
|
Classifier: Topic :: Internet
|
|
24
25
|
Requires-Python: >=3.7
|
|
25
26
|
License-File: LICENSE
|
|
26
27
|
Requires-Dist: google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.1
|
|
27
28
|
Requires-Dist: google-auth!=2.24.0,!=2.25.0,<3.0.0,>=2.14.1
|
|
29
|
+
Requires-Dist: grpcio<2.0.0,>=1.33.2
|
|
30
|
+
Requires-Dist: grpcio<2.0.0,>=1.75.1; python_version >= "3.14"
|
|
28
31
|
Requires-Dist: proto-plus<2.0.0,>=1.22.3
|
|
29
32
|
Requires-Dist: proto-plus<2.0.0,>=1.25.0; python_version >= "3.13"
|
|
30
33
|
Requires-Dist: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<7.0.0,>=3.20.2
|
|
@@ -103,7 +106,7 @@ Supported Python Versions
|
|
|
103
106
|
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
|
|
104
107
|
Python.
|
|
105
108
|
|
|
106
|
-
Python >= 3.7
|
|
109
|
+
Python >= 3.7, including 3.14
|
|
107
110
|
|
|
108
111
|
.. _active: https://devguide.python.org/devcycle/#in-development-main-branch
|
|
109
112
|
.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
|
|
@@ -61,7 +61,7 @@ Supported Python Versions
|
|
|
61
61
|
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
|
|
62
62
|
Python.
|
|
63
63
|
|
|
64
|
-
Python >= 3.7
|
|
64
|
+
Python >= 3.7, including 3.14
|
|
65
65
|
|
|
66
66
|
.. _active: https://devguide.python.org/devcycle/#in-development-main-branch
|
|
67
67
|
.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
|
|
@@ -37,8 +37,12 @@ from google.maps.routeoptimization_v1.types.route_optimization_service import (
|
|
|
37
37
|
InjectedSolutionConstraint,
|
|
38
38
|
InputConfig,
|
|
39
39
|
Location,
|
|
40
|
+
OptimizeToursLongRunningMetadata,
|
|
40
41
|
OptimizeToursRequest,
|
|
41
42
|
OptimizeToursResponse,
|
|
43
|
+
OptimizeToursUriMetadata,
|
|
44
|
+
OptimizeToursUriRequest,
|
|
45
|
+
OptimizeToursUriResponse,
|
|
42
46
|
OptimizeToursValidationError,
|
|
43
47
|
OutputConfig,
|
|
44
48
|
RouteModifiers,
|
|
@@ -50,7 +54,9 @@ from google.maps.routeoptimization_v1.types.route_optimization_service import (
|
|
|
50
54
|
SkippedShipment,
|
|
51
55
|
TimeWindow,
|
|
52
56
|
TransitionAttributes,
|
|
57
|
+
Uri,
|
|
53
58
|
Vehicle,
|
|
59
|
+
VehicleFullness,
|
|
54
60
|
Waypoint,
|
|
55
61
|
)
|
|
56
62
|
|
|
@@ -68,8 +74,12 @@ __all__ = (
|
|
|
68
74
|
"InjectedSolutionConstraint",
|
|
69
75
|
"InputConfig",
|
|
70
76
|
"Location",
|
|
77
|
+
"OptimizeToursLongRunningMetadata",
|
|
71
78
|
"OptimizeToursRequest",
|
|
72
79
|
"OptimizeToursResponse",
|
|
80
|
+
"OptimizeToursUriMetadata",
|
|
81
|
+
"OptimizeToursUriRequest",
|
|
82
|
+
"OptimizeToursUriResponse",
|
|
73
83
|
"OptimizeToursValidationError",
|
|
74
84
|
"OutputConfig",
|
|
75
85
|
"RouteModifiers",
|
|
@@ -81,7 +91,9 @@ __all__ = (
|
|
|
81
91
|
"SkippedShipment",
|
|
82
92
|
"TimeWindow",
|
|
83
93
|
"TransitionAttributes",
|
|
94
|
+
"Uri",
|
|
84
95
|
"Vehicle",
|
|
96
|
+
"VehicleFullness",
|
|
85
97
|
"Waypoint",
|
|
86
98
|
"DataFormat",
|
|
87
99
|
)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright 2025 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.3.0" # {x-release-please-version}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright 2025 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
|
+
import sys
|
|
17
|
+
|
|
18
|
+
import google.api_core as api_core
|
|
19
|
+
|
|
20
|
+
from google.maps.routeoptimization_v1 import gapic_version as package_version
|
|
21
|
+
|
|
22
|
+
__version__ = package_version.__version__
|
|
23
|
+
|
|
24
|
+
if sys.version_info >= (3, 8): # pragma: NO COVER
|
|
25
|
+
from importlib import metadata
|
|
26
|
+
else: # pragma: NO COVER
|
|
27
|
+
# TODO(https://github.com/googleapis/python-api-core/issues/835): Remove
|
|
28
|
+
# this code path once we drop support for Python 3.7
|
|
29
|
+
import importlib_metadata as metadata
|
|
30
|
+
|
|
31
|
+
from .services.route_optimization import (
|
|
32
|
+
RouteOptimizationAsyncClient,
|
|
33
|
+
RouteOptimizationClient,
|
|
34
|
+
)
|
|
35
|
+
from .types.route_optimization_service import (
|
|
36
|
+
AggregatedMetrics,
|
|
37
|
+
BatchOptimizeToursMetadata,
|
|
38
|
+
BatchOptimizeToursRequest,
|
|
39
|
+
BatchOptimizeToursResponse,
|
|
40
|
+
BreakRule,
|
|
41
|
+
DataFormat,
|
|
42
|
+
DistanceLimit,
|
|
43
|
+
GcsDestination,
|
|
44
|
+
GcsSource,
|
|
45
|
+
InjectedSolutionConstraint,
|
|
46
|
+
InputConfig,
|
|
47
|
+
Location,
|
|
48
|
+
OptimizeToursLongRunningMetadata,
|
|
49
|
+
OptimizeToursRequest,
|
|
50
|
+
OptimizeToursResponse,
|
|
51
|
+
OptimizeToursUriMetadata,
|
|
52
|
+
OptimizeToursUriRequest,
|
|
53
|
+
OptimizeToursUriResponse,
|
|
54
|
+
OptimizeToursValidationError,
|
|
55
|
+
OutputConfig,
|
|
56
|
+
RouteModifiers,
|
|
57
|
+
Shipment,
|
|
58
|
+
ShipmentModel,
|
|
59
|
+
ShipmentRoute,
|
|
60
|
+
ShipmentTypeIncompatibility,
|
|
61
|
+
ShipmentTypeRequirement,
|
|
62
|
+
SkippedShipment,
|
|
63
|
+
TimeWindow,
|
|
64
|
+
TransitionAttributes,
|
|
65
|
+
Uri,
|
|
66
|
+
Vehicle,
|
|
67
|
+
VehicleFullness,
|
|
68
|
+
Waypoint,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
if hasattr(api_core, "check_python_version") and hasattr(
|
|
72
|
+
api_core, "check_dependency_versions"
|
|
73
|
+
): # pragma: NO COVER
|
|
74
|
+
api_core.check_python_version("google.maps.routeoptimization_v1") # type: ignore
|
|
75
|
+
api_core.check_dependency_versions("google.maps.routeoptimization_v1") # type: ignore
|
|
76
|
+
else: # pragma: NO COVER
|
|
77
|
+
# An older version of api_core is installed which does not define the
|
|
78
|
+
# functions above. We do equivalent checks manually.
|
|
79
|
+
try:
|
|
80
|
+
import sys
|
|
81
|
+
import warnings
|
|
82
|
+
|
|
83
|
+
_py_version_str = sys.version.split()[0]
|
|
84
|
+
_package_label = "google.maps.routeoptimization_v1"
|
|
85
|
+
if sys.version_info < (3, 9):
|
|
86
|
+
warnings.warn(
|
|
87
|
+
"You are using a non-supported Python version "
|
|
88
|
+
+ f"({_py_version_str}). Google will not post any further "
|
|
89
|
+
+ f"updates to {_package_label} supporting this Python version. "
|
|
90
|
+
+ "Please upgrade to the latest Python version, or at "
|
|
91
|
+
+ f"least to Python 3.9, and then update {_package_label}.",
|
|
92
|
+
FutureWarning,
|
|
93
|
+
)
|
|
94
|
+
if sys.version_info[:2] == (3, 9):
|
|
95
|
+
warnings.warn(
|
|
96
|
+
f"You are using a Python version ({_py_version_str}) "
|
|
97
|
+
+ f"which Google will stop supporting in {_package_label} in "
|
|
98
|
+
+ "January 2026. Please "
|
|
99
|
+
+ "upgrade to the latest Python version, or at "
|
|
100
|
+
+ "least to Python 3.10, before then, and "
|
|
101
|
+
+ f"then update {_package_label}.",
|
|
102
|
+
FutureWarning,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
def parse_version_to_tuple(version_string: str):
|
|
106
|
+
"""Safely converts a semantic version string to a comparable tuple of integers.
|
|
107
|
+
Example: "4.25.8" -> (4, 25, 8)
|
|
108
|
+
Ignores non-numeric parts and handles common version formats.
|
|
109
|
+
Args:
|
|
110
|
+
version_string: Version string in the format "x.y.z" or "x.y.z<suffix>"
|
|
111
|
+
Returns:
|
|
112
|
+
Tuple of integers for the parsed version string.
|
|
113
|
+
"""
|
|
114
|
+
parts = []
|
|
115
|
+
for part in version_string.split("."):
|
|
116
|
+
try:
|
|
117
|
+
parts.append(int(part))
|
|
118
|
+
except ValueError:
|
|
119
|
+
# If it's a non-numeric part (e.g., '1.0.0b1' -> 'b1'), stop here.
|
|
120
|
+
# This is a simplification compared to 'packaging.parse_version', but sufficient
|
|
121
|
+
# for comparing strictly numeric semantic versions.
|
|
122
|
+
break
|
|
123
|
+
return tuple(parts)
|
|
124
|
+
|
|
125
|
+
def _get_version(dependency_name):
|
|
126
|
+
try:
|
|
127
|
+
version_string: str = metadata.version(dependency_name)
|
|
128
|
+
parsed_version = parse_version_to_tuple(version_string)
|
|
129
|
+
return (parsed_version, version_string)
|
|
130
|
+
except Exception:
|
|
131
|
+
# Catch exceptions from metadata.version() (e.g., PackageNotFoundError)
|
|
132
|
+
# or errors during parse_version_to_tuple
|
|
133
|
+
return (None, "--")
|
|
134
|
+
|
|
135
|
+
_dependency_package = "google.protobuf"
|
|
136
|
+
_next_supported_version = "4.25.8"
|
|
137
|
+
_next_supported_version_tuple = (4, 25, 8)
|
|
138
|
+
_recommendation = " (we recommend 6.x)"
|
|
139
|
+
(_version_used, _version_used_string) = _get_version(_dependency_package)
|
|
140
|
+
if _version_used and _version_used < _next_supported_version_tuple:
|
|
141
|
+
warnings.warn(
|
|
142
|
+
f"Package {_package_label} depends on "
|
|
143
|
+
+ f"{_dependency_package}, currently installed at version "
|
|
144
|
+
+ f"{_version_used_string}. Future updates to "
|
|
145
|
+
+ f"{_package_label} will require {_dependency_package} at "
|
|
146
|
+
+ f"version {_next_supported_version} or higher{_recommendation}."
|
|
147
|
+
+ " Please ensure "
|
|
148
|
+
+ "that either (a) your Python environment doesn't pin the "
|
|
149
|
+
+ f"version of {_dependency_package}, so that updates to "
|
|
150
|
+
+ f"{_package_label} can require the higher version, or "
|
|
151
|
+
+ "(b) you manually update your Python environment to use at "
|
|
152
|
+
+ f"least version {_next_supported_version} of "
|
|
153
|
+
+ f"{_dependency_package}.",
|
|
154
|
+
FutureWarning,
|
|
155
|
+
)
|
|
156
|
+
except Exception:
|
|
157
|
+
warnings.warn(
|
|
158
|
+
"Could not determine the version of Python "
|
|
159
|
+
+ "currently being used. To continue receiving "
|
|
160
|
+
+ "updates for {_package_label}, ensure you are "
|
|
161
|
+
+ "using a supported version of Python; see "
|
|
162
|
+
+ "https://devguide.python.org/versions/"
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
__all__ = (
|
|
166
|
+
"RouteOptimizationAsyncClient",
|
|
167
|
+
"AggregatedMetrics",
|
|
168
|
+
"BatchOptimizeToursMetadata",
|
|
169
|
+
"BatchOptimizeToursRequest",
|
|
170
|
+
"BatchOptimizeToursResponse",
|
|
171
|
+
"BreakRule",
|
|
172
|
+
"DataFormat",
|
|
173
|
+
"DistanceLimit",
|
|
174
|
+
"GcsDestination",
|
|
175
|
+
"GcsSource",
|
|
176
|
+
"InjectedSolutionConstraint",
|
|
177
|
+
"InputConfig",
|
|
178
|
+
"Location",
|
|
179
|
+
"OptimizeToursLongRunningMetadata",
|
|
180
|
+
"OptimizeToursRequest",
|
|
181
|
+
"OptimizeToursResponse",
|
|
182
|
+
"OptimizeToursUriMetadata",
|
|
183
|
+
"OptimizeToursUriRequest",
|
|
184
|
+
"OptimizeToursUriResponse",
|
|
185
|
+
"OptimizeToursValidationError",
|
|
186
|
+
"OutputConfig",
|
|
187
|
+
"RouteModifiers",
|
|
188
|
+
"RouteOptimizationClient",
|
|
189
|
+
"Shipment",
|
|
190
|
+
"ShipmentModel",
|
|
191
|
+
"ShipmentRoute",
|
|
192
|
+
"ShipmentTypeIncompatibility",
|
|
193
|
+
"ShipmentTypeRequirement",
|
|
194
|
+
"SkippedShipment",
|
|
195
|
+
"TimeWindow",
|
|
196
|
+
"TransitionAttributes",
|
|
197
|
+
"Uri",
|
|
198
|
+
"Vehicle",
|
|
199
|
+
"VehicleFullness",
|
|
200
|
+
"Waypoint",
|
|
201
|
+
)
|
|
@@ -19,6 +19,16 @@
|
|
|
19
19
|
"methods": [
|
|
20
20
|
"optimize_tours"
|
|
21
21
|
]
|
|
22
|
+
},
|
|
23
|
+
"OptimizeToursLongRunning": {
|
|
24
|
+
"methods": [
|
|
25
|
+
"optimize_tours_long_running"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"OptimizeToursUri": {
|
|
29
|
+
"methods": [
|
|
30
|
+
"optimize_tours_uri"
|
|
31
|
+
]
|
|
22
32
|
}
|
|
23
33
|
}
|
|
24
34
|
},
|
|
@@ -34,6 +44,16 @@
|
|
|
34
44
|
"methods": [
|
|
35
45
|
"optimize_tours"
|
|
36
46
|
]
|
|
47
|
+
},
|
|
48
|
+
"OptimizeToursLongRunning": {
|
|
49
|
+
"methods": [
|
|
50
|
+
"optimize_tours_long_running"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"OptimizeToursUri": {
|
|
54
|
+
"methods": [
|
|
55
|
+
"optimize_tours_uri"
|
|
56
|
+
]
|
|
37
57
|
}
|
|
38
58
|
}
|
|
39
59
|
},
|
|
@@ -49,6 +69,16 @@
|
|
|
49
69
|
"methods": [
|
|
50
70
|
"optimize_tours"
|
|
51
71
|
]
|
|
72
|
+
},
|
|
73
|
+
"OptimizeToursLongRunning": {
|
|
74
|
+
"methods": [
|
|
75
|
+
"optimize_tours_long_running"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"OptimizeToursUri": {
|
|
79
|
+
"methods": [
|
|
80
|
+
"optimize_tours_uri"
|
|
81
|
+
]
|
|
52
82
|
}
|
|
53
83
|
}
|
|
54
84
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright 2025 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.3.0" # {x-release-please-version}
|
|
@@ -69,25 +69,24 @@ class RouteOptimizationAsyncClient:
|
|
|
69
69
|
|
|
70
70
|
Validity of certain types of fields:
|
|
71
71
|
|
|
72
|
-
-
|
|
72
|
+
- ``google.protobuf.Timestamp``
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
- nanos must be unset or set to 0.
|
|
74
|
+
- Times are in Unix time: seconds since 1970-01-01T00:00:00+00:00.
|
|
75
|
+
- seconds must be in [0, 253402300799], i.e. in
|
|
76
|
+
[1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00].
|
|
77
|
+
- nanos must be unset or set to 0.
|
|
79
78
|
|
|
80
|
-
-
|
|
79
|
+
- ``google.protobuf.Duration``
|
|
81
80
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
- seconds must be in [0, 253402300799], i.e. in
|
|
82
|
+
[1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00].
|
|
83
|
+
- nanos must be unset or set to 0.
|
|
85
84
|
|
|
86
|
-
-
|
|
85
|
+
- ``google.type.LatLng``
|
|
87
86
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
- latitude must be in [-90.0, 90.0].
|
|
88
|
+
- longitude must be in [-180.0, 180.0].
|
|
89
|
+
- at least one of latitude and longitude must be non-zero.
|
|
91
90
|
"""
|
|
92
91
|
|
|
93
92
|
_client: RouteOptimizationClient
|
|
@@ -564,6 +563,260 @@ class RouteOptimizationAsyncClient:
|
|
|
564
563
|
# Done; return the response.
|
|
565
564
|
return response
|
|
566
565
|
|
|
566
|
+
async def optimize_tours_long_running(
|
|
567
|
+
self,
|
|
568
|
+
request: Optional[
|
|
569
|
+
Union[route_optimization_service.OptimizeToursRequest, dict]
|
|
570
|
+
] = None,
|
|
571
|
+
*,
|
|
572
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
573
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
574
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
575
|
+
) -> operation_async.AsyncOperation:
|
|
576
|
+
r"""This is a variant of the
|
|
577
|
+
[OptimizeTours][google.maps.routeoptimization.v1.RouteOptimization.OptimizeTours]
|
|
578
|
+
method designed for optimizations with large timeout values. It
|
|
579
|
+
should be preferred over the ``OptimizeTours`` method for
|
|
580
|
+
optimizations that take longer than a few minutes.
|
|
581
|
+
|
|
582
|
+
The returned [long-running
|
|
583
|
+
operation][google.longrunning.Operation] (LRO) will have a name
|
|
584
|
+
of the format ``<parent>/operations/<operation_id>`` and can be
|
|
585
|
+
used to track progress of the computation. The
|
|
586
|
+
[metadata][google.longrunning.Operation.metadata] field type is
|
|
587
|
+
[OptimizeToursLongRunningMetadata][google.maps.routeoptimization.v1.OptimizeToursLongRunningMetadata].
|
|
588
|
+
The [response][google.longrunning.Operation.response] field type
|
|
589
|
+
is
|
|
590
|
+
[OptimizeToursResponse][google.maps.routeoptimization.v1.OptimizeToursResponse],
|
|
591
|
+
if successful.
|
|
592
|
+
|
|
593
|
+
Experimental: See
|
|
594
|
+
https://developers.google.com/maps/tt/route-optimization/experimental/otlr/make-request
|
|
595
|
+
for more details.
|
|
596
|
+
|
|
597
|
+
.. code-block:: python
|
|
598
|
+
|
|
599
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
600
|
+
# code template only.
|
|
601
|
+
# It will require modifications to work:
|
|
602
|
+
# - It may require correct/in-range values for request initialization.
|
|
603
|
+
# - It may require specifying regional endpoints when creating the service
|
|
604
|
+
# client as shown in:
|
|
605
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
606
|
+
from google.maps import routeoptimization_v1
|
|
607
|
+
|
|
608
|
+
async def sample_optimize_tours_long_running():
|
|
609
|
+
# Create a client
|
|
610
|
+
client = routeoptimization_v1.RouteOptimizationAsyncClient()
|
|
611
|
+
|
|
612
|
+
# Initialize request argument(s)
|
|
613
|
+
request = routeoptimization_v1.OptimizeToursRequest(
|
|
614
|
+
parent="parent_value",
|
|
615
|
+
)
|
|
616
|
+
|
|
617
|
+
# Make the request
|
|
618
|
+
operation = client.optimize_tours_long_running(request=request)
|
|
619
|
+
|
|
620
|
+
print("Waiting for operation to complete...")
|
|
621
|
+
|
|
622
|
+
response = (await operation).result()
|
|
623
|
+
|
|
624
|
+
# Handle the response
|
|
625
|
+
print(response)
|
|
626
|
+
|
|
627
|
+
Args:
|
|
628
|
+
request (Optional[Union[google.maps.routeoptimization_v1.types.OptimizeToursRequest, dict]]):
|
|
629
|
+
The request object. Request to be given to a tour
|
|
630
|
+
optimization solver which defines the
|
|
631
|
+
shipment model to solve as well as
|
|
632
|
+
optimization parameters.
|
|
633
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
634
|
+
should be retried.
|
|
635
|
+
timeout (float): The timeout for this request.
|
|
636
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
637
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
638
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
639
|
+
be of type `bytes`.
|
|
640
|
+
|
|
641
|
+
Returns:
|
|
642
|
+
google.api_core.operation_async.AsyncOperation:
|
|
643
|
+
An object representing a long-running operation.
|
|
644
|
+
|
|
645
|
+
The result type for the operation will be :class:`google.maps.routeoptimization_v1.types.OptimizeToursResponse` Response after solving a tour optimization problem containing the routes
|
|
646
|
+
followed by each vehicle, the shipments which have
|
|
647
|
+
been skipped and the overall cost of the solution.
|
|
648
|
+
|
|
649
|
+
"""
|
|
650
|
+
# Create or coerce a protobuf request object.
|
|
651
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
652
|
+
# there are no flattened fields), or create one.
|
|
653
|
+
if not isinstance(request, route_optimization_service.OptimizeToursRequest):
|
|
654
|
+
request = route_optimization_service.OptimizeToursRequest(request)
|
|
655
|
+
|
|
656
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
657
|
+
# and friendly error handling.
|
|
658
|
+
rpc = self._client._transport._wrapped_methods[
|
|
659
|
+
self._client._transport.optimize_tours_long_running
|
|
660
|
+
]
|
|
661
|
+
|
|
662
|
+
# Certain fields should be provided within the metadata header;
|
|
663
|
+
# add these here.
|
|
664
|
+
metadata = tuple(metadata) + (
|
|
665
|
+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
|
|
666
|
+
)
|
|
667
|
+
|
|
668
|
+
# Validate the universe domain.
|
|
669
|
+
self._client._validate_universe_domain()
|
|
670
|
+
|
|
671
|
+
# Send the request.
|
|
672
|
+
response = await rpc(
|
|
673
|
+
request,
|
|
674
|
+
retry=retry,
|
|
675
|
+
timeout=timeout,
|
|
676
|
+
metadata=metadata,
|
|
677
|
+
)
|
|
678
|
+
|
|
679
|
+
# Wrap the response in an operation future.
|
|
680
|
+
response = operation_async.from_gapic(
|
|
681
|
+
response,
|
|
682
|
+
self._client._transport.operations_client,
|
|
683
|
+
route_optimization_service.OptimizeToursResponse,
|
|
684
|
+
metadata_type=route_optimization_service.OptimizeToursLongRunningMetadata,
|
|
685
|
+
)
|
|
686
|
+
|
|
687
|
+
# Done; return the response.
|
|
688
|
+
return response
|
|
689
|
+
|
|
690
|
+
async def optimize_tours_uri(
|
|
691
|
+
self,
|
|
692
|
+
request: Optional[
|
|
693
|
+
Union[route_optimization_service.OptimizeToursUriRequest, dict]
|
|
694
|
+
] = None,
|
|
695
|
+
*,
|
|
696
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
697
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
698
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
699
|
+
) -> operation_async.AsyncOperation:
|
|
700
|
+
r"""This is a variant of the
|
|
701
|
+
[OptimizeToursLongRunning][google.maps.routeoptimization.v1.RouteOptimization.OptimizeToursLongRunning]
|
|
702
|
+
method designed for optimizations with large timeout values and
|
|
703
|
+
large input/output sizes.
|
|
704
|
+
|
|
705
|
+
The client specifies the URI of the ``OptimizeToursRequest``
|
|
706
|
+
stored in Google Cloud Storage and the server writes the
|
|
707
|
+
``OptimizeToursResponse`` to a client-specified Google Cloud
|
|
708
|
+
Storage URI.
|
|
709
|
+
|
|
710
|
+
This method should be preferred over the ``OptimizeTours``
|
|
711
|
+
method for optimizations that take longer than a few minutes and
|
|
712
|
+
input/output sizes that are larger than 8MB, though it can be
|
|
713
|
+
used for shorter and smaller optimizations as well.
|
|
714
|
+
|
|
715
|
+
The returned [long-running
|
|
716
|
+
operation][google.longrunning.Operation] (LRO) will have a name
|
|
717
|
+
of the format ``<parent>/operations/<operation_id>`` and can be
|
|
718
|
+
used to track progress of the computation. The
|
|
719
|
+
[metadata][google.longrunning.Operation.metadata] field type is
|
|
720
|
+
[OptimizeToursLongRunningMetadata][google.maps.routeoptimization.v1.OptimizeToursUriMetadata].
|
|
721
|
+
The [response][google.longrunning.Operation.response] field type
|
|
722
|
+
is
|
|
723
|
+
[OptimizeToursUriResponse][google.maps.routeoptimization.v1.OptimizeToursUriResponse],
|
|
724
|
+
if successful.
|
|
725
|
+
|
|
726
|
+
Experimental: See
|
|
727
|
+
https://developers.google.com/maps/tt/route-optimization/experimental/otlr/make-request
|
|
728
|
+
for more details.
|
|
729
|
+
|
|
730
|
+
.. code-block:: python
|
|
731
|
+
|
|
732
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
733
|
+
# code template only.
|
|
734
|
+
# It will require modifications to work:
|
|
735
|
+
# - It may require correct/in-range values for request initialization.
|
|
736
|
+
# - It may require specifying regional endpoints when creating the service
|
|
737
|
+
# client as shown in:
|
|
738
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
739
|
+
from google.maps import routeoptimization_v1
|
|
740
|
+
|
|
741
|
+
async def sample_optimize_tours_uri():
|
|
742
|
+
# Create a client
|
|
743
|
+
client = routeoptimization_v1.RouteOptimizationAsyncClient()
|
|
744
|
+
|
|
745
|
+
# Initialize request argument(s)
|
|
746
|
+
request = routeoptimization_v1.OptimizeToursUriRequest(
|
|
747
|
+
parent="parent_value",
|
|
748
|
+
)
|
|
749
|
+
|
|
750
|
+
# Make the request
|
|
751
|
+
operation = client.optimize_tours_uri(request=request)
|
|
752
|
+
|
|
753
|
+
print("Waiting for operation to complete...")
|
|
754
|
+
|
|
755
|
+
response = (await operation).result()
|
|
756
|
+
|
|
757
|
+
# Handle the response
|
|
758
|
+
print(response)
|
|
759
|
+
|
|
760
|
+
Args:
|
|
761
|
+
request (Optional[Union[google.maps.routeoptimization_v1.types.OptimizeToursUriRequest, dict]]):
|
|
762
|
+
The request object. A request used by the ``OptimizeToursUri`` method.
|
|
763
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
764
|
+
should be retried.
|
|
765
|
+
timeout (float): The timeout for this request.
|
|
766
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
767
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
768
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
769
|
+
be of type `bytes`.
|
|
770
|
+
|
|
771
|
+
Returns:
|
|
772
|
+
google.api_core.operation_async.AsyncOperation:
|
|
773
|
+
An object representing a long-running operation.
|
|
774
|
+
|
|
775
|
+
The result type for the operation will be
|
|
776
|
+
:class:`google.maps.routeoptimization_v1.types.OptimizeToursUriResponse`
|
|
777
|
+
A response returned by the OptimizeToursUri method.
|
|
778
|
+
|
|
779
|
+
"""
|
|
780
|
+
# Create or coerce a protobuf request object.
|
|
781
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
782
|
+
# there are no flattened fields), or create one.
|
|
783
|
+
if not isinstance(request, route_optimization_service.OptimizeToursUriRequest):
|
|
784
|
+
request = route_optimization_service.OptimizeToursUriRequest(request)
|
|
785
|
+
|
|
786
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
787
|
+
# and friendly error handling.
|
|
788
|
+
rpc = self._client._transport._wrapped_methods[
|
|
789
|
+
self._client._transport.optimize_tours_uri
|
|
790
|
+
]
|
|
791
|
+
|
|
792
|
+
# Certain fields should be provided within the metadata header;
|
|
793
|
+
# add these here.
|
|
794
|
+
metadata = tuple(metadata) + (
|
|
795
|
+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
|
|
796
|
+
)
|
|
797
|
+
|
|
798
|
+
# Validate the universe domain.
|
|
799
|
+
self._client._validate_universe_domain()
|
|
800
|
+
|
|
801
|
+
# Send the request.
|
|
802
|
+
response = await rpc(
|
|
803
|
+
request,
|
|
804
|
+
retry=retry,
|
|
805
|
+
timeout=timeout,
|
|
806
|
+
metadata=metadata,
|
|
807
|
+
)
|
|
808
|
+
|
|
809
|
+
# Wrap the response in an operation future.
|
|
810
|
+
response = operation_async.from_gapic(
|
|
811
|
+
response,
|
|
812
|
+
self._client._transport.operations_client,
|
|
813
|
+
route_optimization_service.OptimizeToursUriResponse,
|
|
814
|
+
metadata_type=route_optimization_service.OptimizeToursUriMetadata,
|
|
815
|
+
)
|
|
816
|
+
|
|
817
|
+
# Done; return the response.
|
|
818
|
+
return response
|
|
819
|
+
|
|
567
820
|
async def get_operation(
|
|
568
821
|
self,
|
|
569
822
|
request: Optional[operations_pb2.GetOperationRequest] = None,
|