From c34ccc012fb0cd39dd9f88c14519397ede83106e Mon Sep 17 00:00:00 2001 From: Jeffrey Rennie Date: Wed, 7 Apr 2021 08:36:34 -0700 Subject: [PATCH] chore: migrate to owl-bot (#124) * chore: migrate to owl bot * chore: copy files from googleapis-gen ad5147b2c3694044935301527f68b951c2e1f419 * chore: run the post processor * fix: proper quotes owlbot.py Co-authored-by: Anthonios Partheniou Co-authored-by: Anthonios Partheniou --- .../.github/.OwlBot.lock.yaml | 4 + .../.github/.OwlBot.yaml | 26 ++++ .../{synth.py => owlbot.py} | 39 ++--- .../synth.metadata | 145 ------------------ 4 files changed, 45 insertions(+), 169 deletions(-) create mode 100644 packages/google-cloud-bigquery-datatransfer/.github/.OwlBot.lock.yaml create mode 100644 packages/google-cloud-bigquery-datatransfer/.github/.OwlBot.yaml rename packages/google-cloud-bigquery-datatransfer/{synth.py => owlbot.py} (66%) delete mode 100644 packages/google-cloud-bigquery-datatransfer/synth.metadata diff --git a/packages/google-cloud-bigquery-datatransfer/.github/.OwlBot.lock.yaml b/packages/google-cloud-bigquery-datatransfer/.github/.OwlBot.lock.yaml new file mode 100644 index 000000000000..9bdafee727d1 --- /dev/null +++ b/packages/google-cloud-bigquery-datatransfer/.github/.OwlBot.lock.yaml @@ -0,0 +1,4 @@ +docker: + digest: sha256:612842ba5ccf62b4e3983fe6dc453cf66883c74bc168aa62da7acaed1e2fdc93 + image: gcr.io/repo-automation-bots/owlbot-python:latest + diff --git a/packages/google-cloud-bigquery-datatransfer/.github/.OwlBot.yaml b/packages/google-cloud-bigquery-datatransfer/.github/.OwlBot.yaml new file mode 100644 index 000000000000..99839dbe7f3a --- /dev/null +++ b/packages/google-cloud-bigquery-datatransfer/.github/.OwlBot.yaml @@ -0,0 +1,26 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +docker: + image: gcr.io/repo-automation-bots/owlbot-python:latest + +deep-remove-regex: + - /owl-bot-staging + +deep-copy-regex: + - source: /google/cloud/bigquery/datatransfer/(v.*)/.*-py/(.*) + dest: /owl-bot-staging/$1/$2 + +begin-after-commit-hash: ad5147b2c3694044935301527f68b951c2e1f419 + diff --git a/packages/google-cloud-bigquery-datatransfer/synth.py b/packages/google-cloud-bigquery-datatransfer/owlbot.py similarity index 66% rename from packages/google-cloud-bigquery-datatransfer/synth.py rename to packages/google-cloud-bigquery-datatransfer/owlbot.py index f5e03032e132..87e7c517b200 100644 --- a/packages/google-cloud-bigquery-datatransfer/synth.py +++ b/packages/google-cloud-bigquery-datatransfer/owlbot.py @@ -20,25 +20,29 @@ from synthtool.languages import python -gapic = gcp.GAPICBazel() common = gcp.CommonTemplates() -versions = ["v1"] # ---------------------------------------------------------------------------- # Generate bigquery_datatransfer GAPIC layer # ---------------------------------------------------------------------------- -for version in versions: - library = gapic.py_library( - service="bigquery_datatransfer", - version=version, - bazel_target=( - f"//google/cloud/bigquery/datatransfer/{version}:" - "bigquery-datatransfer-v1-py" - ), - include_protos=True, +for library in s.get_staging_dirs("v1"): + # Fix missing async client in datatransfer_v1 + # https://github.com/googleapis/gapic-generator-python/issues/815 + s.replace( + library / "google/cloud/bigquery_datatransfer_v1/__init__.py", + r"from \.services\.data_transfer_service import DataTransferServiceClient", + "\\g<0>\nfrom .services.data_transfer_service import DataTransferServiceAsyncClient", ) + s.replace( + library / "google/cloud/bigquery_datatransfer_v1/__init__.py", + r"'DataTransferServiceClient',", + '\\g<0>\n "DataTransferServiceAsyncClient"', + ) + s.move(library, excludes=["*.tar.gz", "docs/index.rst", "README.rst", "setup.py"]) +s.remove_staging_dirs() + # ---------------------------------------------------------------------------- # Add templated files @@ -52,17 +56,4 @@ python.py_samples(skip_readmes=True) -# Fix missing async client in datatransfer_v1 -# https://github.com/googleapis/gapic-generator-python/issues/815 -s.replace( - "google/cloud/bigquery_datatransfer_v1/__init__.py", - r"from \.services\.data_transfer_service import DataTransferServiceClient", - "\\g<0>\nfrom .services.data_transfer_service import DataTransferServiceAsyncClient", -) -s.replace( - "google/cloud/bigquery_datatransfer_v1/__init__.py", - r"'DataTransferServiceClient',", - '\\g<0>\n "DataTransferServiceAsyncClient"', -) - s.shell.run(["nox", "-s", "blacken"], hide_output=False) diff --git a/packages/google-cloud-bigquery-datatransfer/synth.metadata b/packages/google-cloud-bigquery-datatransfer/synth.metadata deleted file mode 100644 index 56d0969bad15..000000000000 --- a/packages/google-cloud-bigquery-datatransfer/synth.metadata +++ /dev/null @@ -1,145 +0,0 @@ -{ - "sources": [ - { - "git": { - "name": ".", - "remote": "https://github.com/googleapis/python-bigquery-datatransfer.git", - "sha": "434c09fcb716d60b0854e260d5d1f396e3fbc775" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "c13fb8cb376bb666de80ed33e11550955b4357af", - "internalRef": "363304304" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "4501974ad08b5d693311457e2ea4ce845676e329" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "4501974ad08b5d693311457e2ea4ce845676e329" - } - } - ], - "destinations": [ - { - "client": { - "source": "googleapis", - "apiName": "bigquery_datatransfer", - "apiVersion": "v1", - "language": "python", - "generator": "bazel" - } - } - ], - "generatedFiles": [ - ".coveragerc", - ".flake8", - ".github/CONTRIBUTING.md", - ".github/ISSUE_TEMPLATE/bug_report.md", - ".github/ISSUE_TEMPLATE/feature_request.md", - ".github/ISSUE_TEMPLATE/support_request.md", - ".github/PULL_REQUEST_TEMPLATE.md", - ".github/header-checker-lint.yml", - ".github/release-please.yml", - ".github/snippet-bot.yml", - ".gitignore", - ".kokoro/build.sh", - ".kokoro/continuous/common.cfg", - ".kokoro/continuous/continuous.cfg", - ".kokoro/docker/docs/Dockerfile", - ".kokoro/docker/docs/fetch_gpg_keys.sh", - ".kokoro/docs/common.cfg", - ".kokoro/docs/docs-presubmit.cfg", - ".kokoro/docs/docs.cfg", - ".kokoro/populate-secrets.sh", - ".kokoro/presubmit/common.cfg", - ".kokoro/presubmit/presubmit.cfg", - ".kokoro/publish-docs.sh", - ".kokoro/release.sh", - ".kokoro/release/common.cfg", - ".kokoro/release/release.cfg", - ".kokoro/samples/lint/common.cfg", - ".kokoro/samples/lint/continuous.cfg", - ".kokoro/samples/lint/periodic.cfg", - ".kokoro/samples/lint/presubmit.cfg", - ".kokoro/samples/python3.6/common.cfg", - ".kokoro/samples/python3.6/continuous.cfg", - ".kokoro/samples/python3.6/periodic-head.cfg", - ".kokoro/samples/python3.6/periodic.cfg", - ".kokoro/samples/python3.6/presubmit.cfg", - ".kokoro/samples/python3.7/common.cfg", - ".kokoro/samples/python3.7/continuous.cfg", - ".kokoro/samples/python3.7/periodic-head.cfg", - ".kokoro/samples/python3.7/periodic.cfg", - ".kokoro/samples/python3.7/presubmit.cfg", - ".kokoro/samples/python3.8/common.cfg", - ".kokoro/samples/python3.8/continuous.cfg", - ".kokoro/samples/python3.8/periodic-head.cfg", - ".kokoro/samples/python3.8/periodic.cfg", - ".kokoro/samples/python3.8/presubmit.cfg", - ".kokoro/test-samples-against-head.sh", - ".kokoro/test-samples-impl.sh", - ".kokoro/test-samples.sh", - ".kokoro/trampoline.sh", - ".kokoro/trampoline_v2.sh", - ".pre-commit-config.yaml", - ".trampolinerc", - "CODE_OF_CONDUCT.md", - "CONTRIBUTING.rst", - "LICENSE", - "MANIFEST.in", - "docs/_static/custom.css", - "docs/_templates/layout.html", - "docs/bigquery_datatransfer_v1/data_transfer_service.rst", - "docs/bigquery_datatransfer_v1/services.rst", - "docs/bigquery_datatransfer_v1/types.rst", - "docs/conf.py", - "docs/multiprocessing.rst", - "google/cloud/bigquery_datatransfer/__init__.py", - "google/cloud/bigquery_datatransfer/py.typed", - "google/cloud/bigquery_datatransfer_v1/__init__.py", - "google/cloud/bigquery_datatransfer_v1/proto/datatransfer.proto", - "google/cloud/bigquery_datatransfer_v1/proto/transfer.proto", - "google/cloud/bigquery_datatransfer_v1/py.typed", - "google/cloud/bigquery_datatransfer_v1/services/__init__.py", - "google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/__init__.py", - "google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/async_client.py", - "google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/client.py", - "google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/pagers.py", - "google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/__init__.py", - "google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/base.py", - "google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/grpc.py", - "google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/grpc_asyncio.py", - "google/cloud/bigquery_datatransfer_v1/types/__init__.py", - "google/cloud/bigquery_datatransfer_v1/types/datatransfer.py", - "google/cloud/bigquery_datatransfer_v1/types/transfer.py", - "mypy.ini", - "noxfile.py", - "renovate.json", - "samples/AUTHORING_GUIDE.md", - "samples/CONTRIBUTING.md", - "samples/snippets/noxfile.py", - "scripts/decrypt-secrets.sh", - "scripts/fixup_bigquery_datatransfer_v1_keywords.py", - "scripts/readme-gen/readme_gen.py", - "scripts/readme-gen/templates/README.tmpl.rst", - "scripts/readme-gen/templates/auth.tmpl.rst", - "scripts/readme-gen/templates/auth_api_key.tmpl.rst", - "scripts/readme-gen/templates/install_deps.tmpl.rst", - "scripts/readme-gen/templates/install_portaudio.tmpl.rst", - "setup.cfg", - "testing/.gitignore", - "tests/unit/gapic/bigquery_datatransfer_v1/__init__.py", - "tests/unit/gapic/bigquery_datatransfer_v1/test_data_transfer_service.py" - ] -} \ No newline at end of file