diff --git a/packages/google-cloud-retail/.github/.OwlBot.lock.yaml b/packages/google-cloud-retail/.github/.OwlBot.lock.yaml new file mode 100644 index 000000000000..29084e8a33af --- /dev/null +++ b/packages/google-cloud-retail/.github/.OwlBot.lock.yaml @@ -0,0 +1,4 @@ +docker: + digest: sha256:cfc0e802701262c211703c468874d767f65dabe6a1a71d0e07bfc8a3d5175f32 + image: gcr.io/repo-automation-bots/owlbot-python:latest + diff --git a/packages/google-cloud-retail/.github/.OwlBot.yaml b/packages/google-cloud-retail/.github/.OwlBot.yaml new file mode 100644 index 000000000000..cfec631eefc9 --- /dev/null +++ b/packages/google-cloud-retail/.github/.OwlBot.yaml @@ -0,0 +1,30 @@ +# 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-preserve-regex: + - /owl-bot-staging/v2alpha + - /owl-bot-staging/v2beta + +deep-copy-regex: + - source: /google/cloud/retail/(v.*)/.*-py/(.*) + dest: /owl-bot-staging/$1/$2 + +begin-after-commit-hash: f0b479aa18206c41b6abae5660496cc696d843b2 + diff --git a/packages/google-cloud-retail/.github/header-checker-lint.yml b/packages/google-cloud-retail/.github/header-checker-lint.yml index fc281c05bd55..6fe78aa7987a 100644 --- a/packages/google-cloud-retail/.github/header-checker-lint.yml +++ b/packages/google-cloud-retail/.github/header-checker-lint.yml @@ -1,6 +1,6 @@ {"allowedCopyrightHolders": ["Google LLC"], "allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"], - "ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt"], + "ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt", "**/__init__.py", "samples/**/constraints.txt", "samples/**/constraints-test.txt"], "sourceFileExtensions": [ "ts", "js", diff --git a/packages/google-cloud-retail/.kokoro/release.sh b/packages/google-cloud-retail/.kokoro/release.sh index ce8a6fa5bcda..9cd18f5985f8 100755 --- a/packages/google-cloud-retail/.kokoro/release.sh +++ b/packages/google-cloud-retail/.kokoro/release.sh @@ -26,7 +26,7 @@ python3 -m pip install --upgrade twine wheel setuptools export PYTHONUNBUFFERED=1 # Move into the package, build the distribution and upload. -TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google_cloud_pypi_password") +TWINE_PASSWORD=$(cat "${KOKORO_GFILE_DIR}/secret_manager/google-cloud-pypi-token") cd github/python-retail python3 setup.py sdist bdist_wheel -twine upload --username gcloudpypi --password "${TWINE_PASSWORD}" dist/* +twine upload --username __token__ --password "${TWINE_PASSWORD}" dist/* diff --git a/packages/google-cloud-retail/.kokoro/release/common.cfg b/packages/google-cloud-retail/.kokoro/release/common.cfg index 359c3f5df862..17afc7b29c06 100644 --- a/packages/google-cloud-retail/.kokoro/release/common.cfg +++ b/packages/google-cloud-retail/.kokoro/release/common.cfg @@ -23,18 +23,8 @@ env_vars: { value: "github/python-retail/.kokoro/release.sh" } -# Fetch PyPI password -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "google_cloud_pypi_password" - } - } -} - # Tokens needed to report release status back to GitHub env_vars: { key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" -} \ No newline at end of file + value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem,google-cloud-pypi-token" +} diff --git a/packages/google-cloud-retail/.pre-commit-config.yaml b/packages/google-cloud-retail/.pre-commit-config.yaml index 32302e4883a1..8912e9b5d7d7 100644 --- a/packages/google-cloud-retail/.pre-commit-config.yaml +++ b/packages/google-cloud-retail/.pre-commit-config.yaml @@ -1,3 +1,17 @@ +# 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. +# # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: diff --git a/packages/google-cloud-retail/docs/_static/custom.css b/packages/google-cloud-retail/docs/_static/custom.css index bcd37bbd3c4a..b0a295464b23 100644 --- a/packages/google-cloud-retail/docs/_static/custom.css +++ b/packages/google-cloud-retail/docs/_static/custom.css @@ -1,9 +1,20 @@ div#python2-eol { border-color: red; border-width: medium; -} +} /* Ensure minimum width for 'Parameters' / 'Returns' column */ dl.field-list > dt { min-width: 100px } + +/* Insert space between methods for readability */ +dl.method { + padding-top: 10px; + padding-bottom: 10px +} + +/* Insert empty space between classes */ +dl.class { + padding-bottom: 50px +} diff --git a/packages/google-cloud-retail/docs/conf.py b/packages/google-cloud-retail/docs/conf.py index 805eeecc1b7f..992143502c70 100644 --- a/packages/google-cloud-retail/docs/conf.py +++ b/packages/google-cloud-retail/docs/conf.py @@ -1,4 +1,17 @@ # -*- coding: utf-8 -*- +# 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. # # google-cloud-retail documentation build configuration file # diff --git a/packages/google-cloud-retail/google/cloud/retail_v2/__init__.py b/packages/google-cloud-retail/google/cloud/retail_v2/__init__.py index 2bf18a46174b..0ba7c13ed6c7 100644 --- a/packages/google-cloud-retail/google/cloud/retail_v2/__init__.py +++ b/packages/google-cloud-retail/google/cloud/retail_v2/__init__.py @@ -64,6 +64,7 @@ __all__ = ( "BigQuerySource", "Catalog", + "CatalogServiceClient", "CollectUserEventRequest", "CreateProductRequest", "CustomAttribute", @@ -102,8 +103,7 @@ "UserEventImportSummary", "UserEventInlineSource", "UserEventInputConfig", - "UserEventServiceClient", "UserInfo", "WriteUserEventRequest", - "CatalogServiceClient", + "UserEventServiceClient", ) diff --git a/packages/google-cloud-retail/synth.py b/packages/google-cloud-retail/owlbot.py similarity index 71% rename from packages/google-cloud-retail/synth.py rename to packages/google-cloud-retail/owlbot.py index cebc0799b977..29be2e8bbe76 100644 --- a/packages/google-cloud-retail/synth.py +++ b/packages/google-cloud-retail/owlbot.py @@ -20,22 +20,15 @@ import synthtool.gcp as gcp from synthtool.languages import python -gapic = gcp.GAPICBazel() common = gcp.CommonTemplates() -# ---------------------------------------------------------------------------- -# Generate retail GAPIC layer -# ---------------------------------------------------------------------------- -versions = ["v2"] -for version in versions: - library = gapic.py_library( - service="retail", - version=version, - bazel_target=f"//google/cloud/retail/{version}:retail-{version}-py", - ) +default_version = "v2" +for library in s.get_staging_dirs(default_version): s.move(library, excludes=["setup.py", "README.rst", "docs/index.rst"]) +s.remove_staging_dirs() + # ---------------------------------------------------------------------------- # Add templated files # ---------------------------------------------------------------------------- @@ -45,4 +38,4 @@ templated_files, excludes=[".coveragerc"] # the microgenerator has a good coveragerc file ) -s.shell.run(["nox", "-s", "blacken"], hide_output=False) \ No newline at end of file +s.shell.run(["nox", "-s", "blacken"], hide_output=False) diff --git a/packages/google-cloud-retail/renovate.json b/packages/google-cloud-retail/renovate.json index f08bc22c9a55..c04895563e69 100644 --- a/packages/google-cloud-retail/renovate.json +++ b/packages/google-cloud-retail/renovate.json @@ -2,5 +2,8 @@ "extends": [ "config:base", ":preserveSemverRanges" ], - "ignorePaths": [".pre-commit-config.yaml"] + "ignorePaths": [".pre-commit-config.yaml"], + "pip_requirements": { + "fileMatch": ["requirements-test.txt", "samples/[\\S/]*constraints.txt", "samples/[\\S/]*constraints-test.txt"] + } } diff --git a/packages/google-cloud-retail/synth.metadata b/packages/google-cloud-retail/synth.metadata deleted file mode 100644 index 6ae3ec7418d1..000000000000 --- a/packages/google-cloud-retail/synth.metadata +++ /dev/null @@ -1,175 +0,0 @@ -{ - "sources": [ - { - "git": { - "name": ".", - "remote": "https://github.com/googleapis/python-retail.git", - "sha": "06190f897dd5fb5f5dd8f9f787bad65f43f2ea14" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "c2bdbfa6f7423369da902a5faaa86bfd213b5169", - "internalRef": "364696134" - } - }, - { - "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": "retail", - "apiVersion": "v2", - "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/conf.py", - "docs/multiprocessing.rst", - "docs/retail_v2/catalog_service.rst", - "docs/retail_v2/prediction_service.rst", - "docs/retail_v2/product_service.rst", - "docs/retail_v2/services.rst", - "docs/retail_v2/types.rst", - "docs/retail_v2/user_event_service.rst", - "google/cloud/retail/__init__.py", - "google/cloud/retail/py.typed", - "google/cloud/retail_v2/__init__.py", - "google/cloud/retail_v2/py.typed", - "google/cloud/retail_v2/services/__init__.py", - "google/cloud/retail_v2/services/catalog_service/__init__.py", - "google/cloud/retail_v2/services/catalog_service/async_client.py", - "google/cloud/retail_v2/services/catalog_service/client.py", - "google/cloud/retail_v2/services/catalog_service/pagers.py", - "google/cloud/retail_v2/services/catalog_service/transports/__init__.py", - "google/cloud/retail_v2/services/catalog_service/transports/base.py", - "google/cloud/retail_v2/services/catalog_service/transports/grpc.py", - "google/cloud/retail_v2/services/catalog_service/transports/grpc_asyncio.py", - "google/cloud/retail_v2/services/prediction_service/__init__.py", - "google/cloud/retail_v2/services/prediction_service/async_client.py", - "google/cloud/retail_v2/services/prediction_service/client.py", - "google/cloud/retail_v2/services/prediction_service/transports/__init__.py", - "google/cloud/retail_v2/services/prediction_service/transports/base.py", - "google/cloud/retail_v2/services/prediction_service/transports/grpc.py", - "google/cloud/retail_v2/services/prediction_service/transports/grpc_asyncio.py", - "google/cloud/retail_v2/services/product_service/__init__.py", - "google/cloud/retail_v2/services/product_service/async_client.py", - "google/cloud/retail_v2/services/product_service/client.py", - "google/cloud/retail_v2/services/product_service/transports/__init__.py", - "google/cloud/retail_v2/services/product_service/transports/base.py", - "google/cloud/retail_v2/services/product_service/transports/grpc.py", - "google/cloud/retail_v2/services/product_service/transports/grpc_asyncio.py", - "google/cloud/retail_v2/services/user_event_service/__init__.py", - "google/cloud/retail_v2/services/user_event_service/async_client.py", - "google/cloud/retail_v2/services/user_event_service/client.py", - "google/cloud/retail_v2/services/user_event_service/transports/__init__.py", - "google/cloud/retail_v2/services/user_event_service/transports/base.py", - "google/cloud/retail_v2/services/user_event_service/transports/grpc.py", - "google/cloud/retail_v2/services/user_event_service/transports/grpc_asyncio.py", - "google/cloud/retail_v2/types/__init__.py", - "google/cloud/retail_v2/types/catalog.py", - "google/cloud/retail_v2/types/catalog_service.py", - "google/cloud/retail_v2/types/common.py", - "google/cloud/retail_v2/types/import_config.py", - "google/cloud/retail_v2/types/prediction_service.py", - "google/cloud/retail_v2/types/product.py", - "google/cloud/retail_v2/types/product_service.py", - "google/cloud/retail_v2/types/purge_config.py", - "google/cloud/retail_v2/types/user_event.py", - "google/cloud/retail_v2/types/user_event_service.py", - "mypy.ini", - "noxfile.py", - "renovate.json", - "scripts/decrypt-secrets.sh", - "scripts/fixup_retail_v2_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/retail_v2/__init__.py", - "tests/unit/gapic/retail_v2/test_catalog_service.py", - "tests/unit/gapic/retail_v2/test_prediction_service.py", - "tests/unit/gapic/retail_v2/test_product_service.py", - "tests/unit/gapic/retail_v2/test_user_event_service.py" - ] -} \ No newline at end of file