diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml
index fccaa8e..889f77d 100644
--- a/.github/.OwlBot.lock.yaml
+++ b/.github/.OwlBot.lock.yaml
@@ -1,4 +1,4 @@
-# Copyright 2022 Google LLC
+# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -13,4 +13,4 @@
# limitations under the License.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
- digest: sha256:3bf87e47c2173d7eed42714589dc4da2c07c3268610f1e47f8e1a30decbfc7f1
+ digest: sha256:c43f1d918bcf817d337aa29ff833439494a158a0831508fda4ec75dc4c0d0320
diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml
index 23000c0..8057a76 100644
--- a/.github/workflows/unittest.yml
+++ b/.github/workflows/unittest.yml
@@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- python: ['3.7', '3.8', '3.9', '3.10']
+ python: ['3.7', '3.8', '3.9', '3.10', '3.11']
steps:
- name: Checkout
uses: actions/checkout@v3
diff --git a/.kokoro/samples/python3.11/common.cfg b/.kokoro/samples/python3.11/common.cfg
new file mode 100644
index 0000000..2f10390
--- /dev/null
+++ b/.kokoro/samples/python3.11/common.cfg
@@ -0,0 +1,40 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Build logs will be here
+action {
+ define_artifacts {
+ regex: "**/*sponge_log.xml"
+ }
+}
+
+# Specify which tests to run
+env_vars: {
+ key: "RUN_TESTS_SESSION"
+ value: "py-3.11"
+}
+
+# Declare build specific Cloud project.
+env_vars: {
+ key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
+ value: "python-docs-samples-tests-311"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-optimization/.kokoro/test-samples.sh"
+}
+
+# Configure the docker image for kokoro-trampoline.
+env_vars: {
+ key: "TRAMPOLINE_IMAGE"
+ value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
+}
+
+# Download secrets for samples
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
+
+# Download trampoline resources.
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
+
+# Use the trampoline script to run in docker.
+build_file: "python-optimization/.kokoro/trampoline_v2.sh"
\ No newline at end of file
diff --git a/.kokoro/samples/python3.11/continuous.cfg b/.kokoro/samples/python3.11/continuous.cfg
new file mode 100644
index 0000000..a1c8d97
--- /dev/null
+++ b/.kokoro/samples/python3.11/continuous.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.11/periodic-head.cfg b/.kokoro/samples/python3.11/periodic-head.cfg
new file mode 100644
index 0000000..9834715
--- /dev/null
+++ b/.kokoro/samples/python3.11/periodic-head.cfg
@@ -0,0 +1,11 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-optimization/.kokoro/test-samples-against-head.sh"
+}
diff --git a/.kokoro/samples/python3.11/periodic.cfg b/.kokoro/samples/python3.11/periodic.cfg
new file mode 100644
index 0000000..71cd1e5
--- /dev/null
+++ b/.kokoro/samples/python3.11/periodic.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "False"
+}
diff --git a/.kokoro/samples/python3.11/presubmit.cfg b/.kokoro/samples/python3.11/presubmit.cfg
new file mode 100644
index 0000000..a1c8d97
--- /dev/null
+++ b/.kokoro/samples/python3.11/presubmit.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index c3f1463..96f1cd9 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "1.2.0"
+ ".": "1.3.0"
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4b7f45b..f025929 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog
+## [1.3.0](https://github.com/googleapis/python-optimization/compare/v1.2.0...v1.3.0) (2023-01-10)
+
+
+### Features
+
+* Add support for python 3.11 ([#99](https://github.com/googleapis/python-optimization/issues/99)) ([95d8ee6](https://github.com/googleapis/python-optimization/commit/95d8ee6f85b066787b9543adc612de1699504e67))
+
## [1.2.0](https://github.com/googleapis/python-optimization/compare/v1.1.3...v1.2.0) (2022-12-15)
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 6718220..135449b 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -22,7 +22,7 @@ In order to add a feature:
documentation.
- The feature must work fully on the following CPython versions:
- 3.7, 3.8, 3.9 and 3.10 on both UNIX and Windows.
+ 3.7, 3.8, 3.9, 3.10 and 3.11 on both UNIX and Windows.
- The feature must not add unnecessary dependencies (where
"unnecessary" is of course subjective, but new dependencies should
@@ -72,7 +72,7 @@ We use `nox `__ to instrument our tests.
- To run a single unit test::
- $ nox -s unit-3.10 -- -k
+ $ nox -s unit-3.11 -- -k
.. note::
@@ -225,11 +225,13 @@ We support:
- `Python 3.8`_
- `Python 3.9`_
- `Python 3.10`_
+- `Python 3.11`_
.. _Python 3.7: https://docs.python.org/3.7/
.. _Python 3.8: https://docs.python.org/3.8/
.. _Python 3.9: https://docs.python.org/3.9/
.. _Python 3.10: https://docs.python.org/3.10/
+.. _Python 3.11: https://docs.python.org/3.11/
Supported versions can be found in our ``noxfile.py`` `config`_.
diff --git a/google/cloud/optimization/gapic_version.py b/google/cloud/optimization/gapic_version.py
index 8f031bd..e4a285c 100644
--- a/google/cloud/optimization/gapic_version.py
+++ b/google/cloud/optimization/gapic_version.py
@@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-__version__ = "1.2.0" # {x-release-please-version}
+__version__ = "1.3.0" # {x-release-please-version}
diff --git a/google/cloud/optimization_v1/gapic_version.py b/google/cloud/optimization_v1/gapic_version.py
index 8f031bd..e4a285c 100644
--- a/google/cloud/optimization_v1/gapic_version.py
+++ b/google/cloud/optimization_v1/gapic_version.py
@@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-__version__ = "1.2.0" # {x-release-please-version}
+__version__ = "1.3.0" # {x-release-please-version}
diff --git a/google/cloud/optimization_v1/services/fleet_routing/async_client.py b/google/cloud/optimization_v1/services/fleet_routing/async_client.py
index e776f69..6545dc4 100644
--- a/google/cloud/optimization_v1/services/fleet_routing/async_client.py
+++ b/google/cloud/optimization_v1/services/fleet_routing/async_client.py
@@ -152,7 +152,7 @@ def get_mtls_endpoint_and_cert_source(
The API endpoint is determined in the following order:
(1) if `client_options.api_endpoint` if provided, use the provided one.
(2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
- default mTLS endpoint; if the environment variabel is "never", use the default API
+ default mTLS endpoint; if the environment variable is "never", use the default API
endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
use the default API endpoint.
diff --git a/google/cloud/optimization_v1/services/fleet_routing/client.py b/google/cloud/optimization_v1/services/fleet_routing/client.py
index b62c361..91b21d3 100644
--- a/google/cloud/optimization_v1/services/fleet_routing/client.py
+++ b/google/cloud/optimization_v1/services/fleet_routing/client.py
@@ -290,7 +290,7 @@ def get_mtls_endpoint_and_cert_source(
The API endpoint is determined in the following order:
(1) if `client_options.api_endpoint` if provided, use the provided one.
(2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
- default mTLS endpoint; if the environment variabel is "never", use the default API
+ default mTLS endpoint; if the environment variable is "never", use the default API
endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
use the default API endpoint.
diff --git a/google/cloud/optimization_v1/types/fleet_routing.py b/google/cloud/optimization_v1/types/fleet_routing.py
index 7168b98..638d473 100644
--- a/google/cloud/optimization_v1/types/fleet_routing.py
+++ b/google/cloud/optimization_v1/types/fleet_routing.py
@@ -57,6 +57,9 @@ class OptimizeToursRequest(proto.Message):
defines the shipment model to solve as well as optimization
parameters.
+
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
+
Attributes:
parent (str):
Required. Target project and location to make a call.
@@ -616,6 +619,9 @@ class ShipmentModel(proto.Message):
- the unperformed shipment penalties.
- the cost of the global duration of the shipments
+
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
+
Attributes:
shipments (MutableSequence[google.cloud.optimization_v1.types.Shipment]):
Set of shipments which must be performed in
@@ -874,6 +880,9 @@ class PrecedenceRule(proto.Message):
Furthermore, precedences only apply when both shipments are
performed and are otherwise ignored.
+
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
+
Attributes:
first_index (int):
Shipment index of the "first" event. This
@@ -1139,6 +1148,9 @@ class Shipment(proto.Message):
visit one of its delivery locations later on (and therefore
re-increase its spare capacities accordingly).
+
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
+
Attributes:
pickups (MutableSequence[google.cloud.optimization_v1.types.Shipment.VisitRequest]):
Set of pickup alternatives associated to the
@@ -1595,6 +1607,9 @@ class Vehicle(proto.Message):
``end_location`` for this vehicle. A route is a sequence of visits
(see ``ShipmentRoute``).
+
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
+
Attributes:
travel_mode (google.cloud.optimization_v1.types.Vehicle.TravelMode):
The travel mode which affects the roads usable by the
@@ -1826,6 +1841,9 @@ class LoadLimit(proto.Message):
only carry up to 3500 kg". See
[load_limits][google.cloud.optimization.v1.Vehicle.load_limits].
+
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
+
Attributes:
max_load (int):
The maximum acceptable amount of load.
@@ -1855,6 +1873,8 @@ class LoadLimit(proto.Message):
class Interval(proto.Message):
r"""Interval of acceptable load amounts.
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
+
Attributes:
min_ (int):
A minimum acceptable load. Must be ≥ 0. If they're both
@@ -1914,6 +1934,9 @@ class DurationLimit(proto.Message):
When a soft limit field is defined, both the soft max threshold
and its associated cost must be defined together.
+
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
+
Attributes:
max_duration (google.protobuf.duration_pb2.Duration):
A hard limit constraining the duration to be at most
@@ -2163,6 +2186,9 @@ class TimeWindow(proto.Message):
0 <= `start_time` <= `soft_start_time` <= `end_time` and
0 <= `start_time` <= `soft_end_time` <= `end_time`.
+
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
+
Attributes:
start_time (google.protobuf.timestamp_pb2.Timestamp):
The hard time window start time. If unspecified it will be
@@ -2260,6 +2286,8 @@ class CapacityQuantity(proto.Message):
class CapacityQuantityInterval(proto.Message):
r"""Deprecated: Use [Vehicle.LoadLimit.Interval][] instead.
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
+
Attributes:
type_ (str):
@@ -2295,6 +2323,9 @@ class DistanceLimit(proto.Message):
``cost_per_kilometer_above_soft_max`` must be defined and be
nonnegative.
+
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
+
Attributes:
max_meters (int):
A hard limit constraining the distance to be at most
@@ -2489,6 +2520,9 @@ class Location(proto.Message):
r"""Encapsulates a location (a geographic point, and an optional
heading).
+
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
+
Attributes:
lat_lng (google.type.latlng_pb2.LatLng):
The waypoint's geographic coordinates.
@@ -3354,6 +3388,9 @@ class Reason(proto.Message):
3) and at least one vehicle's distance limit would be exceeded
(including vehicle 1).
+
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
+
Attributes:
code (google.cloud.optimization_v1.types.SkippedShipment.Reason.Code):
Refer to the comments of Code.
diff --git a/noxfile.py b/noxfile.py
index d752b54..d1f2496 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -31,7 +31,7 @@
DEFAULT_PYTHON_VERSION = "3.8"
-UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10"]
+UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"]
UNIT_TEST_STANDARD_DEPENDENCIES = [
"mock",
"asyncmock",
diff --git a/samples/generated_samples/snippet_metadata_google.cloud.optimization.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.optimization.v1.json
index cf0b058..d57cc00 100644
--- a/samples/generated_samples/snippet_metadata_google.cloud.optimization.v1.json
+++ b/samples/generated_samples/snippet_metadata_google.cloud.optimization.v1.json
@@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-optimization",
- "version": "1.2.0"
+ "version": "1.3.0"
},
"snippets": [
{
diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py
index e8283c3..1224cbe 100644
--- a/samples/snippets/noxfile.py
+++ b/samples/snippets/noxfile.py
@@ -89,7 +89,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
# DO NOT EDIT - automatically generated.
# All versions used to test samples.
-ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10"]
+ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"]
# Any default versions that should be ignored.
IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]
diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt
index 2960034..3ca44b4 100644
--- a/samples/snippets/requirements.txt
+++ b/samples/snippets/requirements.txt
@@ -1,2 +1,2 @@
-google-cloud-optimization==1.1.3
+google-cloud-optimization==1.2.0
google-cloud-storage==2.7.0
diff --git a/setup.py b/setup.py
index d9c153f..30c559e 100644
--- a/setup.py
+++ b/setup.py
@@ -40,6 +40,7 @@
dependencies = [
"google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*",
"proto-plus >= 1.22.0, <2.0.0dev",
+ "proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'",
"protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
]
url = "https://github.com/googleapis/python-optimization"
@@ -79,6 +80,7 @@
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: 3.11",
"Operating System :: OS Independent",
"Topic :: Internet",
],
diff --git a/testing/constraints-3.12.txt b/testing/constraints-3.12.txt
new file mode 100644
index 0000000..ed7f9ae
--- /dev/null
+++ b/testing/constraints-3.12.txt
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+# This constraints file is required for unit tests.
+# List all library dependencies and extras in this file.
+google-api-core
+proto-plus
+protobuf