diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 64f82d6..757c9dc 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd -# created: 2022-04-21T15:43:16.246106921Z + digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 +# created: 2022-05-05T22:08:23.383410683Z diff --git a/.github/auto-approve.yml b/.github/auto-approve.yml new file mode 100644 index 0000000..311ebbb --- /dev/null +++ b/.github/auto-approve.yml @@ -0,0 +1,3 @@ +# https://github.com/googleapis/repo-automation-bots/tree/main/packages/auto-approve +processes: + - "OwlBotTemplateChanges" diff --git a/CHANGELOG.md b/CHANGELOG.md index dd22f6e..4acc869 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [1.0.1](https://github.com/googleapis/python-optimization/compare/v1.0.0...v1.0.1) (2022-06-07) + + +### Bug Fixes + +* **deps:** require protobuf>=3.19.0,<4.0.0 ([#42](https://github.com/googleapis/python-optimization/issues/42)) ([c141479](https://github.com/googleapis/python-optimization/commit/c141479451116a9667c73e4dc391e2933048da0c)) + + +### Documentation + +* fix changelog header to consistent size ([#40](https://github.com/googleapis/python-optimization/issues/40)) ([d1feb93](https://github.com/googleapis/python-optimization/commit/d1feb935cbe4ed15588adf165988cc74fcdb0a73)) + ## [1.0.0](https://github.com/googleapis/python-optimization/compare/v0.1.1...v1.0.0) (2022-04-26) @@ -7,7 +19,7 @@ * bump release level to production/stable ([#31](https://github.com/googleapis/python-optimization/issues/31)) ([dd9377f](https://github.com/googleapis/python-optimization/commit/dd9377f24b3e1ffcaee7c23c72872696bbaa6a20)) -### [0.1.1](https://github.com/googleapis/python-optimization/compare/v0.1.0...v0.1.1) (2022-04-25) +## [0.1.1](https://github.com/googleapis/python-optimization/compare/v0.1.0...v0.1.1) (2022-04-25) ### Documentation 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 9733d84..02c0e5b 100644 --- a/google/cloud/optimization_v1/services/fleet_routing/async_client.py +++ b/google/cloud/optimization_v1/services/fleet_routing/async_client.py @@ -250,9 +250,9 @@ async def optimize_tours( from google.cloud import optimization_v1 - def sample_optimize_tours(): + async def sample_optimize_tours(): # Create a client - client = optimization_v1.FleetRoutingClient() + client = optimization_v1.FleetRoutingAsyncClient() # Initialize request argument(s) request = optimization_v1.OptimizeToursRequest( @@ -260,7 +260,7 @@ def sample_optimize_tours(): ) # Make the request - response = client.optimize_tours(request=request) + response = await client.optimize_tours(request=request) # Handle the response print(response) @@ -346,9 +346,9 @@ async def batch_optimize_tours( from google.cloud import optimization_v1 - def sample_batch_optimize_tours(): + async def sample_batch_optimize_tours(): # Create a client - client = optimization_v1.FleetRoutingClient() + client = optimization_v1.FleetRoutingAsyncClient() # Initialize request argument(s) model_configs = optimization_v1.AsyncModelConfig() @@ -365,7 +365,7 @@ def sample_batch_optimize_tours(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index 764b6dd..20d7a05 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-optimization==0.1.1 +google-cloud-optimization==1.0.0 google-cloud-storage==2.3.0 diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py index d309d6e..91b5967 100644 --- a/scripts/readme-gen/readme_gen.py +++ b/scripts/readme-gen/readme_gen.py @@ -28,7 +28,10 @@ jinja_env = jinja2.Environment( trim_blocks=True, loader=jinja2.FileSystemLoader( - os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates')))) + os.path.abspath(os.path.join(os.path.dirname(__file__), "templates")) + ), + autoescape=True, +) README_TMPL = jinja_env.get_template('README.tmpl.rst') diff --git a/setup.py b/setup.py index 6339301..319cbc4 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ name = "google-cloud-optimization" description = "Cloud Optimization API client library" -version = "1.0.0" +version = "1.0.1" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-optimization" dependencies = [ @@ -30,7 +30,8 @@ # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", - "proto-plus >= 1.15.0", + "proto-plus >= 1.15.0, <2.0.0dev", + "protobuf >= 3.19.0, <4.0.0dev", ] package_root = os.path.abspath(os.path.dirname(__file__)) diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index be5a64f..786e637 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -6,3 +6,4 @@ # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.31.5 proto-plus==1.15.0 +protobuf==3.19.0 diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index e69de29..786e637 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -0,0 +1,9 @@ +# This constraints file is used to check that lower bounds +# are correct in setup.py +# List all library dependencies and extras in this file. +# Pin the version to the lower bound. +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", +# Then this file should have google-cloud-foo==1.14.0 +google-api-core==1.31.5 +proto-plus==1.15.0 +protobuf==3.19.0 diff --git a/tests/unit/gapic/optimization_v1/test_fleet_routing.py b/tests/unit/gapic/optimization_v1/test_fleet_routing.py index cc06eb2..185935f 100644 --- a/tests/unit/gapic/optimization_v1/test_fleet_routing.py +++ b/tests/unit/gapic/optimization_v1/test_fleet_routing.py @@ -14,7 +14,13 @@ # limitations under the License. # import os -import mock + +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock import grpc from grpc.experimental import aio @@ -742,7 +748,7 @@ def test_optimize_tours_field_headers(): # a field header. Set these to a non-empty value. request = fleet_routing.OptimizeToursRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.optimize_tours), "__call__") as call: @@ -758,7 +764,7 @@ def test_optimize_tours_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -772,7 +778,7 @@ async def test_optimize_tours_field_headers_async(): # a field header. Set these to a non-empty value. request = fleet_routing.OptimizeToursRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.optimize_tours), "__call__") as call: @@ -790,7 +796,7 @@ async def test_optimize_tours_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -893,7 +899,7 @@ def test_batch_optimize_tours_field_headers(): # a field header. Set these to a non-empty value. request = fleet_routing.BatchOptimizeToursRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -911,7 +917,7 @@ def test_batch_optimize_tours_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -925,7 +931,7 @@ async def test_batch_optimize_tours_field_headers_async(): # a field header. Set these to a non-empty value. request = fleet_routing.BatchOptimizeToursRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -945,7 +951,7 @@ async def test_batch_optimize_tours_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"]