From a2a534ceccbad9114cb30599129eb168ab60cb5f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 26 Nov 2022 10:22:46 -0500 Subject: [PATCH] chore: Update gapic-generator-python to v1.6.1 (#342) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update to gapic-generator-python 1.5.0 feat: add support for `google.cloud..__version__` PiperOrigin-RevId: 484665853 Source-Link: https://github.com/googleapis/googleapis/commit/8eb249a19db926c2fbc4ecf1dc09c0e521a88b22 Source-Link: https://github.com/googleapis/googleapis-gen/commit/c8aa327b5f478865fc3fd91e3c2768e54e26ad44 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzhhYTMyN2I1ZjQ3ODg2NWZjM2ZkOTFlM2MyNzY4ZTU0ZTI2YWQ0NCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update version in gapic_version.py * add .release-please-manifest.json with correct version * add owlbot.py to exclude generated gapic_version.py * set manifest to true in .github/release-please.yml * add release-please-config.json * chore: Update to gapic-generator-python 1.6.0 feat(python): Add typing to proto.Message based class attributes feat(python): Snippetgen handling of repeated enum field PiperOrigin-RevId: 487326846 Source-Link: https://github.com/googleapis/googleapis/commit/da380c77bb87ba0f752baf07605dd1db30e1f7e1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/61ef5762ee6731a0cbbfea22fd0eecee51ab1c8e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjFlZjU3NjJlZTY3MzFhMGNiYmZlYTIyZmQwZWVjZWU1MWFiMWM4ZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: new APIs added to reflect updates to the filestore service - Add ENTERPRISE Tier - Add snapshot APIs: RevertInstance, ListSnapshots, CreateSnapshot, DeleteSnapshot, UpdateSnapshot - Add multi-share APIs: ListShares, GetShare, CreateShare, DeleteShare, UpdateShare - Add ConnectMode to NetworkConfig (for Private Service Access support) - New status codes (SUSPENDED/SUSPENDING, REVERTING/RESUMING) - Add SuspensionReason (for KMS related suspension) - Add new fields to Instance information: max_capacity_gb, capacity_step_size_gb, max_share_count, capacity_gb, multi_share_enabled PiperOrigin-RevId: 487492758 Source-Link: https://github.com/googleapis/googleapis/commit/5be5981f50322cf0c7388595e0f31ac5d0693469 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab0e217f560cc2c1afc11441c2eab6b6950efd2b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWIwZTIxN2Y1NjBjYzJjMWFmYzExNDQxYzJlYWI2YjY5NTBlZmQyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update path to snippet metadata json * chore: Update gapic-generator-python to v1.6.1 PiperOrigin-RevId: 488036204 Source-Link: https://github.com/googleapis/googleapis/commit/08f275f5c1c0d99056e1cb68376323414459ee19 Source-Link: https://github.com/googleapis/googleapis-gen/commit/555c0945e60649e38739ae64bc45719cdf72178f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTU1YzA5NDVlNjA2NDllMzg3MzlhZTY0YmM0NTcxOWNkZjcyMTc4ZiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .github/release-please.yml | 1 + .release-please-manifest.json | 3 + docs/texttospeech_v1/types.rst | 1 - docs/texttospeech_v1beta1/types.rst | 1 - google/cloud/texttospeech/__init__.py | 4 ++ google/cloud/texttospeech/gapic_version.py | 16 +++++ google/cloud/texttospeech_v1/__init__.py | 4 ++ .../services/text_to_speech/async_client.py | 36 ++++++---- .../services/text_to_speech/client.py | 38 ++++++---- .../text_to_speech/transports/base.py | 2 +- .../text_to_speech/transports/grpc.py | 20 +++--- .../text_to_speech/transports/grpc_asyncio.py | 16 ++--- .../cloud/texttospeech_v1/types/cloud_tts.py | 56 ++++++++------- google/cloud/texttospeech_v1beta1/__init__.py | 4 ++ .../services/text_to_speech/async_client.py | 36 ++++++---- .../services/text_to_speech/client.py | 38 ++++++---- .../text_to_speech/transports/base.py | 2 +- .../text_to_speech/transports/grpc.py | 20 +++--- .../text_to_speech/transports/grpc_asyncio.py | 16 ++--- .../texttospeech_v1beta1/types/cloud_tts.py | 70 ++++++++++--------- owlbot.py | 56 +++++++++++++++ release-please-config.json | 28 ++++++++ ...etadata_google.cloud.texttospeech.v1.json} | 3 +- ...ta_google.cloud.texttospeech.v1beta1.json} | 3 +- setup.py | 62 +++++++--------- testing/constraints-3.10.txt | 6 ++ testing/constraints-3.11.txt | 6 ++ testing/constraints-3.7.txt | 9 ++- testing/constraints-3.8.txt | 6 ++ testing/constraints-3.9.txt | 6 ++ 30 files changed, 372 insertions(+), 197 deletions(-) create mode 100644 .release-please-manifest.json create mode 100644 google/cloud/texttospeech/gapic_version.py create mode 100644 owlbot.py create mode 100644 release-please-config.json rename samples/generated_samples/{snippet_metadata_texttospeech_v1.json => snippet_metadata_google.cloud.texttospeech.v1.json} (99%) rename samples/generated_samples/{snippet_metadata_texttospeech_v1beta1.json => snippet_metadata_google.cloud.texttospeech.v1beta1.json} (99%) diff --git a/.github/release-please.yml b/.github/release-please.yml index 29601ad4..fe749ff6 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,5 +1,6 @@ releaseType: python handleGHRelease: true +manifest: true # NOTE: this section is generated by synthtool.languages.python # See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py branches: diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..10d7e57d --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "2.12.3" +} diff --git a/docs/texttospeech_v1/types.rst b/docs/texttospeech_v1/types.rst index 646ebdc9..bfe32192 100644 --- a/docs/texttospeech_v1/types.rst +++ b/docs/texttospeech_v1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Texttospeech v1 API .. automodule:: google.cloud.texttospeech_v1.types :members: - :undoc-members: :show-inheritance: diff --git a/docs/texttospeech_v1beta1/types.rst b/docs/texttospeech_v1beta1/types.rst index 0306c6cd..57ba4be8 100644 --- a/docs/texttospeech_v1beta1/types.rst +++ b/docs/texttospeech_v1beta1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Texttospeech v1beta1 API .. automodule:: google.cloud.texttospeech_v1beta1.types :members: - :undoc-members: :show-inheritance: diff --git a/google/cloud/texttospeech/__init__.py b/google/cloud/texttospeech/__init__.py index 9b09ec2f..ea6e9364 100644 --- a/google/cloud/texttospeech/__init__.py +++ b/google/cloud/texttospeech/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.texttospeech import gapic_version as package_version + +__version__ = package_version.__version__ + from google.cloud.texttospeech_v1.services.text_to_speech.async_client import ( TextToSpeechAsyncClient, diff --git a/google/cloud/texttospeech/gapic_version.py b/google/cloud/texttospeech/gapic_version.py new file mode 100644 index 00000000..e0546e8c --- /dev/null +++ b/google/cloud/texttospeech/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +__version__ = "2.12.3" # {x-release-please-version} diff --git a/google/cloud/texttospeech_v1/__init__.py b/google/cloud/texttospeech_v1/__init__.py index 8d191f15..5507eda3 100644 --- a/google/cloud/texttospeech_v1/__init__.py +++ b/google/cloud/texttospeech_v1/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.texttospeech import gapic_version as package_version + +__version__ = package_version.__version__ + from .services.text_to_speech import TextToSpeechAsyncClient, TextToSpeechClient from .types.cloud_tts import ( diff --git a/google/cloud/texttospeech_v1/services/text_to_speech/async_client.py b/google/cloud/texttospeech_v1/services/text_to_speech/async_client.py index c243fbc1..db5f0a80 100644 --- a/google/cloud/texttospeech_v1/services/text_to_speech/async_client.py +++ b/google/cloud/texttospeech_v1/services/text_to_speech/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -154,9 +164,9 @@ def transport(self) -> TextToSpeechTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, TextToSpeechTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the text to speech client. @@ -200,11 +210,11 @@ def __init__( async def list_voices( self, - request: Union[cloud_tts.ListVoicesRequest, dict] = None, + request: Optional[Union[cloud_tts.ListVoicesRequest, dict]] = None, *, - language_code: str = None, + language_code: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cloud_tts.ListVoicesResponse: r"""Returns a list of Voice supported for synthesis. @@ -235,7 +245,7 @@ async def sample_list_voices(): print(response) Args: - request (Union[google.cloud.texttospeech_v1.types.ListVoicesRequest, dict]): + request (Optional[Union[google.cloud.texttospeech_v1.types.ListVoicesRequest, dict]]): The request object. The top-level message sent by the client for the `ListVoices` method. language_code (:class:`str`): @@ -302,13 +312,13 @@ async def sample_list_voices(): async def synthesize_speech( self, - request: Union[cloud_tts.SynthesizeSpeechRequest, dict] = None, + request: Optional[Union[cloud_tts.SynthesizeSpeechRequest, dict]] = None, *, - input: cloud_tts.SynthesisInput = None, - voice: cloud_tts.VoiceSelectionParams = None, - audio_config: cloud_tts.AudioConfig = None, + input: Optional[cloud_tts.SynthesisInput] = None, + voice: Optional[cloud_tts.VoiceSelectionParams] = None, + audio_config: Optional[cloud_tts.AudioConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cloud_tts.SynthesizeSpeechResponse: r"""Synthesizes speech synchronously: receive results @@ -352,7 +362,7 @@ async def sample_synthesize_speech(): print(response) Args: - request (Union[google.cloud.texttospeech_v1.types.SynthesizeSpeechRequest, dict]): + request (Optional[Union[google.cloud.texttospeech_v1.types.SynthesizeSpeechRequest, dict]]): The request object. The top-level message sent by the client for the `SynthesizeSpeech` method. input (:class:`google.cloud.texttospeech_v1.types.SynthesisInput`): diff --git a/google/cloud/texttospeech_v1/services/text_to_speech/client.py b/google/cloud/texttospeech_v1/services/text_to_speech/client.py index 4ad59c0b..673140d8 100644 --- a/google/cloud/texttospeech_v1/services/text_to_speech/client.py +++ b/google/cloud/texttospeech_v1/services/text_to_speech/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -55,7 +66,7 @@ class TextToSpeechClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[TextToSpeechTransport]: """Returns an appropriate transport class. @@ -330,8 +341,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, TextToSpeechTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, TextToSpeechTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the text to speech client. @@ -345,7 +356,7 @@ def __init__( transport (Union[str, TextToSpeechTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -375,6 +386,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -427,11 +439,11 @@ def __init__( def list_voices( self, - request: Union[cloud_tts.ListVoicesRequest, dict] = None, + request: Optional[Union[cloud_tts.ListVoicesRequest, dict]] = None, *, - language_code: str = None, + language_code: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cloud_tts.ListVoicesResponse: r"""Returns a list of Voice supported for synthesis. @@ -529,13 +541,13 @@ def sample_list_voices(): def synthesize_speech( self, - request: Union[cloud_tts.SynthesizeSpeechRequest, dict] = None, + request: Optional[Union[cloud_tts.SynthesizeSpeechRequest, dict]] = None, *, - input: cloud_tts.SynthesisInput = None, - voice: cloud_tts.VoiceSelectionParams = None, - audio_config: cloud_tts.AudioConfig = None, + input: Optional[cloud_tts.SynthesisInput] = None, + voice: Optional[cloud_tts.VoiceSelectionParams] = None, + audio_config: Optional[cloud_tts.AudioConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cloud_tts.SynthesizeSpeechResponse: r"""Synthesizes speech synchronously: receive results diff --git a/google/cloud/texttospeech_v1/services/text_to_speech/transports/base.py b/google/cloud/texttospeech_v1/services/text_to_speech/transports/base.py index 93ee86f7..70c446b7 100644 --- a/google/cloud/texttospeech_v1/services/text_to_speech/transports/base.py +++ b/google/cloud/texttospeech_v1/services/text_to_speech/transports/base.py @@ -48,7 +48,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/texttospeech_v1/services/text_to_speech/transports/grpc.py b/google/cloud/texttospeech_v1/services/text_to_speech/transports/grpc.py index a6edeb47..3d240bbd 100644 --- a/google/cloud/texttospeech_v1/services/text_to_speech/transports/grpc.py +++ b/google/cloud/texttospeech_v1/services/text_to_speech/transports/grpc.py @@ -46,14 +46,14 @@ def __init__( self, *, host: str = "texttospeech.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -180,8 +180,8 @@ def __init__( def create_channel( cls, host: str = "texttospeech.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/texttospeech_v1/services/text_to_speech/transports/grpc_asyncio.py b/google/cloud/texttospeech_v1/services/text_to_speech/transports/grpc_asyncio.py index e7d304cd..54ff277d 100644 --- a/google/cloud/texttospeech_v1/services/text_to_speech/transports/grpc_asyncio.py +++ b/google/cloud/texttospeech_v1/services/text_to_speech/transports/grpc_asyncio.py @@ -48,7 +48,7 @@ class TextToSpeechGrpcAsyncIOTransport(TextToSpeechTransport): def create_channel( cls, host: str = "texttospeech.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -91,15 +91,15 @@ def __init__( self, *, host: str = "texttospeech.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/texttospeech_v1/types/cloud_tts.py b/google/cloud/texttospeech_v1/types/cloud_tts.py index b70b7515..d4bef357 100644 --- a/google/cloud/texttospeech_v1/types/cloud_tts.py +++ b/google/cloud/texttospeech_v1/types/cloud_tts.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -72,7 +74,7 @@ class ListVoicesRequest(proto.Message): (Norwegian Bokmal) voices will be returned. """ - language_code = proto.Field( + language_code: str = proto.Field( proto.STRING, number=1, ) @@ -82,11 +84,11 @@ class ListVoicesResponse(proto.Message): r"""The message returned to the client by the ``ListVoices`` method. Attributes: - voices (Sequence[google.cloud.texttospeech_v1.types.Voice]): + voices (MutableSequence[google.cloud.texttospeech_v1.types.Voice]): The list of voices. """ - voices = proto.RepeatedField( + voices: MutableSequence["Voice"] = proto.RepeatedField( proto.MESSAGE, number=1, message="Voice", @@ -97,7 +99,7 @@ class Voice(proto.Message): r"""Description of a voice supported by the TTS service. Attributes: - language_codes (Sequence[str]): + language_codes (MutableSequence[str]): The languages that this voice supports, expressed as `BCP-47 `__ language tags (e.g. "en-US", "es-419", "cmn-tw"). @@ -111,20 +113,20 @@ class Voice(proto.Message): voice. """ - language_codes = proto.RepeatedField( + language_codes: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=2, ) - ssml_gender = proto.Field( + ssml_gender: "SsmlVoiceGender" = proto.Field( proto.ENUM, number=3, enum="SsmlVoiceGender", ) - natural_sample_rate_hertz = proto.Field( + natural_sample_rate_hertz: int = proto.Field( proto.INT32, number=4, ) @@ -146,17 +148,17 @@ class SynthesizeSpeechRequest(proto.Message): synthesized audio. """ - input = proto.Field( + input: "SynthesisInput" = proto.Field( proto.MESSAGE, number=1, message="SynthesisInput", ) - voice = proto.Field( + voice: "VoiceSelectionParams" = proto.Field( proto.MESSAGE, number=2, message="VoiceSelectionParams", ) - audio_config = proto.Field( + audio_config: "AudioConfig" = proto.Field( proto.MESSAGE, number=3, message="AudioConfig", @@ -191,12 +193,12 @@ class SynthesisInput(proto.Message): This field is a member of `oneof`_ ``input_source``. """ - text = proto.Field( + text: str = proto.Field( proto.STRING, number=1, oneof="input_source", ) - ssml = proto.Field( + ssml: str = proto.Field( proto.STRING, number=2, oneof="input_source", @@ -239,20 +241,20 @@ class VoiceSelectionParams(proto.Message): the custom voice matching the specified configuration. """ - language_code = proto.Field( + language_code: str = proto.Field( proto.STRING, number=1, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=2, ) - ssml_gender = proto.Field( + ssml_gender: "SsmlVoiceGender" = proto.Field( proto.ENUM, number=3, enum="SsmlVoiceGender", ) - custom_voice = proto.Field( + custom_voice: "CustomVoiceParams" = proto.Field( proto.MESSAGE, number=4, message="CustomVoiceParams", @@ -297,7 +299,7 @@ class AudioConfig(proto.Message): quality), unless the specified sample rate is not supported for the encoding chosen, in which case it will fail the request and return [google.rpc.Code.INVALID_ARGUMENT][]. - effects_profile_id (Sequence[str]): + effects_profile_id (MutableSequence[str]): Optional. Input only. An identifier which selects 'audio effects' profiles that are applied on (post synthesized) text to speech. Effects are applied on top of each other in @@ -306,28 +308,28 @@ class AudioConfig(proto.Message): for current supported profile ids. """ - audio_encoding = proto.Field( + audio_encoding: "AudioEncoding" = proto.Field( proto.ENUM, number=1, enum="AudioEncoding", ) - speaking_rate = proto.Field( + speaking_rate: float = proto.Field( proto.DOUBLE, number=2, ) - pitch = proto.Field( + pitch: float = proto.Field( proto.DOUBLE, number=3, ) - volume_gain_db = proto.Field( + volume_gain_db: float = proto.Field( proto.DOUBLE, number=4, ) - sample_rate_hertz = proto.Field( + sample_rate_hertz: int = proto.Field( proto.INT32, number=5, ) - effects_profile_id = proto.RepeatedField( + effects_profile_id: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=6, ) @@ -354,11 +356,11 @@ class ReportedUsage(proto.Enum): REALTIME = 1 OFFLINE = 2 - model = proto.Field( + model: str = proto.Field( proto.STRING, number=1, ) - reported_usage = proto.Field( + reported_usage: ReportedUsage = proto.Field( proto.ENUM, number=3, enum=ReportedUsage, @@ -379,7 +381,7 @@ class SynthesizeSpeechResponse(proto.Message): representations use base64. """ - audio_content = proto.Field( + audio_content: bytes = proto.Field( proto.BYTES, number=1, ) diff --git a/google/cloud/texttospeech_v1beta1/__init__.py b/google/cloud/texttospeech_v1beta1/__init__.py index c7a1e4dd..6447f1a0 100644 --- a/google/cloud/texttospeech_v1beta1/__init__.py +++ b/google/cloud/texttospeech_v1beta1/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.texttospeech import gapic_version as package_version + +__version__ = package_version.__version__ + from .services.text_to_speech import TextToSpeechAsyncClient, TextToSpeechClient from .types.cloud_tts import ( diff --git a/google/cloud/texttospeech_v1beta1/services/text_to_speech/async_client.py b/google/cloud/texttospeech_v1beta1/services/text_to_speech/async_client.py index fdadf885..eaa05e1a 100644 --- a/google/cloud/texttospeech_v1beta1/services/text_to_speech/async_client.py +++ b/google/cloud/texttospeech_v1beta1/services/text_to_speech/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -154,9 +164,9 @@ def transport(self) -> TextToSpeechTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, TextToSpeechTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the text to speech client. @@ -200,11 +210,11 @@ def __init__( async def list_voices( self, - request: Union[cloud_tts.ListVoicesRequest, dict] = None, + request: Optional[Union[cloud_tts.ListVoicesRequest, dict]] = None, *, - language_code: str = None, + language_code: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cloud_tts.ListVoicesResponse: r"""Returns a list of Voice supported for synthesis. @@ -235,7 +245,7 @@ async def sample_list_voices(): print(response) Args: - request (Union[google.cloud.texttospeech_v1beta1.types.ListVoicesRequest, dict]): + request (Optional[Union[google.cloud.texttospeech_v1beta1.types.ListVoicesRequest, dict]]): The request object. The top-level message sent by the client for the `ListVoices` method. language_code (:class:`str`): @@ -302,13 +312,13 @@ async def sample_list_voices(): async def synthesize_speech( self, - request: Union[cloud_tts.SynthesizeSpeechRequest, dict] = None, + request: Optional[Union[cloud_tts.SynthesizeSpeechRequest, dict]] = None, *, - input: cloud_tts.SynthesisInput = None, - voice: cloud_tts.VoiceSelectionParams = None, - audio_config: cloud_tts.AudioConfig = None, + input: Optional[cloud_tts.SynthesisInput] = None, + voice: Optional[cloud_tts.VoiceSelectionParams] = None, + audio_config: Optional[cloud_tts.AudioConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cloud_tts.SynthesizeSpeechResponse: r"""Synthesizes speech synchronously: receive results @@ -352,7 +362,7 @@ async def sample_synthesize_speech(): print(response) Args: - request (Union[google.cloud.texttospeech_v1beta1.types.SynthesizeSpeechRequest, dict]): + request (Optional[Union[google.cloud.texttospeech_v1beta1.types.SynthesizeSpeechRequest, dict]]): The request object. The top-level message sent by the client for the `SynthesizeSpeech` method. input (:class:`google.cloud.texttospeech_v1beta1.types.SynthesisInput`): diff --git a/google/cloud/texttospeech_v1beta1/services/text_to_speech/client.py b/google/cloud/texttospeech_v1beta1/services/text_to_speech/client.py index c67467d3..b4e0d902 100644 --- a/google/cloud/texttospeech_v1beta1/services/text_to_speech/client.py +++ b/google/cloud/texttospeech_v1beta1/services/text_to_speech/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -55,7 +66,7 @@ class TextToSpeechClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[TextToSpeechTransport]: """Returns an appropriate transport class. @@ -330,8 +341,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, TextToSpeechTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, TextToSpeechTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the text to speech client. @@ -345,7 +356,7 @@ def __init__( transport (Union[str, TextToSpeechTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -375,6 +386,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -427,11 +439,11 @@ def __init__( def list_voices( self, - request: Union[cloud_tts.ListVoicesRequest, dict] = None, + request: Optional[Union[cloud_tts.ListVoicesRequest, dict]] = None, *, - language_code: str = None, + language_code: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cloud_tts.ListVoicesResponse: r"""Returns a list of Voice supported for synthesis. @@ -529,13 +541,13 @@ def sample_list_voices(): def synthesize_speech( self, - request: Union[cloud_tts.SynthesizeSpeechRequest, dict] = None, + request: Optional[Union[cloud_tts.SynthesizeSpeechRequest, dict]] = None, *, - input: cloud_tts.SynthesisInput = None, - voice: cloud_tts.VoiceSelectionParams = None, - audio_config: cloud_tts.AudioConfig = None, + input: Optional[cloud_tts.SynthesisInput] = None, + voice: Optional[cloud_tts.VoiceSelectionParams] = None, + audio_config: Optional[cloud_tts.AudioConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> cloud_tts.SynthesizeSpeechResponse: r"""Synthesizes speech synchronously: receive results diff --git a/google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/base.py b/google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/base.py index c3e04552..d36ad9af 100644 --- a/google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/base.py +++ b/google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/base.py @@ -48,7 +48,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc.py b/google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc.py index b09b5817..5f793aa4 100644 --- a/google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc.py +++ b/google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc.py @@ -46,14 +46,14 @@ def __init__( self, *, host: str = "texttospeech.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -180,8 +180,8 @@ def __init__( def create_channel( cls, host: str = "texttospeech.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc_asyncio.py b/google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc_asyncio.py index 43974466..37536b83 100644 --- a/google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc_asyncio.py +++ b/google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc_asyncio.py @@ -48,7 +48,7 @@ class TextToSpeechGrpcAsyncIOTransport(TextToSpeechTransport): def create_channel( cls, host: str = "texttospeech.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -91,15 +91,15 @@ def __init__( self, *, host: str = "texttospeech.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/texttospeech_v1beta1/types/cloud_tts.py b/google/cloud/texttospeech_v1beta1/types/cloud_tts.py index 786961c5..e0b6dcb1 100644 --- a/google/cloud/texttospeech_v1beta1/types/cloud_tts.py +++ b/google/cloud/texttospeech_v1beta1/types/cloud_tts.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -74,7 +76,7 @@ class ListVoicesRequest(proto.Message): (Norwegian Bokmal) voices will be returned. """ - language_code = proto.Field( + language_code: str = proto.Field( proto.STRING, number=1, ) @@ -84,11 +86,11 @@ class ListVoicesResponse(proto.Message): r"""The message returned to the client by the ``ListVoices`` method. Attributes: - voices (Sequence[google.cloud.texttospeech_v1beta1.types.Voice]): + voices (MutableSequence[google.cloud.texttospeech_v1beta1.types.Voice]): The list of voices. """ - voices = proto.RepeatedField( + voices: MutableSequence["Voice"] = proto.RepeatedField( proto.MESSAGE, number=1, message="Voice", @@ -99,7 +101,7 @@ class Voice(proto.Message): r"""Description of a voice supported by the TTS service. Attributes: - language_codes (Sequence[str]): + language_codes (MutableSequence[str]): The languages that this voice supports, expressed as `BCP-47 `__ language tags (e.g. "en-US", "es-419", "cmn-tw"). @@ -113,20 +115,20 @@ class Voice(proto.Message): voice. """ - language_codes = proto.RepeatedField( + language_codes: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=2, ) - ssml_gender = proto.Field( + ssml_gender: "SsmlVoiceGender" = proto.Field( proto.ENUM, number=3, enum="SsmlVoiceGender", ) - natural_sample_rate_hertz = proto.Field( + natural_sample_rate_hertz: int = proto.Field( proto.INT32, number=4, ) @@ -146,7 +148,7 @@ class SynthesizeSpeechRequest(proto.Message): audio_config (google.cloud.texttospeech_v1beta1.types.AudioConfig): Required. The configuration of the synthesized audio. - enable_time_pointing (Sequence[google.cloud.texttospeech_v1beta1.types.SynthesizeSpeechRequest.TimepointType]): + enable_time_pointing (MutableSequence[google.cloud.texttospeech_v1beta1.types.SynthesizeSpeechRequest.TimepointType]): Whether and what timepoints are returned in the response. """ @@ -158,22 +160,22 @@ class TimepointType(proto.Enum): TIMEPOINT_TYPE_UNSPECIFIED = 0 SSML_MARK = 1 - input = proto.Field( + input: "SynthesisInput" = proto.Field( proto.MESSAGE, number=1, message="SynthesisInput", ) - voice = proto.Field( + voice: "VoiceSelectionParams" = proto.Field( proto.MESSAGE, number=2, message="VoiceSelectionParams", ) - audio_config = proto.Field( + audio_config: "AudioConfig" = proto.Field( proto.MESSAGE, number=3, message="AudioConfig", ) - enable_time_pointing = proto.RepeatedField( + enable_time_pointing: MutableSequence[TimepointType] = proto.RepeatedField( proto.ENUM, number=4, enum=TimepointType, @@ -208,12 +210,12 @@ class SynthesisInput(proto.Message): This field is a member of `oneof`_ ``input_source``. """ - text = proto.Field( + text: str = proto.Field( proto.STRING, number=1, oneof="input_source", ) - ssml = proto.Field( + ssml: str = proto.Field( proto.STRING, number=2, oneof="input_source", @@ -256,20 +258,20 @@ class VoiceSelectionParams(proto.Message): the custom voice matching the specified configuration. """ - language_code = proto.Field( + language_code: str = proto.Field( proto.STRING, number=1, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=2, ) - ssml_gender = proto.Field( + ssml_gender: "SsmlVoiceGender" = proto.Field( proto.ENUM, number=3, enum="SsmlVoiceGender", ) - custom_voice = proto.Field( + custom_voice: "CustomVoiceParams" = proto.Field( proto.MESSAGE, number=4, message="CustomVoiceParams", @@ -314,7 +316,7 @@ class AudioConfig(proto.Message): quality), unless the specified sample rate is not supported for the encoding chosen, in which case it will fail the request and return [google.rpc.Code.INVALID_ARGUMENT][]. - effects_profile_id (Sequence[str]): + effects_profile_id (MutableSequence[str]): Optional. Input only. An identifier which selects 'audio effects' profiles that are applied on (post synthesized) text to speech. Effects are applied on top of each other in @@ -323,28 +325,28 @@ class AudioConfig(proto.Message): for current supported profile ids. """ - audio_encoding = proto.Field( + audio_encoding: "AudioEncoding" = proto.Field( proto.ENUM, number=1, enum="AudioEncoding", ) - speaking_rate = proto.Field( + speaking_rate: float = proto.Field( proto.DOUBLE, number=2, ) - pitch = proto.Field( + pitch: float = proto.Field( proto.DOUBLE, number=3, ) - volume_gain_db = proto.Field( + volume_gain_db: float = proto.Field( proto.DOUBLE, number=4, ) - sample_rate_hertz = proto.Field( + sample_rate_hertz: int = proto.Field( proto.INT32, number=5, ) - effects_profile_id = proto.RepeatedField( + effects_profile_id: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=6, ) @@ -371,11 +373,11 @@ class ReportedUsage(proto.Enum): REALTIME = 1 OFFLINE = 2 - model = proto.Field( + model: str = proto.Field( proto.STRING, number=1, ) - reported_usage = proto.Field( + reported_usage: ReportedUsage = proto.Field( proto.ENUM, number=3, enum=ReportedUsage, @@ -394,7 +396,7 @@ class SynthesizeSpeechResponse(proto.Message): include the WAV header. Note: as with all bytes fields, protobuffers use a pure binary representation, whereas JSON representations use base64. - timepoints (Sequence[google.cloud.texttospeech_v1beta1.types.Timepoint]): + timepoints (MutableSequence[google.cloud.texttospeech_v1beta1.types.Timepoint]): A link between a position in the original request input and a corresponding time in the output audio. It's only supported via ```` of SSML input. @@ -402,16 +404,16 @@ class SynthesizeSpeechResponse(proto.Message): The audio metadata of ``audio_content``. """ - audio_content = proto.Field( + audio_content: bytes = proto.Field( proto.BYTES, number=1, ) - timepoints = proto.RepeatedField( + timepoints: MutableSequence["Timepoint"] = proto.RepeatedField( proto.MESSAGE, number=2, message="Timepoint", ) - audio_config = proto.Field( + audio_config: "AudioConfig" = proto.Field( proto.MESSAGE, number=4, message="AudioConfig", @@ -431,11 +433,11 @@ class Timepoint(proto.Message): synthesized audio. """ - mark_name = proto.Field( + mark_name: str = proto.Field( proto.STRING, number=4, ) - time_seconds = proto.Field( + time_seconds: float = proto.Field( proto.DOUBLE, number=3, ) diff --git a/owlbot.py b/owlbot.py new file mode 100644 index 00000000..ce738f01 --- /dev/null +++ b/owlbot.py @@ -0,0 +1,56 @@ +# Copyright 2022 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. + +import json +from pathlib import Path +import shutil + +import synthtool as s +import synthtool.gcp as gcp +from synthtool.languages import python + +# ---------------------------------------------------------------------------- +# Copy the generated client from the owl-bot staging directory +# ---------------------------------------------------------------------------- + +clean_up_generated_samples = True + +# Load the default version defined in .repo-metadata.json. +default_version = json.load(open(".repo-metadata.json", "rt")).get( + "default_version" +) + +for library in s.get_staging_dirs(default_version): + if clean_up_generated_samples: + shutil.rmtree("samples/generated_samples", ignore_errors=True) + clean_up_generated_samples = False + s.move([library], excludes=["**/gapic_version.py"]) +s.remove_staging_dirs() + +# ---------------------------------------------------------------------------- +# Add templated files +# ---------------------------------------------------------------------------- + +templated_files = gcp.CommonTemplates().py_library( + cov_level=100, + microgenerator=True, + versions=gcp.common.detect_versions(path="./google", default_first=True), +) +s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml"]) + +python.py_samples(skip_readmes=True) + +# run format session for all directories which have a noxfile +for noxfile in Path(".").glob("**/noxfile.py"): + s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False) diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..25daa576 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,28 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "python", + "extra-files": [ + "google/cloud/texttospeech/gapic_version.py", + { + "type": "json", + "path": "samples/generated_samples/snippet_metadata_google.cloud.texttospeech.v1.json", + "jsonpath": "$.clientLibrary.version" + }, + { + "type": "json", + "path": "samples/generated_samples/snippet_metadata_google.cloud.texttospeech.v1beta1.json", + "jsonpath": "$.clientLibrary.version" + } + ] + } + }, + "release-type": "python", + "plugins": [ + { + "type": "sentence-case" + } + ], + "initial-version": "0.1.0" +} diff --git a/samples/generated_samples/snippet_metadata_texttospeech_v1.json b/samples/generated_samples/snippet_metadata_google.cloud.texttospeech.v1.json similarity index 99% rename from samples/generated_samples/snippet_metadata_texttospeech_v1.json rename to samples/generated_samples/snippet_metadata_google.cloud.texttospeech.v1.json index c86ca0f9..5aa209bd 100644 --- a/samples/generated_samples/snippet_metadata_texttospeech_v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.texttospeech.v1.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-texttospeech" + "name": "google-cloud-texttospeech", + "version": "0.1.0" }, "snippets": [ { diff --git a/samples/generated_samples/snippet_metadata_texttospeech_v1beta1.json b/samples/generated_samples/snippet_metadata_google.cloud.texttospeech.v1beta1.json similarity index 99% rename from samples/generated_samples/snippet_metadata_texttospeech_v1beta1.json rename to samples/generated_samples/snippet_metadata_google.cloud.texttospeech.v1beta1.json index f76802ab..a338941c 100644 --- a/samples/generated_samples/snippet_metadata_texttospeech_v1beta1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.texttospeech.v1beta1.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-texttospeech" + "name": "google-cloud-texttospeech", + "version": "0.1.0" }, "snippets": [ { diff --git a/setup.py b/setup.py index ff386677..fd43160b 100644 --- a/setup.py +++ b/setup.py @@ -1,17 +1,5 @@ -# Copyright 2018 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. -# Copyright 2018 Google LLC +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,31 +12,37 @@ # 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. - +# import io import os -import setuptools +import setuptools # type: ignore -# Package metadata. +package_root = os.path.abspath(os.path.dirname(__file__)) name = "google-cloud-texttospeech" -description = "Google Cloud Text-to-Speech API client library" -version = "2.12.3" -# Should be one of: -# 'Development Status :: 3 - Alpha' -# 'Development Status :: 4 - Beta' -# 'Development Status :: 5 - Production/Stable' -release_status = "Development Status :: 5 - Production/Stable" + + +description = "Google Cloud Texttospeech API client library" + +version = {} +with open( + os.path.join(package_root, "google/cloud/texttospeech/gapic_version.py") +) as fp: + exec(fp.read(), version) +version = version["__version__"] + +if version[0] == "0": + release_status = "Development Status :: 4 - Beta" +else: + release_status = "Development Status :: 5 - Production/Stable" + dependencies = [ - "google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", + "google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", "proto-plus >= 1.22.0, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] -extras = {} - - -# Setup boilerplate below this line. +url = "https://github.com/googleapis/python-texttospeech" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -56,20 +50,16 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() -# Only include packages under the 'google' namespace. Do not include tests, -# benchmarks, etc. packages = [ package for package in setuptools.PEP420PackageFinder.find() if package.startswith("google") ] -# Determine which namespaces are needed. namespaces = ["google"] if "google.cloud" in packages: namespaces.append("google.cloud") - setuptools.setup( name=name, version=version, @@ -78,7 +68,7 @@ author="Google LLC", author_email="googleapis-packages@google.com", license="Apache 2.0", - url="https://github.com/googleapis/python-texttospeech", + url=url, classifiers=[ release_status, "Intended Audience :: Developers", @@ -94,11 +84,9 @@ ], platforms="Posix; MacOS X; Windows", packages=packages, + python_requires=">=3.7", namespace_packages=namespaces, install_requires=dependencies, - extras_require=extras, - python_requires=">=3.7", - scripts=["scripts/fixup_keywords.py"], include_package_data=True, zip_safe=False, ) diff --git a/testing/constraints-3.10.txt b/testing/constraints-3.10.txt index e69de29b..ed7f9aed 100644 --- a/testing/constraints-3.10.txt +++ b/testing/constraints-3.10.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.11.txt b/testing/constraints-3.11.txt index e69de29b..ed7f9aed 100644 --- a/testing/constraints-3.11.txt +++ b/testing/constraints-3.11.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index 5dcaa6fd..6f3158cc 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -1,10 +1,9 @@ # This constraints file is used to check that lower bounds # are correct in setup.py -# List *all* library dependencies and extras in this file. +# List all library dependencies and extras in this file. # Pin the version to the lower bound. -# -# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", -# Then this file should have foo==1.14.0 -google-api-core==1.32.0 +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", +# Then this file should have google-cloud-foo==1.14.0 +google-api-core==1.33.2 proto-plus==1.22.0 protobuf==3.19.5 diff --git a/testing/constraints-3.8.txt b/testing/constraints-3.8.txt index e69de29b..ed7f9aed 100644 --- a/testing/constraints-3.8.txt +++ b/testing/constraints-3.8.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/testing/constraints-3.9.txt b/testing/constraints-3.9.txt index e69de29b..ed7f9aed 100644 --- a/testing/constraints-3.9.txt +++ b/testing/constraints-3.9.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf