diff --git a/packages/google-cloud-kms/.github/.OwlBot.lock.yaml b/packages/google-cloud-kms/.github/.OwlBot.lock.yaml new file mode 100644 index 000000000000..29084e8a33af --- /dev/null +++ b/packages/google-cloud-kms/.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-kms/.github/.OwlBot.yaml b/packages/google-cloud-kms/.github/.OwlBot.yaml new file mode 100644 index 000000000000..573797656d83 --- /dev/null +++ b/packages/google-cloud-kms/.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/kms/(v.*)/.*-py/(.*) + dest: /owl-bot-staging/$1/$2 + +begin-after-commit-hash: b06c9034cfcbce180ba732d03be6526e5c8ea1bc + diff --git a/packages/google-cloud-kms/.github/header-checker-lint.yml b/packages/google-cloud-kms/.github/header-checker-lint.yml index fc281c05bd55..6fe78aa7987a 100644 --- a/packages/google-cloud-kms/.github/header-checker-lint.yml +++ b/packages/google-cloud-kms/.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-kms/.kokoro/release.sh b/packages/google-cloud-kms/.kokoro/release.sh index 5dae4fdc3877..478f9fc9a78a 100755 --- a/packages/google-cloud-kms/.kokoro/release.sh +++ b/packages/google-cloud-kms/.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-kms 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-kms/.kokoro/release/common.cfg b/packages/google-cloud-kms/.kokoro/release/common.cfg index 3be661ae4ae4..47754c534579 100644 --- a/packages/google-cloud-kms/.kokoro/release/common.cfg +++ b/packages/google-cloud-kms/.kokoro/release/common.cfg @@ -23,18 +23,8 @@ env_vars: { value: "github/python-kms/.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-kms/.pre-commit-config.yaml b/packages/google-cloud-kms/.pre-commit-config.yaml index 32302e4883a1..8912e9b5d7d7 100644 --- a/packages/google-cloud-kms/.pre-commit-config.yaml +++ b/packages/google-cloud-kms/.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-kms/docs/_static/custom.css b/packages/google-cloud-kms/docs/_static/custom.css index bcd37bbd3c4a..b0a295464b23 100644 --- a/packages/google-cloud-kms/docs/_static/custom.css +++ b/packages/google-cloud-kms/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-kms/docs/conf.py b/packages/google-cloud-kms/docs/conf.py index ecd6773b0746..718512b0d59f 100644 --- a/packages/google-cloud-kms/docs/conf.py +++ b/packages/google-cloud-kms/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-kms documentation build configuration file # diff --git a/packages/google-cloud-kms/synth.py b/packages/google-cloud-kms/owlbot.py similarity index 54% rename from packages/google-cloud-kms/synth.py rename to packages/google-cloud-kms/owlbot.py index 3478e18147ca..955fcf8ff480 100644 --- a/packages/google-cloud-kms/synth.py +++ b/packages/google-cloud-kms/owlbot.py @@ -21,56 +21,42 @@ logging.basicConfig(level=logging.DEBUG) -client_library_version = "0.1.0" - -gapic = gcp.GAPICBazel() common = gcp.CommonTemplates() -version = "v1" -# ---------------------------------------------------------------------------- -# Generate kms GAPIC layer -# ---------------------------------------------------------------------------- -library = gapic.py_library( - service="kms", - version=version, - bazel_target="//google/cloud/kms/v1:kms-v1-py", - include_protos=True, -) +default_version = "v1" -s.move(library, excludes=["README.rst", "setup.py", "nox*.py", "docs/index.rst"]) +for library in s.get_staging_dirs(default_version): + # Escape single '_' which RST treats as target names + s.replace(library / "google/**/resources.py", '''"(.*?)_((SIGN)|(DECRYPT))_"''', '''"\g<1>_\g<2>\_"''') -# Escape single '_' which RST treats as target names -s.replace("google/**/resources.py", '''"(.*?)_((SIGN)|(DECRYPT))_"''', '''"\g<1>_\g<2>\_"''') + # Docstrings of *_iam_policy() methods are formatted poorly and must be fixed + # in order to avoid docstring format warnings in docs. + s.replace(library / "google/**/*client.py", + r"(\s+)Args:", + "\n\g<1>Args:" + ) + s.replace(library / "google/**/*client.py", + r"(\s+)\*\*JSON Example\*\*\s+::", + "\n\g<1>**JSON Example**::\n", + ) + s.replace(library / "google/**/*client.py", + r"(\s+)\*\*YAML Example\*\*\s+::", + "\n\g<1>**YAML Example**::\n", + ) + s.replace(library / "google/**/*client.py", + r"(\s+)For a description of IAM and its features, see", + "\n\g<0>", + ) -# Docstrings of *_iam_policy() methods are formatted poorly and must be fixed -# in order to avoid docstring format warnings in docs. -s.replace( - "google/**/*client.py", - r"(\s+)Args:", - "\n\g<1>Args:" -) -s.replace( - "google/**/*client.py", - r"(\s+)\*\*JSON Example\*\*\s+::", - "\n\g<1>**JSON Example**::\n", -) -s.replace( - "google/**/*client.py", - r"(\s+)\*\*YAML Example\*\*\s+::", - "\n\g<1>**YAML Example**::\n", -) -s.replace( - "google/**/*client.py", - r"(\s+)For a description of IAM and its features, see", - "\n\g<0>", -) + # Rename `format_` to `format` to avoid breaking change + s.replace(library / "google/**/types/*.py", + "format_", + "format" + ) -# Rename `format_` to `format` to avoid breaking change -s.replace( - "google/**/types/*.py", - "format_", - "format" -) + s.move(library, excludes=["README.rst", "setup.py", "nox*.py", "docs/index.rst"]) + +s.remove_staging_dirs() # ---------------------------------------------------------------------------- # Add templated files diff --git a/packages/google-cloud-kms/renovate.json b/packages/google-cloud-kms/renovate.json index f08bc22c9a55..c04895563e69 100644 --- a/packages/google-cloud-kms/renovate.json +++ b/packages/google-cloud-kms/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-kms/synth.metadata b/packages/google-cloud-kms/synth.metadata deleted file mode 100644 index 50f537566bf7..000000000000 --- a/packages/google-cloud-kms/synth.metadata +++ /dev/null @@ -1,145 +0,0 @@ -{ - "sources": [ - { - "git": { - "name": ".", - "remote": "https://github.com/googleapis/python-kms.git", - "sha": "6d115ce1902e4306ba3e1d80de64a2424e47ef52" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "915925089600094e72e4bfa8cf586c170e6b7109", - "internalRef": "366152684" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "6d76df2138f8f841e5a5b9ac427f81def520c15f" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "6d76df2138f8f841e5a5b9ac427f81def520c15f" - } - } - ], - "destinations": [ - { - "client": { - "source": "googleapis", - "apiName": "kms", - "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/conf.py", - "docs/kms_v1/key_management_service.rst", - "docs/kms_v1/services.rst", - "docs/kms_v1/types.rst", - "docs/multiprocessing.rst", - "google/cloud/kms/__init__.py", - "google/cloud/kms/py.typed", - "google/cloud/kms_v1/__init__.py", - "google/cloud/kms_v1/proto/resources.proto", - "google/cloud/kms_v1/proto/service.proto", - "google/cloud/kms_v1/py.typed", - "google/cloud/kms_v1/services/__init__.py", - "google/cloud/kms_v1/services/key_management_service/__init__.py", - "google/cloud/kms_v1/services/key_management_service/async_client.py", - "google/cloud/kms_v1/services/key_management_service/client.py", - "google/cloud/kms_v1/services/key_management_service/pagers.py", - "google/cloud/kms_v1/services/key_management_service/transports/__init__.py", - "google/cloud/kms_v1/services/key_management_service/transports/base.py", - "google/cloud/kms_v1/services/key_management_service/transports/grpc.py", - "google/cloud/kms_v1/services/key_management_service/transports/grpc_asyncio.py", - "google/cloud/kms_v1/types/__init__.py", - "google/cloud/kms_v1/types/resources.py", - "google/cloud/kms_v1/types/service.py", - "mypy.ini", - "noxfile.py", - "renovate.json", - "samples/AUTHORING_GUIDE.md", - "samples/CONTRIBUTING.md", - "samples/snippets/README.md", - "scripts/decrypt-secrets.sh", - "scripts/fixup_kms_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/kms_v1/__init__.py", - "tests/unit/gapic/kms_v1/test_key_management_service.py" - ] -} \ No newline at end of file