From e547ae8bbf464bf9a0b3be8931ff8dc4ee69cb4f Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 27 Sep 2021 17:50:16 +0200 Subject: [PATCH 01/10] chore(deps): update dependency google-cloud-bigquery-reservation to v1.3.1 (#168) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [google-cloud-bigquery-reservation](https://togithub.com/googleapis/python-bigquery-reservation) | `==1.3.0` -> `==1.3.1` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery-reservation/1.3.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery-reservation/1.3.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery-reservation/1.3.1/compatibility-slim/1.3.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery-reservation/1.3.1/confidence-slim/1.3.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
googleapis/python-bigquery-reservation ### [`v1.3.1`](https://togithub.com/googleapis/python-bigquery-reservation/blob/master/CHANGELOG.md#​131-httpswwwgithubcomgoogleapispython-bigquery-reservationcomparev130v131-2021-09-24) [Compare Source](https://togithub.com/googleapis/python-bigquery-reservation/compare/v1.3.0...v1.3.1)
--- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-bigquery-reservation). --- samples/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index 3e861eec..4d9c3b24 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-bigquery-reservation==1.3.0 +google-cloud-bigquery-reservation==1.3.1 From f36ede37c5365870c725388ae8bde6768ba06dde Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Mon, 27 Sep 2021 14:53:15 -0400 Subject: [PATCH 02/10] chore: add codeowner_team to repo-metadata.json (#161) Co-authored-by: Tim Swast --- .github/CODEOWNERS | 9 +++++---- .repo-metadata.json | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1473ae01..3678a0ac 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -4,8 +4,9 @@ # For syntax help see: # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax -# The @googleapis/api-bigquery is the default owner for changes in this repo -* @googleapis/api-bigquery @googleapis/yoshi-python -# The python-samples-reviewers team is the default owner for samples changes -/samples/ @googleapis/python-samples-owners @googleapis/api-bigquery @googleapis/yoshi-python +# @googleapis/yoshi-python and @googleapis/api-bigquery are the default owners for changes in this repo +* @googleapis/yoshi-python @googleapis/api-bigquery + +# @googleapis/python-samples-owners and @googleapis/api-bigquery are the default owners for samples changes +/samples/ @googleapis/python-samples-owners @googleapis/api-bigquery diff --git a/.repo-metadata.json b/.repo-metadata.json index 2c68061f..24fb2f2b 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -10,5 +10,6 @@ "repo": "googleapis/python-bigquery-reservation", "distribution_name": "google-cloud-bigquery-reservation", "api_id": "bigqueryreservation.googleapis.com", - "requires_billing": true -} \ No newline at end of file + "requires_billing": true, + "codeowner_team": "@googleapis/api-bigquery" +} From ae65c70bd91602ccb851167d27b4161ebd6c3bb3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 30 Sep 2021 10:18:16 +0000 Subject: [PATCH 03/10] chore: use gapic-generator-python 0.52.0 (#169) - [ ] Regenerate this pull request now. fix: improper types in pagers generation PiperOrigin-RevId: 399773015 Source-Link: https://github.com/googleapis/googleapis/commit/410c184536a22fadaf00aec3cab04102e34d2322 Source-Link: https://github.com/googleapis/googleapis-gen/commit/290e883545e3ac9ff2bd00cd0dacb28f1b8ca945 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjkwZTg4MzU0NWUzYWM5ZmYyYmQwMGNkMGRhY2IyOGYxYjhjYTk0NSJ9 --- .../services/reservation_service/pagers.py | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/google/cloud/bigquery_reservation_v1/services/reservation_service/pagers.py b/google/cloud/bigquery_reservation_v1/services/reservation_service/pagers.py index 2642b0d1..2b34021e 100644 --- a/google/cloud/bigquery_reservation_v1/services/reservation_service/pagers.py +++ b/google/cloud/bigquery_reservation_v1/services/reservation_service/pagers.py @@ -15,13 +15,13 @@ # from typing import ( Any, - AsyncIterable, + AsyncIterator, Awaitable, Callable, - Iterable, Sequence, Tuple, Optional, + Iterator, ) from google.cloud.bigquery_reservation_v1.types import reservation @@ -74,14 +74,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - def pages(self) -> Iterable[reservation.ListReservationsResponse]: + def pages(self) -> Iterator[reservation.ListReservationsResponse]: yield self._response while self._response.next_page_token: self._request.page_token = self._response.next_page_token self._response = self._method(self._request, metadata=self._metadata) yield self._response - def __iter__(self) -> Iterable[reservation.Reservation]: + def __iter__(self) -> Iterator[reservation.Reservation]: for page in self.pages: yield from page.reservations @@ -136,14 +136,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - async def pages(self) -> AsyncIterable[reservation.ListReservationsResponse]: + async def pages(self) -> AsyncIterator[reservation.ListReservationsResponse]: yield self._response while self._response.next_page_token: self._request.page_token = self._response.next_page_token self._response = await self._method(self._request, metadata=self._metadata) yield self._response - def __aiter__(self) -> AsyncIterable[reservation.Reservation]: + def __aiter__(self) -> AsyncIterator[reservation.Reservation]: async def async_generator(): async for page in self.pages: for response in page.reservations: @@ -202,14 +202,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - def pages(self) -> Iterable[reservation.ListCapacityCommitmentsResponse]: + def pages(self) -> Iterator[reservation.ListCapacityCommitmentsResponse]: yield self._response while self._response.next_page_token: self._request.page_token = self._response.next_page_token self._response = self._method(self._request, metadata=self._metadata) yield self._response - def __iter__(self) -> Iterable[reservation.CapacityCommitment]: + def __iter__(self) -> Iterator[reservation.CapacityCommitment]: for page in self.pages: yield from page.capacity_commitments @@ -264,14 +264,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - async def pages(self) -> AsyncIterable[reservation.ListCapacityCommitmentsResponse]: + async def pages(self) -> AsyncIterator[reservation.ListCapacityCommitmentsResponse]: yield self._response while self._response.next_page_token: self._request.page_token = self._response.next_page_token self._response = await self._method(self._request, metadata=self._metadata) yield self._response - def __aiter__(self) -> AsyncIterable[reservation.CapacityCommitment]: + def __aiter__(self) -> AsyncIterator[reservation.CapacityCommitment]: async def async_generator(): async for page in self.pages: for response in page.capacity_commitments: @@ -330,14 +330,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - def pages(self) -> Iterable[reservation.ListAssignmentsResponse]: + def pages(self) -> Iterator[reservation.ListAssignmentsResponse]: yield self._response while self._response.next_page_token: self._request.page_token = self._response.next_page_token self._response = self._method(self._request, metadata=self._metadata) yield self._response - def __iter__(self) -> Iterable[reservation.Assignment]: + def __iter__(self) -> Iterator[reservation.Assignment]: for page in self.pages: yield from page.assignments @@ -392,14 +392,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - async def pages(self) -> AsyncIterable[reservation.ListAssignmentsResponse]: + async def pages(self) -> AsyncIterator[reservation.ListAssignmentsResponse]: yield self._response while self._response.next_page_token: self._request.page_token = self._response.next_page_token self._response = await self._method(self._request, metadata=self._metadata) yield self._response - def __aiter__(self) -> AsyncIterable[reservation.Assignment]: + def __aiter__(self) -> AsyncIterator[reservation.Assignment]: async def async_generator(): async for page in self.pages: for response in page.assignments: @@ -458,14 +458,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - def pages(self) -> Iterable[reservation.SearchAssignmentsResponse]: + def pages(self) -> Iterator[reservation.SearchAssignmentsResponse]: yield self._response while self._response.next_page_token: self._request.page_token = self._response.next_page_token self._response = self._method(self._request, metadata=self._metadata) yield self._response - def __iter__(self) -> Iterable[reservation.Assignment]: + def __iter__(self) -> Iterator[reservation.Assignment]: for page in self.pages: yield from page.assignments @@ -520,14 +520,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - async def pages(self) -> AsyncIterable[reservation.SearchAssignmentsResponse]: + async def pages(self) -> AsyncIterator[reservation.SearchAssignmentsResponse]: yield self._response while self._response.next_page_token: self._request.page_token = self._response.next_page_token self._response = await self._method(self._request, metadata=self._metadata) yield self._response - def __aiter__(self) -> AsyncIterable[reservation.Assignment]: + def __aiter__(self) -> AsyncIterator[reservation.Assignment]: async def async_generator(): async for page in self.pages: for response in page.assignments: @@ -586,14 +586,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - def pages(self) -> Iterable[reservation.SearchAllAssignmentsResponse]: + def pages(self) -> Iterator[reservation.SearchAllAssignmentsResponse]: yield self._response while self._response.next_page_token: self._request.page_token = self._response.next_page_token self._response = self._method(self._request, metadata=self._metadata) yield self._response - def __iter__(self) -> Iterable[reservation.Assignment]: + def __iter__(self) -> Iterator[reservation.Assignment]: for page in self.pages: yield from page.assignments @@ -648,14 +648,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - async def pages(self) -> AsyncIterable[reservation.SearchAllAssignmentsResponse]: + async def pages(self) -> AsyncIterator[reservation.SearchAllAssignmentsResponse]: yield self._response while self._response.next_page_token: self._request.page_token = self._response.next_page_token self._response = await self._method(self._request, metadata=self._metadata) yield self._response - def __aiter__(self) -> AsyncIterable[reservation.Assignment]: + def __aiter__(self) -> AsyncIterator[reservation.Assignment]: async def async_generator(): async for page in self.pages: for response in page.assignments: From e98c9ec53667b551b98096ae163e3bf2ccef0b20 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 30 Sep 2021 15:44:22 +0000 Subject: [PATCH 04/10] chore: fail samples nox session if python version is missing (#171) --- .github/.OwlBot.lock.yaml | 2 +- samples/snippets/noxfile.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 2567653c..ae6c57fa 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:87eee22d276554e4e52863ec9b1cb6a7245815dfae20439712bf644348215a5a + digest: sha256:82b12321da4446a73cb11bcb6812fbec8c105abda3946d46e6394e5fbfb64c0f diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index b008613f..1fd8956f 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -98,6 +98,10 @@ def get_pytest_env_vars() -> Dict[str, str]: "True", "true", ) + +# Error if a python version is missing +nox.options.error_on_missing_interpreters = True + # # Style Checks # From 6ba130a2bdb389bd6ac7e7a0803ce32abcda98eb Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 5 Oct 2021 12:55:41 -0400 Subject: [PATCH 05/10] chore: add default_version to .repo-metadata.json (#172) * chore: add default_version and codeowner_team to .repo-metadata.json * update default_version --- .repo-metadata.json | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.repo-metadata.json b/.repo-metadata.json index 24fb2f2b..5bc93fd7 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -1,15 +1,16 @@ { - "name": "bigqueryreservation", - "name_pretty": "Google BigQuery Reservation", - "product_documentation": "https://cloud.google.com/bigquery/docs/reference/reservations", - "client_documentation": "https://googleapis.dev/python/bigqueryreservation/latest", - "issue_tracker": "", - "release_level": "ga", - "language": "python", - "library_type": "GAPIC_AUTO", - "repo": "googleapis/python-bigquery-reservation", - "distribution_name": "google-cloud-bigquery-reservation", - "api_id": "bigqueryreservation.googleapis.com", - "requires_billing": true, - "codeowner_team": "@googleapis/api-bigquery" + "name": "bigqueryreservation", + "name_pretty": "Google BigQuery Reservation", + "product_documentation": "https://cloud.google.com/bigquery/docs/reference/reservations", + "client_documentation": "https://googleapis.dev/python/bigqueryreservation/latest", + "issue_tracker": "", + "release_level": "ga", + "language": "python", + "library_type": "GAPIC_AUTO", + "repo": "googleapis/python-bigquery-reservation", + "distribution_name": "google-cloud-bigquery-reservation", + "api_id": "bigqueryreservation.googleapis.com", + "requires_billing": true, + "codeowner_team": "@googleapis/api-bigquery", + "default_version": "v1" } From dd3eee89c55043048a923cd350da0e80ee83c5b8 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 5 Oct 2021 13:09:40 -0600 Subject: [PATCH 06/10] build: use trampoline_v2 for python samples and allow custom dockerfile (#173) Source-Link: https://github.com/googleapis/synthtool/commit/a7ed11ec0863c422ba2e73aafa75eab22c32b33d Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:6e7328583be8edd3ba8f35311c76a1ecbc823010279ccb6ab46b7a76e25eafcc Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/samples/lint/common.cfg | 2 +- .kokoro/samples/python3.6/common.cfg | 2 +- .kokoro/samples/python3.6/periodic.cfg | 2 +- .kokoro/samples/python3.7/common.cfg | 2 +- .kokoro/samples/python3.7/periodic.cfg | 2 +- .kokoro/samples/python3.8/common.cfg | 2 +- .kokoro/samples/python3.8/periodic.cfg | 2 +- .kokoro/samples/python3.9/common.cfg | 2 +- .kokoro/samples/python3.9/periodic.cfg | 2 +- .kokoro/test-samples-against-head.sh | 2 -- .kokoro/test-samples.sh | 2 -- .trampolinerc | 17 ++++++++++++++--- 13 files changed, 24 insertions(+), 17 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index ae6c57fa..ee94722a 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:82b12321da4446a73cb11bcb6812fbec8c105abda3946d46e6394e5fbfb64c0f + digest: sha256:6e7328583be8edd3ba8f35311c76a1ecbc823010279ccb6ab46b7a76e25eafcc diff --git a/.kokoro/samples/lint/common.cfg b/.kokoro/samples/lint/common.cfg index e65f99c0..e7ceea32 100644 --- a/.kokoro/samples/lint/common.cfg +++ b/.kokoro/samples/lint/common.cfg @@ -31,4 +31,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-bigquery-reservation/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-bigquery-reservation/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.6/common.cfg b/.kokoro/samples/python3.6/common.cfg index 71d3f21d..f859ce4d 100644 --- a/.kokoro/samples/python3.6/common.cfg +++ b/.kokoro/samples/python3.6/common.cfg @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-bigquery-reservation/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-bigquery-reservation/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.6/periodic.cfg b/.kokoro/samples/python3.6/periodic.cfg index 50fec964..71cd1e59 100644 --- a/.kokoro/samples/python3.6/periodic.cfg +++ b/.kokoro/samples/python3.6/periodic.cfg @@ -3,4 +3,4 @@ env_vars: { key: "INSTALL_LIBRARY_FROM_SOURCE" value: "False" -} \ No newline at end of file +} diff --git a/.kokoro/samples/python3.7/common.cfg b/.kokoro/samples/python3.7/common.cfg index f3f88f3c..c16e8df1 100644 --- a/.kokoro/samples/python3.7/common.cfg +++ b/.kokoro/samples/python3.7/common.cfg @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-bigquery-reservation/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-bigquery-reservation/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.7/periodic.cfg b/.kokoro/samples/python3.7/periodic.cfg index 50fec964..71cd1e59 100644 --- a/.kokoro/samples/python3.7/periodic.cfg +++ b/.kokoro/samples/python3.7/periodic.cfg @@ -3,4 +3,4 @@ env_vars: { key: "INSTALL_LIBRARY_FROM_SOURCE" value: "False" -} \ No newline at end of file +} diff --git a/.kokoro/samples/python3.8/common.cfg b/.kokoro/samples/python3.8/common.cfg index ab5788c1..cb8929fc 100644 --- a/.kokoro/samples/python3.8/common.cfg +++ b/.kokoro/samples/python3.8/common.cfg @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-bigquery-reservation/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-bigquery-reservation/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.8/periodic.cfg b/.kokoro/samples/python3.8/periodic.cfg index 50fec964..71cd1e59 100644 --- a/.kokoro/samples/python3.8/periodic.cfg +++ b/.kokoro/samples/python3.8/periodic.cfg @@ -3,4 +3,4 @@ env_vars: { key: "INSTALL_LIBRARY_FROM_SOURCE" value: "False" -} \ No newline at end of file +} diff --git a/.kokoro/samples/python3.9/common.cfg b/.kokoro/samples/python3.9/common.cfg index fb8edcc2..3c5a517f 100644 --- a/.kokoro/samples/python3.9/common.cfg +++ b/.kokoro/samples/python3.9/common.cfg @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-bigquery-reservation/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-bigquery-reservation/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.9/periodic.cfg b/.kokoro/samples/python3.9/periodic.cfg index 50fec964..71cd1e59 100644 --- a/.kokoro/samples/python3.9/periodic.cfg +++ b/.kokoro/samples/python3.9/periodic.cfg @@ -3,4 +3,4 @@ env_vars: { key: "INSTALL_LIBRARY_FROM_SOURCE" value: "False" -} \ No newline at end of file +} diff --git a/.kokoro/test-samples-against-head.sh b/.kokoro/test-samples-against-head.sh index ce1646a4..ba3a707b 100755 --- a/.kokoro/test-samples-against-head.sh +++ b/.kokoro/test-samples-against-head.sh @@ -23,6 +23,4 @@ set -eo pipefail # Enables `**` to include files nested inside sub-folders shopt -s globstar -cd github/python-bigquery-reservation - exec .kokoro/test-samples-impl.sh diff --git a/.kokoro/test-samples.sh b/.kokoro/test-samples.sh index 3f2514ea..11c042d3 100755 --- a/.kokoro/test-samples.sh +++ b/.kokoro/test-samples.sh @@ -24,8 +24,6 @@ set -eo pipefail # Enables `**` to include files nested inside sub-folders shopt -s globstar -cd github/python-bigquery-reservation - # Run periodic samples tests at latest release if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then # preserving the test runner implementation. diff --git a/.trampolinerc b/.trampolinerc index 383b6ec8..0eee72ab 100644 --- a/.trampolinerc +++ b/.trampolinerc @@ -16,15 +16,26 @@ # Add required env vars here. required_envvars+=( - "STAGING_BUCKET" - "V2_STAGING_BUCKET" ) # Add env vars which are passed down into the container here. pass_down_envvars+=( + "NOX_SESSION" + ############### + # Docs builds + ############### "STAGING_BUCKET" "V2_STAGING_BUCKET" - "NOX_SESSION" + ################## + # Samples builds + ################## + "INSTALL_LIBRARY_FROM_SOURCE" + "RUN_TESTS_SESSION" + "BUILD_SPECIFIC_GCLOUD_PROJECT" + # Target directories. + "RUN_TESTS_DIRS" + # The nox session to run. + "RUN_TESTS_SESSION" ) # Prevent unintentional override on the default image. From 6e06ed3206f1212851a479ea8bdad95fb3edc03d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 7 Oct 2021 18:13:10 +0000 Subject: [PATCH 07/10] chore(python): fix formatting issue in noxfile.py.j2 (#174) --- .github/.OwlBot.lock.yaml | 2 +- CONTRIBUTING.rst | 6 ++++-- noxfile.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index ee94722a..76d0baa0 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:6e7328583be8edd3ba8f35311c76a1ecbc823010279ccb6ab46b7a76e25eafcc + digest: sha256:4370ced27a324687ede5da07132dcdc5381993502a5e8a3e31e16dc631d026f0 diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index b3ac7085..8fb141a1 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.6, 3.7, 3.8 and 3.9 on both UNIX and Windows. + 3.6, 3.7, 3.8, 3.9 and 3.10 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.9 -- -k + $ nox -s unit-3.10 -- -k .. note:: @@ -225,11 +225,13 @@ We support: - `Python 3.7`_ - `Python 3.8`_ - `Python 3.9`_ +- `Python 3.10`_ .. _Python 3.6: https://docs.python.org/3.6/ .. _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/ Supported versions can be found in our ``noxfile.py`` `config`_. diff --git a/noxfile.py b/noxfile.py index 832ef3bc..b20209c9 100644 --- a/noxfile.py +++ b/noxfile.py @@ -29,7 +29,7 @@ DEFAULT_PYTHON_VERSION = "3.8" SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] -UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"] +UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() From 80768c8009b8450a3ac3025c95683bcd0628ef35 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 8 Oct 2021 14:16:40 +0000 Subject: [PATCH 08/10] feat: add context manager support in client (#175) - [ ] Regenerate this pull request now. chore: fix docstring for first attribute of protos committer: @busunkim96 PiperOrigin-RevId: 401271153 Source-Link: https://github.com/googleapis/googleapis/commit/787f8c9a731f44e74a90b9847d48659ca9462d10 Source-Link: https://github.com/googleapis/googleapis-gen/commit/81decffe9fc72396a8153e756d1d67a6eecfd620 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODFkZWNmZmU5ZmM3MjM5NmE4MTUzZTc1NmQxZDY3YTZlZWNmZDYyMCJ9 --- .../reservation_service/async_client.py | 6 +++ .../services/reservation_service/client.py | 18 +++++-- .../reservation_service/transports/base.py | 9 ++++ .../reservation_service/transports/grpc.py | 3 ++ .../transports/grpc_asyncio.py | 3 ++ .../types/reservation.py | 3 ++ .../test_reservation_service.py | 50 +++++++++++++++++++ 7 files changed, 88 insertions(+), 4 deletions(-) diff --git a/google/cloud/bigquery_reservation_v1/services/reservation_service/async_client.py b/google/cloud/bigquery_reservation_v1/services/reservation_service/async_client.py index fc2c5f10..05ae6d34 100644 --- a/google/cloud/bigquery_reservation_v1/services/reservation_service/async_client.py +++ b/google/cloud/bigquery_reservation_v1/services/reservation_service/async_client.py @@ -2119,6 +2119,12 @@ async def update_bi_reservation( # Done; return the response. return response + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/bigquery_reservation_v1/services/reservation_service/client.py b/google/cloud/bigquery_reservation_v1/services/reservation_service/client.py index b8079a65..0387956b 100644 --- a/google/cloud/bigquery_reservation_v1/services/reservation_service/client.py +++ b/google/cloud/bigquery_reservation_v1/services/reservation_service/client.py @@ -423,10 +423,7 @@ def __init__( client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, - always_use_jwt_access=( - Transport == type(self).get_transport_class("grpc") - or Transport == type(self).get_transport_class("grpc_asyncio") - ), + always_use_jwt_access=True, ) def create_reservation( @@ -2262,6 +2259,19 @@ def update_bi_reservation( # Done; return the response. return response + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + """Releases underlying transport's resources. + + .. warning:: + ONLY use as a context manager if the transport is NOT shared + with other clients! Exiting the with block will CLOSE the transport + and may cause errors in other clients! + """ + self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/bigquery_reservation_v1/services/reservation_service/transports/base.py b/google/cloud/bigquery_reservation_v1/services/reservation_service/transports/base.py index ff994fc1..ed076e2c 100644 --- a/google/cloud/bigquery_reservation_v1/services/reservation_service/transports/base.py +++ b/google/cloud/bigquery_reservation_v1/services/reservation_service/transports/base.py @@ -353,6 +353,15 @@ def _prep_wrapped_messages(self, client_info): ), } + def close(self): + """Closes resources associated with the transport. + + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! + """ + raise NotImplementedError() + @property def create_reservation( self, diff --git a/google/cloud/bigquery_reservation_v1/services/reservation_service/transports/grpc.py b/google/cloud/bigquery_reservation_v1/services/reservation_service/transports/grpc.py index 5164a2d9..b13017a8 100644 --- a/google/cloud/bigquery_reservation_v1/services/reservation_service/transports/grpc.py +++ b/google/cloud/bigquery_reservation_v1/services/reservation_service/transports/grpc.py @@ -950,5 +950,8 @@ def update_bi_reservation( ) return self._stubs["update_bi_reservation"] + def close(self): + self.grpc_channel.close() + __all__ = ("ReservationServiceGrpcTransport",) diff --git a/google/cloud/bigquery_reservation_v1/services/reservation_service/transports/grpc_asyncio.py b/google/cloud/bigquery_reservation_v1/services/reservation_service/transports/grpc_asyncio.py index 56fbb16f..b9b8ac36 100644 --- a/google/cloud/bigquery_reservation_v1/services/reservation_service/transports/grpc_asyncio.py +++ b/google/cloud/bigquery_reservation_v1/services/reservation_service/transports/grpc_asyncio.py @@ -974,5 +974,8 @@ def update_bi_reservation( ) return self._stubs["update_bi_reservation"] + def close(self): + return self.grpc_channel.close() + __all__ = ("ReservationServiceGrpcAsyncIOTransport",) diff --git a/google/cloud/bigquery_reservation_v1/types/reservation.py b/google/cloud/bigquery_reservation_v1/types/reservation.py index e409852a..8fa7bf94 100644 --- a/google/cloud/bigquery_reservation_v1/types/reservation.py +++ b/google/cloud/bigquery_reservation_v1/types/reservation.py @@ -732,6 +732,7 @@ class MoveAssignmentRequest(proto.Message): class BiReservation(proto.Message): r"""Represents a BI Reservation. + Attributes: name (str): The resource name of the singleton BI reservation. @@ -751,6 +752,7 @@ class BiReservation(proto.Message): class GetBiReservationRequest(proto.Message): r"""A request to get a singleton BI reservation. + Attributes: name (str): Required. Name of the requested reservation, for example: @@ -762,6 +764,7 @@ class GetBiReservationRequest(proto.Message): class UpdateBiReservationRequest(proto.Message): r"""A request to update a BI reservation. + Attributes: bi_reservation (google.cloud.bigquery_reservation_v1.types.BiReservation): A reservation to update. diff --git a/tests/unit/gapic/bigquery_reservation_v1/test_reservation_service.py b/tests/unit/gapic/bigquery_reservation_v1/test_reservation_service.py index 413e9eb5..0646fd10 100644 --- a/tests/unit/gapic/bigquery_reservation_v1/test_reservation_service.py +++ b/tests/unit/gapic/bigquery_reservation_v1/test_reservation_service.py @@ -29,6 +29,7 @@ from google.api_core import gapic_v1 from google.api_core import grpc_helpers from google.api_core import grpc_helpers_async +from google.api_core import path_template from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.cloud.bigquery_reservation_v1.services.reservation_service import ( @@ -6122,6 +6123,9 @@ def test_reservation_service_base_transport(): with pytest.raises(NotImplementedError): getattr(transport, method)(request=object()) + with pytest.raises(NotImplementedError): + transport.close() + @requires_google_auth_gte_1_25_0 def test_reservation_service_base_transport_with_credentials_file(): @@ -6706,3 +6710,49 @@ def test_client_withDEFAULT_CLIENT_INFO(): credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) + + +@pytest.mark.asyncio +async def test_transport_close_async(): + client = ReservationServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + ) + with mock.patch.object( + type(getattr(client.transport, "grpc_channel")), "close" + ) as close: + async with client: + close.assert_not_called() + close.assert_called_once() + + +def test_transport_close(): + transports = { + "grpc": "_grpc_channel", + } + + for transport, close_name in transports.items(): + client = ReservationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport + ) + with mock.patch.object( + type(getattr(client.transport, close_name)), "close" + ) as close: + with client: + close.assert_not_called() + close.assert_called_once() + + +def test_client_ctx(): + transports = [ + "grpc", + ] + for transport in transports: + client = ReservationServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport + ) + # Test client calls underlying transport. + with mock.patch.object(type(client.transport), "close") as close: + close.assert_not_called() + with client: + pass + close.assert_called() From 9005e8187bf166f7f66081a538f7ecdeeb4c5329 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 8 Oct 2021 17:16:35 +0000 Subject: [PATCH 09/10] chore(python): Add kokoro configs for python 3.10 samples testing (#177) --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/samples/python3.10/common.cfg | 40 ++++++++++++++++++++ .kokoro/samples/python3.10/continuous.cfg | 6 +++ .kokoro/samples/python3.10/periodic-head.cfg | 11 ++++++ .kokoro/samples/python3.10/periodic.cfg | 6 +++ .kokoro/samples/python3.10/presubmit.cfg | 6 +++ samples/snippets/noxfile.py | 2 +- 7 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 .kokoro/samples/python3.10/common.cfg create mode 100644 .kokoro/samples/python3.10/continuous.cfg create mode 100644 .kokoro/samples/python3.10/periodic-head.cfg create mode 100644 .kokoro/samples/python3.10/periodic.cfg create mode 100644 .kokoro/samples/python3.10/presubmit.cfg diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 76d0baa0..7d98291c 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4370ced27a324687ede5da07132dcdc5381993502a5e8a3e31e16dc631d026f0 + digest: sha256:58f73ba196b5414782605236dd0712a73541b44ff2ff4d3a36ec41092dd6fa5b diff --git a/.kokoro/samples/python3.10/common.cfg b/.kokoro/samples/python3.10/common.cfg new file mode 100644 index 00000000..56bc6d7f --- /dev/null +++ b/.kokoro/samples/python3.10/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.10" +} + +# Declare build specific Cloud project. +env_vars: { + key: "BUILD_SPECIFIC_GCLOUD_PROJECT" + value: "python-docs-samples-tests-310" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-bigquery-reservation/.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-bigquery-reservation/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.10/continuous.cfg b/.kokoro/samples/python3.10/continuous.cfg new file mode 100644 index 00000000..a1c8d975 --- /dev/null +++ b/.kokoro/samples/python3.10/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.10/periodic-head.cfg b/.kokoro/samples/python3.10/periodic-head.cfg new file mode 100644 index 00000000..2d95161c --- /dev/null +++ b/.kokoro/samples/python3.10/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-bigquery-reservation/.kokoro/test-samples-against-head.sh" +} diff --git a/.kokoro/samples/python3.10/periodic.cfg b/.kokoro/samples/python3.10/periodic.cfg new file mode 100644 index 00000000..71cd1e59 --- /dev/null +++ b/.kokoro/samples/python3.10/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.10/presubmit.cfg b/.kokoro/samples/python3.10/presubmit.cfg new file mode 100644 index 00000000..a1c8d975 --- /dev/null +++ b/.kokoro/samples/python3.10/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/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index 1fd8956f..93a9122c 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -87,7 +87,7 @@ def get_pytest_env_vars() -> Dict[str, str]: # DO NOT EDIT - automatically generated. # All versions used to test samples. -ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9"] +ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] # Any default versions that should be ignored. IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"] From 75e727d78e731e6a49eaf79222e4faa3e9ed1e03 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 12 Oct 2021 19:24:18 +0000 Subject: [PATCH 10/10] chore: release 1.4.0 (#176) :robot: I have created a release \*beep\* \*boop\* --- ## [1.4.0](https://www.github.com/googleapis/python-bigquery-reservation/compare/v1.3.1...v1.4.0) (2021-10-08) ### Features * add context manager support in client ([#175](https://www.github.com/googleapis/python-bigquery-reservation/issues/175)) ([80768c8](https://www.github.com/googleapis/python-bigquery-reservation/commit/80768c8009b8450a3ac3025c95683bcd0628ef35)) ### Bug Fixes * improper types in pagers generation ([ae65c70](https://www.github.com/googleapis/python-bigquery-reservation/commit/ae65c70bd91602ccb851167d27b4161ebd6c3bb3)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- CHANGELOG.md | 12 ++++++++++++ setup.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20980a1c..6a4eabe2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [1.4.0](https://www.github.com/googleapis/python-bigquery-reservation/compare/v1.3.1...v1.4.0) (2021-10-08) + + +### Features + +* add context manager support in client ([#175](https://www.github.com/googleapis/python-bigquery-reservation/issues/175)) ([80768c8](https://www.github.com/googleapis/python-bigquery-reservation/commit/80768c8009b8450a3ac3025c95683bcd0628ef35)) + + +### Bug Fixes + +* improper types in pagers generation ([ae65c70](https://www.github.com/googleapis/python-bigquery-reservation/commit/ae65c70bd91602ccb851167d27b4161ebd6c3bb3)) + ### [1.3.1](https://www.github.com/googleapis/python-bigquery-reservation/compare/v1.3.0...v1.3.1) (2021-09-24) diff --git a/setup.py b/setup.py index c36fc351..6ab3e24d 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ import os import setuptools # type: ignore -version = "1.3.1" +version = "1.4.0" package_root = os.path.abspath(os.path.dirname(__file__))