Skip to content
Permalink
Browse files
chore: regenerate library (#104)
feat: add common resource helper methods

feat: add `from_service_account_info` to clients

fix: change default retry and timeout settings
  • Loading branch information
yoshi-automation committed Mar 19, 2021
1 parent 420eb87 commit 139e6e8511cdce4c0be7983520f7efc47092f3b1
Showing with 2,212 additions and 896 deletions.
  1. +1 −0 .flake8
  2. +15 −0 .github/header-checker-lint.yml
  3. +3 −1 .gitignore
  4. +20 −6 .kokoro/build.sh
  5. +1 −1 .kokoro/docs/common.cfg
  6. +11 −0 .kokoro/docs/docs-presubmit.cfg
  7. +43 −0 .kokoro/populate-secrets.sh
  8. +13 −37 .kokoro/release/common.cfg
  9. +6 −0 .kokoro/samples/python3.6/common.cfg
  10. +6 −0 .kokoro/samples/python3.7/common.cfg
  11. +6 −0 .kokoro/samples/python3.8/common.cfg
  12. +11 −5 .kokoro/test-samples.sh
  13. +10 −5 .kokoro/trampoline.sh
  14. +1 −1 .kokoro/trampoline_v2.sh
  15. +17 −0 .pre-commit-config.yaml
  16. +1 −0 .trampolinerc
  17. +87 −36 CODE_OF_CONDUCT.md
  18. +33 −29 CONTRIBUTING.rst
  19. +4 −3 LICENSE
  20. +2 −2 MANIFEST.in
  21. +6 −1 docs/_static/custom.css
  22. +5 −3 docs/conf.py
  23. +3 −3 docs/texttospeech_v1/services.rst
  24. +6 −0 docs/texttospeech_v1/text_to_speech.rst
  25. +2 −0 docs/texttospeech_v1/types.rst
  26. +3 −3 docs/texttospeech_v1beta1/services.rst
  27. +6 −0 docs/texttospeech_v1beta1/text_to_speech.rst
  28. +2 −0 docs/texttospeech_v1beta1/types.rst
  29. +110 −22 google/cloud/texttospeech_v1/services/text_to_speech/async_client.py
  30. +155 −49 google/cloud/texttospeech_v1/services/text_to_speech/client.py
  31. +0 −1 google/cloud/texttospeech_v1/services/text_to_speech/transports/__init__.py
  32. +23 −3 google/cloud/texttospeech_v1/services/text_to_speech/transports/base.py
  33. +61 −24 google/cloud/texttospeech_v1/services/text_to_speech/transports/grpc.py
  34. +61 −13 google/cloud/texttospeech_v1/services/text_to_speech/transports/grpc_asyncio.py
  35. +12 −9 google/cloud/texttospeech_v1/types/__init__.py
  36. +7 −7 google/cloud/texttospeech_v1/types/cloud_tts.py
  37. +92 −20 google/cloud/texttospeech_v1beta1/services/text_to_speech/async_client.py
  38. +155 −49 google/cloud/texttospeech_v1beta1/services/text_to_speech/client.py
  39. +0 −1 google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/__init__.py
  40. +1 −1 google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/base.py
  41. +61 −24 google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc.py
  42. +61 −13 google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc_asyncio.py
  43. +12 −9 google/cloud/texttospeech_v1beta1/types/__init__.py
  44. +11 −11 google/cloud/texttospeech_v1beta1/types/cloud_tts.py
  45. +40 −8 noxfile.py
  46. +2 −1 renovate.json
  47. +32 −9 samples/snippets/noxfile.py
  48. +14 −1 scripts/decrypt-secrets.sh
  49. +1 −0 scripts/fixup_texttospeech_v1_keywords.py
  50. +1 −0 scripts/fixup_texttospeech_v1beta1_keywords.py
  51. +8 −8 synth.metadata
  52. +8 −5 synth.py
  53. +15 −0 tests/unit/gapic/texttospeech_v1/__init__.py
  54. +465 −236 tests/unit/gapic/texttospeech_v1/test_text_to_speech.py
  55. +15 −0 tests/unit/gapic/texttospeech_v1beta1/__init__.py
  56. +465 −236 tests/unit/gapic/texttospeech_v1beta1/test_text_to_speech.py
@@ -26,6 +26,7 @@ exclude =
*_pb2.py

# Standard linting exemptions.
**/.nox/**
__pycache__,
.git,
*.pyc,
@@ -0,0 +1,15 @@
{"allowedCopyrightHolders": ["Google LLC"],
"allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"],
"ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt"],
"sourceFileExtensions": [
"ts",
"js",
"java",
"sh",
"Dockerfile",
"yaml",
"py",
"html",
"txt"
]
}
@@ -50,8 +50,10 @@ docs.metadata

# Virtual environment
env/

# Test logs
coverage.xml
sponge_log.xml
*sponge_log.xml

# System test environment variables.
system_tests/local_test_setup
@@ -15,7 +15,11 @@

set -eo pipefail

cd github/python-texttospeech
if [[ -z "${PROJECT_ROOT:-}" ]]; then
PROJECT_ROOT="github/python-texttospeech"
fi

cd "${PROJECT_ROOT}"

# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1
@@ -30,16 +34,26 @@ export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")

# Remove old nox
python3.6 -m pip uninstall --yes --quiet nox-automation
python3 -m pip uninstall --yes --quiet nox-automation

# Install nox
python3.6 -m pip install --upgrade --quiet nox
python3.6 -m nox --version
python3 -m pip install --upgrade --quiet nox
python3 -m nox --version

# If this is a continuous build, send the test log to the FlakyBot.
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then
cleanup() {
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
$KOKORO_GFILE_DIR/linux_amd64/flakybot
}
trap cleanup EXIT HUP
fi

# If NOX_SESSION is set, it only runs the specified session,
# otherwise run all the sessions.
if [[ -n "${NOX_SESSION:-}" ]]; then
python3.6 -m nox -s "${NOX_SESSION:-}"
python3 -m nox -s ${NOX_SESSION:-}
else
python3.6 -m nox
python3 -m nox
fi
@@ -30,7 +30,7 @@ env_vars: {

env_vars: {
key: "V2_STAGING_BUCKET"
value: "docs-staging-v2-staging"
value: "docs-staging-v2"
}

# It will upload the docker image after successful builds.
@@ -15,3 +15,14 @@ env_vars: {
key: "TRAMPOLINE_IMAGE_UPLOAD"
value: "false"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-texttospeech/.kokoro/build.sh"
}

# Only run this nox session.
env_vars: {
key: "NOX_SESSION"
value: "docs docfx"
}
@@ -0,0 +1,43 @@
#!/bin/bash
# Copyright 2020 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.

set -eo pipefail

function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;}
function msg { println "$*" >&2 ;}
function println { printf '%s\n' "$(now) $*" ;}


# Populates requested secrets set in SECRET_MANAGER_KEYS from service account:
# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com
SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager"
msg "Creating folder on disk for secrets: ${SECRET_LOCATION}"
mkdir -p ${SECRET_LOCATION}
for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g")
do
msg "Retrieving secret ${key}"
docker run --entrypoint=gcloud \
--volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \
gcr.io/google.com/cloudsdktool/cloud-sdk \
secrets versions access latest \
--project cloud-devrel-kokoro-resources \
--secret ${key} > \
"${SECRET_LOCATION}/${key}"
if [[ $? == 0 ]]; then
msg "Secret written to ${SECRET_LOCATION}/${key}"
else
msg "Error retrieving secret ${key}"
fi
done
@@ -23,42 +23,18 @@ env_vars: {
value: "github/python-texttospeech/.kokoro/release.sh"
}

# Fetch the token needed for reporting release status to GitHub
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "yoshi-automation-github-key"
}
}
}

# Fetch PyPI password
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "google_cloud_pypi_password"
}
}
}

# Fetch magictoken to use with Magic Github Proxy
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "releasetool-magictoken"
}
}
# Fetch PyPI password
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "google_cloud_pypi_password"
}
}
}

# Fetch api key to use with Magic Github Proxy
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "magic-github-proxy-api-key"
}
}
}
# 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"
}
@@ -13,6 +13,12 @@ env_vars: {
value: "py-3.6"
}

# Declare build specific Cloud project.
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "python-docs-samples-tests-py36"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-texttospeech/.kokoro/test-samples.sh"
@@ -13,6 +13,12 @@ env_vars: {
value: "py-3.7"
}

# Declare build specific Cloud project.
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "python-docs-samples-tests-py37"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-texttospeech/.kokoro/test-samples.sh"
@@ -13,6 +13,12 @@ env_vars: {
value: "py-3.8"
}

# Declare build specific Cloud project.
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "python-docs-samples-tests-py38"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-texttospeech/.kokoro/test-samples.sh"
@@ -28,6 +28,12 @@ if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
git checkout $LATEST_RELEASE
fi

# Exit early if samples directory doesn't exist
if [ ! -d "./samples" ]; then
echo "No tests run. `./samples` not found"
exit 0
fi

# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1

@@ -81,11 +87,11 @@ for file in samples/**/requirements.txt; do
python3.6 -m nox -s "$RUN_TESTS_SESSION"
EXIT=$?

# If this is a periodic build, send the test log to the Build Cop Bot.
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop.
# If this is a periodic build, send the test log to the FlakyBot.
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop
$KOKORO_GFILE_DIR/linux_amd64/buildcop
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
$KOKORO_GFILE_DIR/linux_amd64/flakybot
fi

if [[ $EXIT -ne 0 ]]; then
@@ -101,4 +107,4 @@ cd "$ROOT"
# Workaround for Kokoro permissions issue: delete secrets
rm testing/{test-env.sh,client-secrets.json,service-account.json}

exit "$RTN"
exit "$RTN"
@@ -15,9 +15,14 @@

set -eo pipefail

python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" || ret_code=$?
# Always run the cleanup script, regardless of the success of bouncing into
# the container.
function cleanup() {
chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh
${KOKORO_GFILE_DIR}/trampoline_cleanup.sh
echo "cleanup";
}
trap cleanup EXIT

chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh
${KOKORO_GFILE_DIR}/trampoline_cleanup.sh || true

exit ${ret_code}
$(dirname $0)/populate-secrets.sh # Secret Manager secrets.
python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py"
@@ -159,7 +159,7 @@ if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then
"KOKORO_GITHUB_COMMIT"
"KOKORO_GITHUB_PULL_REQUEST_NUMBER"
"KOKORO_GITHUB_PULL_REQUEST_COMMIT"
# For Build Cop Bot
# For FlakyBot
"KOKORO_GITHUB_COMMIT_URL"
"KOKORO_GITHUB_PULL_REQUEST_URL"
)
@@ -0,0 +1,17 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/psf/black
rev: 19.10b0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
hooks:
- id: flake8
@@ -24,6 +24,7 @@ required_envvars+=(
pass_down_envvars+=(
"STAGING_BUCKET"
"V2_STAGING_BUCKET"
"NOX_SESSION"
)

# Prevent unintentional override on the default image.
Loading

0 comments on commit 139e6e8

Please sign in to comment.