feat!: regenerate with microgenerator #30
Changes from 21 commits
db28a44
a40dbfe
b28186f
c931646
e7d1a19
bb549ce
c1bc992
aa9f5a2
6f971b7
36a17cc
813736a
4f034dd
589de3e
182452b
0a205e4
b5c8f53
1f41343
4906ae3
b265df8
3d69b6c
35ec4c0
9130109
036d284
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this script included in this PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes: If you install the library it will be available on the command line. https://python-packaging.readthedocs.io/en/latest/command-line-scripts.html#the-scripts-keyword-argument |
||
|
||
* 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"}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a significant change in behavior. You might want to updated the docs too, at least a release note. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 Will follow up with the TW. |
||
``` | ||
|
||
### 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above: consider updating the documentation on cloud.google.com for all breaking changes. |
||
|
||
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") | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../UPGRADING.md |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@software-dov @telpirion Please review