Skip to content
Permalink
Browse files
feat!: regenerate with microgenerator (#30)
BREAKING CHANGE: This commit has breaking changes.

For help migrating your code, see UPGRADING.md.
  • Loading branch information
busunkim96 committed Jun 1, 2020
1 parent 65f903b commit 3181b55733da7aecde37009a0dd77117434deceb
Showing with 3,695 additions and 4,494 deletions.
  1. +7 −24 .coveragerc
  2. +3 −1 .flake8
  3. +2 −0 .gitignore
  4. +0 −2 .kokoro/publish-docs.sh
  5. +0 −2 .kokoro/release.sh
  6. +17 −3 .kokoro/test-samples.sh
  7. +3 −0 MANIFEST.in
  8. +2 −0 README.rst
  9. +151 −0 UPGRADING.md
  10. +1 −0 docs/UPGRADING.md
  11. +0 −30 docs/api.rst
  12. +0 −6 docs/gapic/v1/api.rst
  13. +0 −5 docs/gapic/v1/types.rst
  14. +0 −6 docs/gapic/v1beta1/api.rst
  15. +0 −5 docs/gapic/v1beta1/types.rst
  16. +35 −7 docs/index.rst
  17. +7 −0 docs/multiprocessing.rst
  18. +6 −0 docs/texttospeech_v1/services.rst
  19. +5 −0 docs/texttospeech_v1/types.rst
  20. +6 −0 docs/texttospeech_v1beta1/services.rst
  21. +5 −0 docs/texttospeech_v1beta1/types.rst
  22. +45 −0 google/cloud/texttospeech/__init__.py
  23. +2 −0 google/cloud/texttospeech/py.typed
  24. +29 −26 google/cloud/texttospeech_v1/__init__.py
  25. +0 −63 google/cloud/texttospeech_v1/gapic/enums.py
  26. +0 −323 google/cloud/texttospeech_v1/gapic/text_to_speech_client.py
  27. +0 −33 google/cloud/texttospeech_v1/gapic/text_to_speech_client_config.py
  28. +0 −135 google/cloud/texttospeech_v1/gapic/transports/text_to_speech_grpc_transport.py
  29. 0 google/cloud/texttospeech_v1/proto/__init__.py
  30. +0 −254 google/cloud/texttospeech_v1/proto/cloud_tts.proto
  31. +0 −976 google/cloud/texttospeech_v1/proto/cloud_tts_pb2.py
  32. +0 −67 google/cloud/texttospeech_v1/proto/cloud_tts_pb2_grpc.py
  33. +2 −0 google/cloud/texttospeech_v1/py.typed
  34. +3 −12 google/cloud/{texttospeech.py → texttospeech_v1/services/__init__.py}
  35. +7 −9 google/{ → cloud/texttospeech_v1/services/text_to_speech}/__init__.py
  36. +369 −0 google/cloud/texttospeech_v1/services/text_to_speech/client.py
  37. +30 −0 google/cloud/texttospeech_v1/services/text_to_speech/transports/__init__.py
  38. +76 −0 google/cloud/texttospeech_v1/services/text_to_speech/transports/base.py
  39. +212 −0 google/cloud/texttospeech_v1/services/text_to_speech/transports/grpc.py
  40. +0 −43 google/cloud/texttospeech_v1/types.py
  41. +39 −0 google/cloud/texttospeech_v1/types/__init__.py
  42. +265 −0 google/cloud/texttospeech_v1/types/cloud_tts.py
  43. +29 −26 google/cloud/texttospeech_v1beta1/__init__.py
  44. 0 google/cloud/texttospeech_v1beta1/gapic/__init__.py
  45. +0 −63 google/cloud/texttospeech_v1beta1/gapic/enums.py
  46. +0 −325 google/cloud/texttospeech_v1beta1/gapic/text_to_speech_client.py
  47. +0 −33 google/cloud/texttospeech_v1beta1/gapic/text_to_speech_client_config.py
  48. 0 google/cloud/texttospeech_v1beta1/gapic/transports/__init__.py
  49. +0 −135 google/cloud/texttospeech_v1beta1/gapic/transports/text_to_speech_grpc_transport.py
  50. 0 google/cloud/texttospeech_v1beta1/proto/__init__.py
  51. +0 −254 google/cloud/texttospeech_v1beta1/proto/cloud_tts.proto
  52. +0 −976 google/cloud/texttospeech_v1beta1/proto/cloud_tts_pb2.py
  53. +0 −67 google/cloud/texttospeech_v1beta1/proto/cloud_tts_pb2_grpc.py
  54. +2 −0 google/cloud/texttospeech_v1beta1/py.typed
  55. +16 −0 google/cloud/texttospeech_v1beta1/services/__init__.py
  56. +7 −9 google/cloud/{ → texttospeech_v1beta1/services/text_to_speech}/__init__.py
  57. +369 −0 google/cloud/texttospeech_v1beta1/services/text_to_speech/client.py
  58. +30 −0 google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/__init__.py
  59. +76 −0 google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/base.py
  60. +212 −0 google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc.py
  61. +0 −43 google/cloud/texttospeech_v1beta1/types.py
  62. +39 −0 google/cloud/texttospeech_v1beta1/types/__init__.py
  63. +265 −0 google/cloud/texttospeech_v1beta1/types/cloud_tts.py
  64. +3 −0 mypy.ini
  65. +11 −7 noxfile.py
  66. +1 −0 samples/snippets/.gitignore
  67. +20 −18 samples/snippets/audio_profile.py
  68. +4 −5 samples/snippets/audio_profile_test.py
  69. +9 −8 samples/snippets/list_voices.py
  70. +3 −3 samples/snippets/list_voices_test.py
  71. +13 −15 samples/snippets/noxfile.py
  72. +12 −9 samples/snippets/quickstart.py
  73. +21 −15 samples/snippets/ssml_addresses.py
  74. +5 −5 samples/snippets/ssml_addresses_test.py
  75. +35 −25 samples/snippets/synthesize_file.py
  76. +6 −6 samples/snippets/synthesize_file_test.py
  77. +39 −25 samples/snippets/synthesize_text.py
  78. +6 −6 samples/snippets/synthesize_text_test.py
  79. +11 −4 scripts/decrypt-secrets.sh
  80. +178 −0 scripts/fixup_keywords.py
  81. +11 −6 setup.py
  82. +5 −5 synth.metadata
  83. +22 −19 synth.py
  84. +0 −38 tests/system/v1/test_system_tts_v1.py
  85. +0 −40 tests/system/v1beta1/test_system_tts_v1beta1.py
  86. +0 −136 tests/unit/gapic/v1/test_text_to_speech_client_v1.py
  87. +0 −136 tests/unit/gapic/v1beta1/test_text_to_speech_client_v1beta1.py
  88. 0 {google/cloud/texttospeech_v1/gapic → tests/unit/texttospeech_v1}/__init__.py
  89. +453 −0 tests/unit/texttospeech_v1/test_text_to_speech.py
  90. 0 {google/cloud/texttospeech_v1/gapic/transports → tests/unit/texttospeech_v1beta1}/__init__.py
  91. +453 −0 tests/unit/texttospeech_v1beta1/test_text_to_speech.py
@@ -1,35 +1,18 @@
# -*- coding: utf-8 -*-
#
# 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
#
# https://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.

# Generated by synthtool. DO NOT EDIT!
[run]
branch = True

[report]
fail_under = 100
show_missing = True
omit =
google/cloud/texttospeech/__init__.py
exclude_lines =
# Re-enable the standard pragma
pragma: NO COVER
# Ignore debug-only repr
def __repr__
# Ignore abstract methods
raise NotImplementedError
omit =
*/gapic/*.py
*/proto/*.py
*/core/*.py
*/site-packages/*.py
# Ignore pkg_resources exceptions.
# This is added at the module level as a safeguard for if someone
# generates the code and tries to run it without pip installing. This
# makes it virtually impossible to test properly.
except pkg_resources.DistributionNotFound
@@ -16,11 +16,13 @@

# Generated by synthtool. DO NOT EDIT!
[flake8]
ignore = E203, E266, E501, W503
ignore = E203, E266, E501, W503, F401, F841
exclude =
# Exclude generated code.
**/proto/**
**/gapic/**
**/services/**
**/types/**
*_pb2.py

# Standard linting exemptions.
@@ -10,6 +10,7 @@
dist
build
eggs
.eggs
parts
bin
var
@@ -49,6 +50,7 @@ bigquery/docs/generated
# Virtual environment
env/
coverage.xml
sponge_log.xml

# System test environment variables.
system_tests/local_test_setup
@@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/bin/bash

set -eo pipefail

# Disable buffering, so that the logs stream through.
@@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/bin/bash

set -eo pipefail

# Start the releasetool reporter
@@ -37,12 +37,26 @@ env | grep KOKORO
# Install nox
python3.6 -m pip install --upgrade --quiet nox

# Unencrypt and extract secrets
SECRETS_PASSWORD=$(cat "${KOKORO_GFILE_DIR}/secrets-password.txt")
./scripts/decrypt-secrets.sh "${SECRETS_PASSWORD}"
# Use secrets acessor service account to get secrets
if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then
gcloud auth activate-service-account \
--key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \
--project="cloud-devrel-kokoro-resources"
fi

# This script will create 3 files:
# - testing/test-env.sh
# - testing/service-account.json
# - testing/client-secrets.json
./scripts/decrypt-secrets.sh

source ./testing/test-env.sh
export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json

# For cloud-run session, we activate the service account for gcloud sdk.
gcloud auth activate-service-account \
--key-file "${GOOGLE_APPLICATION_CREDENTIALS}"

export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json

echo -e "\n******************** TESTING PROJECTS ********************"
@@ -20,3 +20,6 @@ recursive-include google *.json *.proto
recursive-include tests *
global-exclude *.py[co]
global-exclude __pycache__

# Exclude scripts for samples readmegen
prune scripts/readme-gen
@@ -56,6 +56,8 @@ Deprecated Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^^
Python == 2.7. Python 2.7 support will be removed on January 1, 2020.

The last version of this library compatible with Python 2.7 is google-cloud-texttospeech==1.0.1.


Mac/Linux
^^^^^^^^^
@@ -0,0 +1,151 @@
# 2.0.0 Migration Guide

The 2.0 release of the `google-cloud-texttospeech` client is a significant upgrade based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-python), and includes substantial interface changes. Existing code written for earlier versions of this library will likely require updates to use this version. This document describes the changes that have been made, and what you need to do to update your usage.

If you experience issues or have questions, please file an [issue](https://github.com/googleapis/python-texttospeech/issues).

## Supported Python Versions

> **WARNING**: Breaking change
The 2.0.0 release requires Python 3.6+.


## Method Calls

> **WARNING**: Breaking change
Methods expect request objects. We provide a script that will convert most common use cases.

* Install the library

```py
python3 -m pip install google-cloud-texttospeech
```

* The script `fixup_keywords.py` is shipped with the library. It expects
an input directory (with the code to convert) and an empty destination directory.

```sh
$ fixup_keywords.py --input-directory .samples/ --output-directory samples/
```

**Before:**
```py
from google.cloud import texttospeech
client = texttospeech.TextToSpeechClient()
voices = client.list_voices(language_code="no")
```


**After:**
```py
from google.cloud import texttospeech
client = texttospeech.TextToSpeechClient()
voices = client.list_voices(request={"language_code": "no"})
```

### More Details

In `google-cloud-texttospeech<2.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters.

**Before:**
```py
def synthesize_speech(
self,
input_,
voice,
audio_config,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
```

In the 2.0.0 release, all methods have a single positional parameter `request`. Method docstrings indicate whether a parameter is required or optional.

Some methods have additional keyword only parameters. The available parameters depend on the [`google.api.method_signature` annotation](https://github.com/googleapis/googleapis/blob/master/google/cloud/texttospeech/v1/cloud_tts.proto#L53) specified by the API producer.


**After:**
```py
def synthesize_speech(
self,
request: cloud_tts.SynthesizeSpeechRequest = None,
*,
input: cloud_tts.SynthesisInput = None,
voice: cloud_tts.VoiceSelectionParams = None,
audio_config: cloud_tts.AudioConfig = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> cloud_tts.SynthesizeSpeechResponse:
```

> **NOTE:** The `request` parameter and flattened keyword parameters for the API are mutually exclusive.
> Passing both will result in an error.

Both of these calls are valid:

```py
response = client.synthesize_speech(
request={
"input": input_text,
"voice": voice,
"audio_config": audio_config
}
)
```

```py
response = client.synthesize_speech(
input=input_text,
voice=voice,
audio_config=audio_config
)
```

This call is invalid because it mixes `request` with a keyword argument `audio_config`. Executing this code
will result in an error.

```py
response = client.synthesize_speech(
request={
"input": input_text,
"voice": voice,
},
audio_config=audio_config
)
```



## Enums and Types


> **WARNING**: Breaking change
The submodules `enums` and `types` have been removed.

**Before:**
```py
from google.cloud import texttospeech
encoding = texttospeech.enums.AudioEncoding.MP3
voice = texttospeech.types.VoiceSelectionParams(language_code="en-US")
```


**After:**
```py
from google.cloud import texttospeech
encoding = texttospeech.AudioEncoding.MP3
voice = texttospeech.VoiceSelectionParams(language_code="en-US")
```

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 3181b55

Please sign in to comment.