Metadata-Version: 2.4
Name: rboto-polly
Version: 0.1.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Framework :: AsyncIO
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Dist: rboto==0.1.0
License-File: LICENSE
Summary: rboto: async-only, typed Python client for Amazon Polly, powered by Rust. Alpha preview.
Keywords: rboto,aws,polly,asyncio,typing,rust
Home-Page: https://github.com/ferrumio/rboto
Author-email: Leandro Cavalcante Damascena <leandro.damascena@gmail.com>
License-Expression: Apache-2.0
Requires-Python: >=3.12
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Changelog, https://github.com/ferrumio/rboto/releases
Project-URL: Documentation, https://ferrumio.github.io/rboto/clients/
Project-URL: Homepage, https://ferrumio.github.io/rboto/
Project-URL: Issues, https://github.com/ferrumio/rboto/issues
Project-URL: Repository, https://github.com/ferrumio/rboto

<!-- Generated by rboto-codegen. Edit the descriptor, template, or example source. -->
# rboto-polly

rboto is an independent project maintained by [Ferrumio](https://github.com/ferrumio).
It is not affiliated with, sponsored by, or endorsed by Amazon Web Services (AWS).

**Preview (Alpha).** rboto is under active development. APIs may change between releases.

rboto provides an **async-only, typed Python client for Amazon Polly**,
powered by Rust. This package contains `PollyClient` and
**10 operations**.

## Installation

Requires Python 3.12 or newer and a native wheel for your Python version and platform.

```bash
python -m pip install "rboto[polly]"
```

You can also install `rboto-polly` directly; it installs the matching
`rboto` package. Only the selected service is installed.

These are the package names to use when a release is available on your package index.
If your index has no release yet, follow the
[source installation instructions](https://ferrumio.github.io/rboto/getting-started/).

## Usage

Configure credentials through your environment, shared profile, or workload role.
The example uses `us-east-1`; select a region where your service and resources are available.
Resource names, identifiers, input files, and model IDs in the example are placeholders
to replace with your own.

```python
import asyncio
from pathlib import Path

from rboto import PollyClient


async def main() -> None:
    client = PollyClient(region="us-east-1")
    response = await client.synthesize_speech(
        text="Hello from rboto", output_format="mp3", voice_id="Joanna",
    )
    audio = await response.audio_stream.read()
    await asyncio.to_thread(Path("speech.mp3").write_bytes, audio)


if __name__ == "__main__":
    asyncio.run(main())
```

In an application with an event loop, call `await main()` instead of `asyncio.run(main())`.
Reuse the client across calls. Constructing a client does not send a request.

## API conventions

- Import the client with `from rboto import PollyClient`.
- Every operation is asynchronous: use `await client.method(...)`.
- Operation arguments are keyword-only and use the Python names listed below.
- Structured inputs use typed dictionaries and tagged unions from `rboto_polly.types`.
- Regular responses expose typed attributes; `response.to_dict()` converts them to a dictionary.
- Event-stream responses may be typed dictionaries containing async iterators. Follow the
  declared return type; consume event streams with `async for`.
- Byte streams are consumed asynchronously. `await stream.read()` buffers the complete body;
  iterate the stream when processing a large response.
- Direct operation calls return one page.
- Use `async for page in client.paginators.method(...)` for supported paginated operations.
  Paginators accept the same typed arguments as the corresponding client method.

- Catch modeled exceptions from `rboto_polly.exceptions`. Their `error_code`,
  `message`, and `operation_name` identify service failures.

Clients also accept `profile`, `endpoint_url`, or shared `Session` settings.
See [configuration](https://ferrumio.github.io/rboto/guides/configuration/),
[errors](https://ferrumio.github.io/rboto/guides/errors/), and
[streaming](https://ferrumio.github.io/rboto/guides/streaming/).

## Operations

This is the complete operation catalog for this generated package. “Required arguments”
lists arguments without defaults in the Python signature. Service-side conditions may
require additional arguments. Each method links to its complete signature, including
optional arguments. Nested input definitions are in `rboto_polly.types`;
native response definitions are in the package's `_native.pyi`.

| Method | Required arguments | Return type |
|---|---|---|
| [`delete_lexicon`](#delete_lexicon) | <code>name: str</code> | <code>DeleteLexiconOutput</code> |
| [`describe_voices`](#describe_voices) | None | <code>DescribeVoicesOutput</code> |
| [`get_lexicon`](#get_lexicon) | <code>name: str</code> | <code>GetLexiconOutput</code> |
| [`get_speech_synthesis_task`](#get_speech_synthesis_task) | <code>task_id: str</code> | <code>GetSpeechSynthesisTaskOutput</code> |
| [`list_lexicons`](#list_lexicons) | None | <code>ListLexiconsOutput</code> |
| [`list_speech_synthesis_tasks`](#list_speech_synthesis_tasks) | None | <code>ListSpeechSynthesisTasksOutput</code> |
| [`put_lexicon`](#put_lexicon) | <code>name: str</code>, <code>content: str</code> | <code>PutLexiconOutput</code> |
| [`start_speech_synthesis_stream`](#start_speech_synthesis_stream) | <code>engine: Engine</code>, <code>output_format: OutputFormat</code>, <code>voice_id: VoiceId</code> | <code>StartSpeechSynthesisStreamOutput</code> |
| [`start_speech_synthesis_task`](#start_speech_synthesis_task) | <code>output_format: OutputFormat</code>, <code>output_s3_bucket_name: str</code>, <code>text: str</code>, <code>voice_id: VoiceId</code> | <code>StartSpeechSynthesisTaskOutput</code> |
| [`synthesize_speech`](#synthesize_speech) | <code>output_format: OutputFormat</code>, <code>text: str</code>, <code>voice_id: VoiceId</code> | <code>SynthesizeSpeechOutput</code> |

## Complete signatures

### delete_lexicon

```python
async def delete_lexicon(
    *,
    name: str,
) -> DeleteLexiconOutput: ...
```


### describe_voices

```python
async def describe_voices(
    *,
    engine: Engine | None = None,
    language_code: LanguageCode | None = None,
    include_additional_language_codes: bool | None = None,
    next_token: str | None = None,
) -> DescribeVoicesOutput: ...
```

Also available as `client.paginators.describe_voices(...)`, returning an
async iterator of the response type above.


### get_lexicon

```python
async def get_lexicon(
    *,
    name: str,
) -> GetLexiconOutput: ...
```


### get_speech_synthesis_task

```python
async def get_speech_synthesis_task(
    *,
    task_id: str,
) -> GetSpeechSynthesisTaskOutput: ...
```


### list_lexicons

```python
async def list_lexicons(
    *,
    next_token: str | None = None,
) -> ListLexiconsOutput: ...
```

Also available as `client.paginators.list_lexicons(...)`, returning an
async iterator of the response type above.


### list_speech_synthesis_tasks

```python
async def list_speech_synthesis_tasks(
    *,
    max_results: int | None = None,
    next_token: str | None = None,
    status: TaskStatus | None = None,
) -> ListSpeechSynthesisTasksOutput: ...
```

Also available as `client.paginators.list_speech_synthesis_tasks(...)`, returning an
async iterator of the response type above.


### put_lexicon

```python
async def put_lexicon(
    *,
    name: str,
    content: str,
) -> PutLexiconOutput: ...
```


### start_speech_synthesis_stream

```python
async def start_speech_synthesis_stream(
    *,
    engine: Engine,
    output_format: OutputFormat,
    voice_id: VoiceId,
    language_code: LanguageCode | None = None,
    lexicon_names: Sequence[str] | None = None,
    sample_rate: str | None = None,
    action_stream: AsyncIterator[StartSpeechSynthesisStreamActionStream] | None = None,
) -> StartSpeechSynthesisStreamOutput: ...
```


### start_speech_synthesis_task

```python
async def start_speech_synthesis_task(
    *,
    output_format: OutputFormat,
    output_s3_bucket_name: str,
    text: str,
    voice_id: VoiceId,
    engine: Engine | None = None,
    language_code: LanguageCode | None = None,
    lexicon_names: Sequence[str] | None = None,
    output_s3_key_prefix: str | None = None,
    sample_rate: str | None = None,
    sns_topic_arn: str | None = None,
    speech_mark_types: Sequence[SpeechMarkType] | None = None,
    text_type: TextType | None = None,
) -> StartSpeechSynthesisTaskOutput: ...
```


### synthesize_speech

```python
async def synthesize_speech(
    *,
    output_format: OutputFormat,
    text: str,
    voice_id: VoiceId,
    engine: Engine | None = None,
    language_code: LanguageCode | None = None,
    lexicon_names: Sequence[str] | None = None,
    sample_rate: str | None = None,
    speech_mark_types: Sequence[SpeechMarkType] | None = None,
    text_type: TextType | None = None,
) -> SynthesizeSpeechOutput: ...
```


## Links

- [Service guide](https://ferrumio.github.io/rboto/clients/)
- [Repository](https://github.com/ferrumio/rboto)
- [Issues](https://github.com/ferrumio/rboto/issues)
- [Releases](https://github.com/ferrumio/rboto/releases)

Licensed under Apache-2.0.

