spitch 1.33.0__tar.gz → 1.35.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of spitch might be problematic. Click here for more details.
- spitch-1.35.0/.release-please-manifest.json +3 -0
- {spitch-1.33.0 → spitch-1.35.0}/CHANGELOG.md +42 -0
- {spitch-1.33.0 → spitch-1.35.0}/PKG-INFO +10 -3
- {spitch-1.33.0 → spitch-1.35.0}/README.md +9 -2
- spitch-1.35.0/api.md +42 -0
- {spitch-1.33.0 → spitch-1.35.0}/pyproject.toml +55 -3
- {spitch-1.33.0 → spitch-1.35.0}/requirements-dev.lock +5 -3
- {spitch-1.33.0 → spitch-1.35.0}/requirements.lock +6 -3
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/__init__.py +3 -1
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_base_client.py +12 -12
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_client.py +33 -24
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_compat.py +47 -47
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_models.py +51 -45
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_qs.py +7 -7
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_types.py +53 -12
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_utils/__init__.py +9 -2
- spitch-1.35.0/src/spitch/_utils/_compat.py +45 -0
- spitch-1.35.0/src/spitch/_utils/_datetime_parse.py +136 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_utils/_transform.py +13 -3
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_utils/_typing.py +6 -1
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_utils/_utils.py +4 -5
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_version.py +1 -1
- spitch-1.35.0/src/spitch/pagination.py +50 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/resources/__init__.py +14 -0
- spitch-1.35.0/src/spitch/resources/files.py +580 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/resources/speech.py +17 -17
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/resources/text.py +5 -5
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/types/__init__.py +7 -0
- spitch-1.35.0/src/spitch/types/file_delete_response.py +11 -0
- spitch-1.35.0/src/spitch/types/file_download_params.py +11 -0
- spitch-1.35.0/src/spitch/types/file_get_response.py +24 -0
- spitch-1.35.0/src/spitch/types/file_list_params.py +16 -0
- spitch-1.35.0/src/spitch/types/file_list_response.py +24 -0
- spitch-1.35.0/src/spitch/types/file_upload_params.py +13 -0
- spitch-1.35.0/src/spitch/types/file_upload_response.py +24 -0
- spitch-1.35.0/tests/api_resources/test_files.py +454 -0
- {spitch-1.33.0 → spitch-1.35.0}/tests/test_client.py +6 -47
- {spitch-1.33.0 → spitch-1.35.0}/tests/test_models.py +24 -24
- {spitch-1.33.0 → spitch-1.35.0}/tests/test_transform.py +17 -10
- spitch-1.35.0/tests/test_utils/test_datetime_parse.py +110 -0
- {spitch-1.33.0 → spitch-1.35.0}/tests/utils.py +13 -5
- spitch-1.33.0/.release-please-manifest.json +0 -3
- spitch-1.33.0/api.md +0 -25
- spitch-1.33.0/mypy.ini +0 -47
- {spitch-1.33.0 → spitch-1.35.0}/.gitignore +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/CONTRIBUTING.md +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/LICENSE +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/SECURITY.md +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/bin/check-release-environment +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/bin/publish-pypi +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/examples/.keep +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/examples/example.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/noxfile.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/release-please-config.json +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_constants.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_exceptions.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_files.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_resource.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_response.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_streaming.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_utils/_logs.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_utils/_proxy.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_utils/_reflection.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_utils/_resources_proxy.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_utils/_streams.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/_utils/_sync.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/lib/.keep +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/py.typed +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/types/speech_generate_params.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/types/speech_transcribe_params.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/types/speech_transcribe_response.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/types/text_tone_mark_params.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/types/text_tone_mark_response.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/types/text_translate_params.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/src/spitch/types/text_translate_response.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/tests/__init__.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/tests/api_resources/__init__.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/tests/api_resources/test_speech.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/tests/api_resources/test_text.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/tests/conftest.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/tests/sample_file.txt +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/tests/test_deepcopy.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/tests/test_extract_files.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/tests/test_files.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/tests/test_qs.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/tests/test_required_args.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/tests/test_response.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/tests/test_streaming.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/tests/test_utils/test_proxy.py +0 -0
- {spitch-1.33.0 → spitch-1.35.0}/tests/test_utils/test_typing.py +0 -0
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.35.0 (2025-10-06)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v1.34.0...v1.35.0](https://github.com/spi-tch/spitch-python/compare/v1.34.0...v1.35.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** manual updates ([574df33](https://github.com/spi-tch/spitch-python/commit/574df333fdbdc5da00db8995c76764ef35525a98))
|
|
10
|
+
* **api:** manual updates ([ead4d0f](https://github.com/spi-tch/spitch-python/commit/ead4d0f08f3b28578c1a5caea262290dc04d8b27))
|
|
11
|
+
* improve future compat with pydantic v3 ([d0bad68](https://github.com/spi-tch/spitch-python/commit/d0bad682b3e6b51dc0c37c7779a1a87476bd06b2))
|
|
12
|
+
* **types:** replace List[str] with SequenceNotStr in params ([7c4068d](https://github.com/spi-tch/spitch-python/commit/7c4068d1941ff82258c64ea2308574d7f18fd9eb))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* avoid newer type syntax ([8ca197e](https://github.com/spi-tch/spitch-python/commit/8ca197e3a5dee3caa13c202561a571bd27f426d6))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Chores
|
|
21
|
+
|
|
22
|
+
* do not install brew dependencies in ./scripts/bootstrap by default ([65b9b27](https://github.com/spi-tch/spitch-python/commit/65b9b27f367eaf8acd5ac279477133bcc16d474e))
|
|
23
|
+
* **internal:** add Sequence related utils ([165bc5b](https://github.com/spi-tch/spitch-python/commit/165bc5bf7aab042eb26329511d7c3710e8f3013f))
|
|
24
|
+
* **internal:** change ci workflow machines ([47a8c37](https://github.com/spi-tch/spitch-python/commit/47a8c37c9f69a1ab81018ef18e210a6b9ccd3b61))
|
|
25
|
+
* **internal:** codegen related update ([2b78c91](https://github.com/spi-tch/spitch-python/commit/2b78c91f092d0a21452bdf49c1ca030aad41659e))
|
|
26
|
+
* **internal:** fix ruff target version ([8b255f3](https://github.com/spi-tch/spitch-python/commit/8b255f361be3c261ea1949109566caa3ab149000))
|
|
27
|
+
* **internal:** move mypy configurations to `pyproject.toml` file ([a72dfb3](https://github.com/spi-tch/spitch-python/commit/a72dfb3a9f8664c9fe65b8828c730e32d6eb2fe6))
|
|
28
|
+
* **internal:** update comment in script ([b369538](https://github.com/spi-tch/spitch-python/commit/b369538413c8f30c37f58ff479c93cbc592512ee))
|
|
29
|
+
* **internal:** update pydantic dependency ([a187d65](https://github.com/spi-tch/spitch-python/commit/a187d658fd4b0b6dfadac17a88f50bf93569cdda))
|
|
30
|
+
* **internal:** update pyright exclude list ([c2f65df](https://github.com/spi-tch/spitch-python/commit/c2f65df82191ffc6f25baf52eb8b5a30fbbaa4df))
|
|
31
|
+
* **types:** change optional parameter type from NotGiven to Omit ([aa74911](https://github.com/spi-tch/spitch-python/commit/aa74911c2a673a56720e2dab3264151423f88b25))
|
|
32
|
+
* update @stainless-api/prism-cli to v5.15.0 ([d0371a7](https://github.com/spi-tch/spitch-python/commit/d0371a73586deac608ce2e4fae2439b477f90702))
|
|
33
|
+
* update github action ([c3e1045](https://github.com/spi-tch/spitch-python/commit/c3e1045cbfbf202f009042c0de01cd0007881e25))
|
|
34
|
+
|
|
35
|
+
## 1.34.0 (2025-08-05)
|
|
36
|
+
|
|
37
|
+
Full Changelog: [v1.33.0...v1.34.0](https://github.com/spi-tch/spitch-python/compare/v1.33.0...v1.34.0)
|
|
38
|
+
|
|
39
|
+
### Features
|
|
40
|
+
|
|
41
|
+
* **api:** update via SDK Studio ([e1eddc1](https://github.com/spi-tch/spitch-python/commit/e1eddc115253f0d959068f0096abbbad58e1ca41))
|
|
42
|
+
* **api:** update via SDK Studio ([fc00ced](https://github.com/spi-tch/spitch-python/commit/fc00ceda503d7721e38daaba609625f1b44613ae))
|
|
43
|
+
* **api:** update via SDK Studio ([910add6](https://github.com/spi-tch/spitch-python/commit/910add6ee71ff113f4471677094d5e385585e70c))
|
|
44
|
+
|
|
3
45
|
## 1.33.0 (2025-08-02)
|
|
4
46
|
|
|
5
47
|
Full Changelog: [v1.32.0...v1.33.0](https://github.com/spi-tch/spitch-python/compare/v1.32.0...v1.33.0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: spitch
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.35.0
|
|
4
4
|
Summary: The official Python library for the spitch API
|
|
5
5
|
Project-URL: Homepage, https://github.com/spi-tch/spitch-python
|
|
6
6
|
Project-URL: Repository, https://github.com/spi-tch/spitch-python
|
|
@@ -61,9 +61,12 @@ pip install spitch
|
|
|
61
61
|
The full API of this library can be found in [api.md](https://github.com/spi-tch/spitch-python/tree/main/api.md).
|
|
62
62
|
|
|
63
63
|
```python
|
|
64
|
+
import os
|
|
64
65
|
from spitch import Spitch
|
|
65
66
|
|
|
66
|
-
client = Spitch(
|
|
67
|
+
client = Spitch(
|
|
68
|
+
api_key=os.environ.get("SPITCH_API_KEY"), # This is the default and can be omitted
|
|
69
|
+
)
|
|
67
70
|
|
|
68
71
|
response = client.speech.generate(
|
|
69
72
|
language="yo",
|
|
@@ -82,10 +85,13 @@ so that your API Key is not stored in source control.
|
|
|
82
85
|
Simply import `AsyncSpitch` instead of `Spitch` and use `await` with each API call:
|
|
83
86
|
|
|
84
87
|
```python
|
|
88
|
+
import os
|
|
85
89
|
import asyncio
|
|
86
90
|
from spitch import AsyncSpitch
|
|
87
91
|
|
|
88
|
-
client = AsyncSpitch(
|
|
92
|
+
client = AsyncSpitch(
|
|
93
|
+
api_key=os.environ.get("SPITCH_API_KEY"), # This is the default and can be omitted
|
|
94
|
+
)
|
|
89
95
|
|
|
90
96
|
|
|
91
97
|
async def main() -> None:
|
|
@@ -122,6 +128,7 @@ from spitch import AsyncSpitch
|
|
|
122
128
|
|
|
123
129
|
async def main() -> None:
|
|
124
130
|
async with AsyncSpitch(
|
|
131
|
+
api_key="My API Key",
|
|
125
132
|
http_client=DefaultAioHttpClient(),
|
|
126
133
|
) as client:
|
|
127
134
|
response = await client.speech.generate(
|
|
@@ -25,9 +25,12 @@ pip install spitch
|
|
|
25
25
|
The full API of this library can be found in [api.md](api.md).
|
|
26
26
|
|
|
27
27
|
```python
|
|
28
|
+
import os
|
|
28
29
|
from spitch import Spitch
|
|
29
30
|
|
|
30
|
-
client = Spitch(
|
|
31
|
+
client = Spitch(
|
|
32
|
+
api_key=os.environ.get("SPITCH_API_KEY"), # This is the default and can be omitted
|
|
33
|
+
)
|
|
31
34
|
|
|
32
35
|
response = client.speech.generate(
|
|
33
36
|
language="yo",
|
|
@@ -46,10 +49,13 @@ so that your API Key is not stored in source control.
|
|
|
46
49
|
Simply import `AsyncSpitch` instead of `Spitch` and use `await` with each API call:
|
|
47
50
|
|
|
48
51
|
```python
|
|
52
|
+
import os
|
|
49
53
|
import asyncio
|
|
50
54
|
from spitch import AsyncSpitch
|
|
51
55
|
|
|
52
|
-
client = AsyncSpitch(
|
|
56
|
+
client = AsyncSpitch(
|
|
57
|
+
api_key=os.environ.get("SPITCH_API_KEY"), # This is the default and can be omitted
|
|
58
|
+
)
|
|
53
59
|
|
|
54
60
|
|
|
55
61
|
async def main() -> None:
|
|
@@ -86,6 +92,7 @@ from spitch import AsyncSpitch
|
|
|
86
92
|
|
|
87
93
|
async def main() -> None:
|
|
88
94
|
async with AsyncSpitch(
|
|
95
|
+
api_key="My API Key",
|
|
89
96
|
http_client=DefaultAioHttpClient(),
|
|
90
97
|
) as client:
|
|
91
98
|
response = await client.speech.generate(
|
spitch-1.35.0/api.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Speech
|
|
2
|
+
|
|
3
|
+
Types:
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
from spitch.types import SpeechTranscribeResponse
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Methods:
|
|
10
|
+
|
|
11
|
+
- <code title="post /v1/speech">client.speech.<a href="./src/spitch/resources/speech.py">generate</a>(\*\*<a href="src/spitch/types/speech_generate_params.py">params</a>) -> BinaryAPIResponse</code>
|
|
12
|
+
- <code title="post /v1/transcriptions">client.speech.<a href="./src/spitch/resources/speech.py">transcribe</a>(\*\*<a href="src/spitch/types/speech_transcribe_params.py">params</a>) -> <a href="./src/spitch/types/speech_transcribe_response.py">SpeechTranscribeResponse</a></code>
|
|
13
|
+
|
|
14
|
+
# Text
|
|
15
|
+
|
|
16
|
+
Types:
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
from spitch.types import TextToneMarkResponse, TextTranslateResponse
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Methods:
|
|
23
|
+
|
|
24
|
+
- <code title="post /v1/diacritics">client.text.<a href="./src/spitch/resources/text.py">tone_mark</a>(\*\*<a href="src/spitch/types/text_tone_mark_params.py">params</a>) -> <a href="./src/spitch/types/text_tone_mark_response.py">TextToneMarkResponse</a></code>
|
|
25
|
+
- <code title="post /v1/translate">client.text.<a href="./src/spitch/resources/text.py">translate</a>(\*\*<a href="src/spitch/types/text_translate_params.py">params</a>) -> <a href="./src/spitch/types/text_translate_response.py">TextTranslateResponse</a></code>
|
|
26
|
+
|
|
27
|
+
# Files
|
|
28
|
+
|
|
29
|
+
Types:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from spitch.types import FileListResponse, FileDeleteResponse, FileGetResponse, FileUploadResponse
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Methods:
|
|
36
|
+
|
|
37
|
+
- <code title="get /v1/files">client.files.<a href="./src/spitch/resources/files.py">list</a>(\*\*<a href="src/spitch/types/file_list_params.py">params</a>) -> <a href="./src/spitch/types/file_list_response.py">SyncFilesCursor[FileListResponse]</a></code>
|
|
38
|
+
- <code title="delete /v1/files/{file_id}">client.files.<a href="./src/spitch/resources/files.py">delete</a>(file_id) -> <a href="./src/spitch/types/file_delete_response.py">FileDeleteResponse</a></code>
|
|
39
|
+
- <code title="get /v1/files/{file_id}/url">client.files.<a href="./src/spitch/resources/files.py">download</a>(file_id, \*\*<a href="src/spitch/types/file_download_params.py">params</a>) -> object</code>
|
|
40
|
+
- <code title="get /v1/files/{file_id}">client.files.<a href="./src/spitch/resources/files.py">get</a>(file_id) -> <a href="./src/spitch/types/file_get_response.py">FileGetResponse</a></code>
|
|
41
|
+
- <code title="post /v1/files">client.files.<a href="./src/spitch/resources/files.py">upload</a>(\*\*<a href="src/spitch/types/file_upload_params.py">params</a>) -> <a href="./src/spitch/types/file_upload_response.py">FileUploadResponse</a></code>
|
|
42
|
+
- <code title="get /v1/files:usage">client.files.<a href="./src/spitch/resources/files.py">usage</a>() -> object</code>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "spitch"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.35.0"
|
|
4
4
|
description = "The official Python library for the spitch API"
|
|
5
5
|
dynamic = ["readme"]
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -57,7 +57,6 @@ dev-dependencies = [
|
|
|
57
57
|
"dirty-equals>=0.6.0",
|
|
58
58
|
"importlib-metadata>=6.7.0",
|
|
59
59
|
"rich>=13.7.1",
|
|
60
|
-
"nest_asyncio==1.6.0",
|
|
61
60
|
"pytest-xdist>=3.6.1",
|
|
62
61
|
]
|
|
63
62
|
|
|
@@ -149,6 +148,7 @@ exclude = [
|
|
|
149
148
|
"_dev",
|
|
150
149
|
".venv",
|
|
151
150
|
".nox",
|
|
151
|
+
".git",
|
|
152
152
|
]
|
|
153
153
|
|
|
154
154
|
reportImplicitOverride = true
|
|
@@ -157,10 +157,62 @@ reportOverlappingOverload = false
|
|
|
157
157
|
reportImportCycles = false
|
|
158
158
|
reportPrivateUsage = false
|
|
159
159
|
|
|
160
|
+
[tool.mypy]
|
|
161
|
+
pretty = true
|
|
162
|
+
show_error_codes = true
|
|
163
|
+
|
|
164
|
+
# Exclude _files.py because mypy isn't smart enough to apply
|
|
165
|
+
# the correct type narrowing and as this is an internal module
|
|
166
|
+
# it's fine to just use Pyright.
|
|
167
|
+
#
|
|
168
|
+
# We also exclude our `tests` as mypy doesn't always infer
|
|
169
|
+
# types correctly and Pyright will still catch any type errors.
|
|
170
|
+
exclude = ['src/spitch/_files.py', '_dev/.*.py', 'tests/.*']
|
|
171
|
+
|
|
172
|
+
strict_equality = true
|
|
173
|
+
implicit_reexport = true
|
|
174
|
+
check_untyped_defs = true
|
|
175
|
+
no_implicit_optional = true
|
|
176
|
+
|
|
177
|
+
warn_return_any = true
|
|
178
|
+
warn_unreachable = true
|
|
179
|
+
warn_unused_configs = true
|
|
180
|
+
|
|
181
|
+
# Turn these options off as it could cause conflicts
|
|
182
|
+
# with the Pyright options.
|
|
183
|
+
warn_unused_ignores = false
|
|
184
|
+
warn_redundant_casts = false
|
|
185
|
+
|
|
186
|
+
disallow_any_generics = true
|
|
187
|
+
disallow_untyped_defs = true
|
|
188
|
+
disallow_untyped_calls = true
|
|
189
|
+
disallow_subclassing_any = true
|
|
190
|
+
disallow_incomplete_defs = true
|
|
191
|
+
disallow_untyped_decorators = true
|
|
192
|
+
cache_fine_grained = true
|
|
193
|
+
|
|
194
|
+
# By default, mypy reports an error if you assign a value to the result
|
|
195
|
+
# of a function call that doesn't return anything. We do this in our test
|
|
196
|
+
# cases:
|
|
197
|
+
# ```
|
|
198
|
+
# result = ...
|
|
199
|
+
# assert result is None
|
|
200
|
+
# ```
|
|
201
|
+
# Changing this codegen to make mypy happy would increase complexity
|
|
202
|
+
# and would not be worth it.
|
|
203
|
+
disable_error_code = "func-returns-value,overload-cannot-match"
|
|
204
|
+
|
|
205
|
+
# https://github.com/python/mypy/issues/12162
|
|
206
|
+
[[tool.mypy.overrides]]
|
|
207
|
+
module = "black.files.*"
|
|
208
|
+
ignore_errors = true
|
|
209
|
+
ignore_missing_imports = true
|
|
210
|
+
|
|
211
|
+
|
|
160
212
|
[tool.ruff]
|
|
161
213
|
line-length = 120
|
|
162
214
|
output-format = "grouped"
|
|
163
|
-
target-version = "
|
|
215
|
+
target-version = "py38"
|
|
164
216
|
|
|
165
217
|
[tool.ruff.format]
|
|
166
218
|
docstring-code-format = true
|
|
@@ -75,7 +75,6 @@ multidict==6.5.0
|
|
|
75
75
|
mypy==1.14.1
|
|
76
76
|
mypy-extensions==1.0.0
|
|
77
77
|
# via mypy
|
|
78
|
-
nest-asyncio==1.6.0
|
|
79
78
|
nodeenv==1.8.0
|
|
80
79
|
# via pyright
|
|
81
80
|
nox==2023.4.22
|
|
@@ -89,9 +88,9 @@ pluggy==1.5.0
|
|
|
89
88
|
propcache==0.3.2
|
|
90
89
|
# via aiohttp
|
|
91
90
|
# via yarl
|
|
92
|
-
pydantic==2.9
|
|
91
|
+
pydantic==2.11.9
|
|
93
92
|
# via spitch
|
|
94
|
-
pydantic-core==2.
|
|
93
|
+
pydantic-core==2.33.2
|
|
95
94
|
# via pydantic
|
|
96
95
|
pygments==2.18.0
|
|
97
96
|
# via rich
|
|
@@ -128,6 +127,9 @@ typing-extensions==4.12.2
|
|
|
128
127
|
# via pydantic-core
|
|
129
128
|
# via pyright
|
|
130
129
|
# via spitch
|
|
130
|
+
# via typing-inspection
|
|
131
|
+
typing-inspection==0.4.1
|
|
132
|
+
# via pydantic
|
|
131
133
|
virtualenv==20.24.5
|
|
132
134
|
# via nox
|
|
133
135
|
yarl==1.20.1
|
|
@@ -55,9 +55,9 @@ multidict==6.5.0
|
|
|
55
55
|
propcache==0.3.2
|
|
56
56
|
# via aiohttp
|
|
57
57
|
# via yarl
|
|
58
|
-
pydantic==2.9
|
|
58
|
+
pydantic==2.11.9
|
|
59
59
|
# via spitch
|
|
60
|
-
pydantic-core==2.
|
|
60
|
+
pydantic-core==2.33.2
|
|
61
61
|
# via pydantic
|
|
62
62
|
sniffio==1.3.0
|
|
63
63
|
# via anyio
|
|
@@ -69,5 +69,8 @@ typing-extensions==4.12.2
|
|
|
69
69
|
# via pydantic
|
|
70
70
|
# via pydantic-core
|
|
71
71
|
# via spitch
|
|
72
|
-
|
|
72
|
+
# via typing-inspection
|
|
73
|
+
typing-inspection==0.4.1
|
|
74
|
+
# via pydantic
|
|
75
|
+
yarl==1.20.0
|
|
73
76
|
# via aiohttp
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import typing as _t
|
|
4
4
|
|
|
5
5
|
from . import types
|
|
6
|
-
from ._types import NOT_GIVEN, NoneType, NotGiven, Transport, ProxiesTypes
|
|
6
|
+
from ._types import NOT_GIVEN, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given
|
|
7
7
|
from ._utils import file_from_path
|
|
8
8
|
from ._client import Client, Spitch, Stream, Timeout, Transport, AsyncClient, AsyncSpitch, AsyncStream, RequestOptions
|
|
9
9
|
from ._models import BaseModel
|
|
@@ -38,6 +38,8 @@ __all__ = [
|
|
|
38
38
|
"ProxiesTypes",
|
|
39
39
|
"NotGiven",
|
|
40
40
|
"NOT_GIVEN",
|
|
41
|
+
"not_given",
|
|
42
|
+
"omit",
|
|
41
43
|
"SpitchError",
|
|
42
44
|
"APIError",
|
|
43
45
|
"APIStatusError",
|
|
@@ -42,7 +42,6 @@ from . import _exceptions
|
|
|
42
42
|
from ._qs import Querystring
|
|
43
43
|
from ._files import to_httpx_files, async_to_httpx_files
|
|
44
44
|
from ._types import (
|
|
45
|
-
NOT_GIVEN,
|
|
46
45
|
Body,
|
|
47
46
|
Omit,
|
|
48
47
|
Query,
|
|
@@ -57,9 +56,10 @@ from ._types import (
|
|
|
57
56
|
RequestOptions,
|
|
58
57
|
HttpxRequestFiles,
|
|
59
58
|
ModelBuilderProtocol,
|
|
59
|
+
not_given,
|
|
60
60
|
)
|
|
61
61
|
from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping
|
|
62
|
-
from ._compat import
|
|
62
|
+
from ._compat import PYDANTIC_V1, model_copy, model_dump
|
|
63
63
|
from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type
|
|
64
64
|
from ._response import (
|
|
65
65
|
APIResponse,
|
|
@@ -145,9 +145,9 @@ class PageInfo:
|
|
|
145
145
|
def __init__(
|
|
146
146
|
self,
|
|
147
147
|
*,
|
|
148
|
-
url: URL | NotGiven =
|
|
149
|
-
json: Body | NotGiven =
|
|
150
|
-
params: Query | NotGiven =
|
|
148
|
+
url: URL | NotGiven = not_given,
|
|
149
|
+
json: Body | NotGiven = not_given,
|
|
150
|
+
params: Query | NotGiven = not_given,
|
|
151
151
|
) -> None:
|
|
152
152
|
self.url = url
|
|
153
153
|
self.json = json
|
|
@@ -232,7 +232,7 @@ class BaseSyncPage(BasePage[_T], Generic[_T]):
|
|
|
232
232
|
model: Type[_T],
|
|
233
233
|
options: FinalRequestOptions,
|
|
234
234
|
) -> None:
|
|
235
|
-
if
|
|
235
|
+
if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None:
|
|
236
236
|
self.__pydantic_private__ = {}
|
|
237
237
|
|
|
238
238
|
self._model = model
|
|
@@ -320,7 +320,7 @@ class BaseAsyncPage(BasePage[_T], Generic[_T]):
|
|
|
320
320
|
client: AsyncAPIClient,
|
|
321
321
|
options: FinalRequestOptions,
|
|
322
322
|
) -> None:
|
|
323
|
-
if
|
|
323
|
+
if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None:
|
|
324
324
|
self.__pydantic_private__ = {}
|
|
325
325
|
|
|
326
326
|
self._model = model
|
|
@@ -595,7 +595,7 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
595
595
|
# we internally support defining a temporary header to override the
|
|
596
596
|
# default `cast_to` type for use with `.with_raw_response` and `.with_streaming_response`
|
|
597
597
|
# see _response.py for implementation details
|
|
598
|
-
override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER,
|
|
598
|
+
override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, not_given)
|
|
599
599
|
if is_given(override_cast_to):
|
|
600
600
|
options.headers = headers
|
|
601
601
|
return cast(Type[ResponseT], override_cast_to)
|
|
@@ -825,7 +825,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
825
825
|
version: str,
|
|
826
826
|
base_url: str | URL,
|
|
827
827
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
828
|
-
timeout: float | Timeout | None | NotGiven =
|
|
828
|
+
timeout: float | Timeout | None | NotGiven = not_given,
|
|
829
829
|
http_client: httpx.Client | None = None,
|
|
830
830
|
custom_headers: Mapping[str, str] | None = None,
|
|
831
831
|
custom_query: Mapping[str, object] | None = None,
|
|
@@ -1356,7 +1356,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1356
1356
|
base_url: str | URL,
|
|
1357
1357
|
_strict_response_validation: bool,
|
|
1358
1358
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
1359
|
-
timeout: float | Timeout | None | NotGiven =
|
|
1359
|
+
timeout: float | Timeout | None | NotGiven = not_given,
|
|
1360
1360
|
http_client: httpx.AsyncClient | None = None,
|
|
1361
1361
|
custom_headers: Mapping[str, str] | None = None,
|
|
1362
1362
|
custom_query: Mapping[str, object] | None = None,
|
|
@@ -1822,8 +1822,8 @@ def make_request_options(
|
|
|
1822
1822
|
extra_query: Query | None = None,
|
|
1823
1823
|
extra_body: Body | None = None,
|
|
1824
1824
|
idempotency_key: str | None = None,
|
|
1825
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
1826
|
-
post_parser: PostParser | NotGiven =
|
|
1825
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1826
|
+
post_parser: PostParser | NotGiven = not_given,
|
|
1827
1827
|
) -> RequestOptions:
|
|
1828
1828
|
"""Create a dict of type RequestOptions without keys of NotGiven values."""
|
|
1829
1829
|
options: RequestOptions = {}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import os
|
|
6
|
-
from typing import Any,
|
|
6
|
+
from typing import Any, Mapping
|
|
7
7
|
from typing_extensions import Self, override
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
@@ -11,16 +11,17 @@ import httpx
|
|
|
11
11
|
from . import resources, _exceptions
|
|
12
12
|
from ._qs import Querystring
|
|
13
13
|
from ._types import (
|
|
14
|
-
NOT_GIVEN,
|
|
15
14
|
Omit,
|
|
16
15
|
Timeout,
|
|
17
16
|
NotGiven,
|
|
18
17
|
Transport,
|
|
19
18
|
ProxiesTypes,
|
|
20
19
|
RequestOptions,
|
|
20
|
+
not_given,
|
|
21
21
|
)
|
|
22
22
|
from ._utils import is_given, get_async_library
|
|
23
23
|
from ._version import __version__
|
|
24
|
+
from .resources import text, files, speech
|
|
24
25
|
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
|
25
26
|
from ._exceptions import SpitchError, APIStatusError
|
|
26
27
|
from ._base_client import (
|
|
@@ -43,8 +44,9 @@ __all__ = [
|
|
|
43
44
|
|
|
44
45
|
|
|
45
46
|
class Spitch(SyncAPIClient):
|
|
46
|
-
speech:
|
|
47
|
-
text:
|
|
47
|
+
speech: speech.SpeechResource
|
|
48
|
+
text: text.TextResource
|
|
49
|
+
files: files.FilesResource
|
|
48
50
|
with_raw_response: SpitchWithRawResponse
|
|
49
51
|
with_streaming_response: SpitchWithStreamedResponse
|
|
50
52
|
|
|
@@ -56,7 +58,7 @@ class Spitch(SyncAPIClient):
|
|
|
56
58
|
*,
|
|
57
59
|
api_key: str | None = None,
|
|
58
60
|
base_url: str | httpx.URL | None = None,
|
|
59
|
-
timeout:
|
|
61
|
+
timeout: float | Timeout | None | NotGiven = not_given,
|
|
60
62
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
61
63
|
default_headers: Mapping[str, str] | None = None,
|
|
62
64
|
default_query: Mapping[str, object] | None = None,
|
|
@@ -102,8 +104,9 @@ class Spitch(SyncAPIClient):
|
|
|
102
104
|
_strict_response_validation=_strict_response_validation,
|
|
103
105
|
)
|
|
104
106
|
|
|
105
|
-
self.speech =
|
|
106
|
-
self.text =
|
|
107
|
+
self.speech = speech.SpeechResource(self)
|
|
108
|
+
self.text = text.TextResource(self)
|
|
109
|
+
self.files = files.FilesResource(self)
|
|
107
110
|
self.with_raw_response = SpitchWithRawResponse(self)
|
|
108
111
|
self.with_streaming_response = SpitchWithStreamedResponse(self)
|
|
109
112
|
|
|
@@ -132,9 +135,9 @@ class Spitch(SyncAPIClient):
|
|
|
132
135
|
*,
|
|
133
136
|
api_key: str | None = None,
|
|
134
137
|
base_url: str | httpx.URL | None = None,
|
|
135
|
-
timeout: float | Timeout | None | NotGiven =
|
|
138
|
+
timeout: float | Timeout | None | NotGiven = not_given,
|
|
136
139
|
http_client: httpx.Client | None = None,
|
|
137
|
-
max_retries: int | NotGiven =
|
|
140
|
+
max_retries: int | NotGiven = not_given,
|
|
138
141
|
default_headers: Mapping[str, str] | None = None,
|
|
139
142
|
set_default_headers: Mapping[str, str] | None = None,
|
|
140
143
|
default_query: Mapping[str, object] | None = None,
|
|
@@ -213,8 +216,9 @@ class Spitch(SyncAPIClient):
|
|
|
213
216
|
|
|
214
217
|
|
|
215
218
|
class AsyncSpitch(AsyncAPIClient):
|
|
216
|
-
speech:
|
|
217
|
-
text:
|
|
219
|
+
speech: speech.AsyncSpeechResource
|
|
220
|
+
text: text.AsyncTextResource
|
|
221
|
+
files: files.AsyncFilesResource
|
|
218
222
|
with_raw_response: AsyncSpitchWithRawResponse
|
|
219
223
|
with_streaming_response: AsyncSpitchWithStreamedResponse
|
|
220
224
|
|
|
@@ -226,7 +230,7 @@ class AsyncSpitch(AsyncAPIClient):
|
|
|
226
230
|
*,
|
|
227
231
|
api_key: str | None = None,
|
|
228
232
|
base_url: str | httpx.URL | None = None,
|
|
229
|
-
timeout:
|
|
233
|
+
timeout: float | Timeout | None | NotGiven = not_given,
|
|
230
234
|
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
231
235
|
default_headers: Mapping[str, str] | None = None,
|
|
232
236
|
default_query: Mapping[str, object] | None = None,
|
|
@@ -272,8 +276,9 @@ class AsyncSpitch(AsyncAPIClient):
|
|
|
272
276
|
_strict_response_validation=_strict_response_validation,
|
|
273
277
|
)
|
|
274
278
|
|
|
275
|
-
self.speech =
|
|
276
|
-
self.text =
|
|
279
|
+
self.speech = speech.AsyncSpeechResource(self)
|
|
280
|
+
self.text = text.AsyncTextResource(self)
|
|
281
|
+
self.files = files.AsyncFilesResource(self)
|
|
277
282
|
self.with_raw_response = AsyncSpitchWithRawResponse(self)
|
|
278
283
|
self.with_streaming_response = AsyncSpitchWithStreamedResponse(self)
|
|
279
284
|
|
|
@@ -302,9 +307,9 @@ class AsyncSpitch(AsyncAPIClient):
|
|
|
302
307
|
*,
|
|
303
308
|
api_key: str | None = None,
|
|
304
309
|
base_url: str | httpx.URL | None = None,
|
|
305
|
-
timeout: float | Timeout | None | NotGiven =
|
|
310
|
+
timeout: float | Timeout | None | NotGiven = not_given,
|
|
306
311
|
http_client: httpx.AsyncClient | None = None,
|
|
307
|
-
max_retries: int | NotGiven =
|
|
312
|
+
max_retries: int | NotGiven = not_given,
|
|
308
313
|
default_headers: Mapping[str, str] | None = None,
|
|
309
314
|
set_default_headers: Mapping[str, str] | None = None,
|
|
310
315
|
default_query: Mapping[str, object] | None = None,
|
|
@@ -384,26 +389,30 @@ class AsyncSpitch(AsyncAPIClient):
|
|
|
384
389
|
|
|
385
390
|
class SpitchWithRawResponse:
|
|
386
391
|
def __init__(self, client: Spitch) -> None:
|
|
387
|
-
self.speech =
|
|
388
|
-
self.text =
|
|
392
|
+
self.speech = speech.SpeechResourceWithRawResponse(client.speech)
|
|
393
|
+
self.text = text.TextResourceWithRawResponse(client.text)
|
|
394
|
+
self.files = files.FilesResourceWithRawResponse(client.files)
|
|
389
395
|
|
|
390
396
|
|
|
391
397
|
class AsyncSpitchWithRawResponse:
|
|
392
398
|
def __init__(self, client: AsyncSpitch) -> None:
|
|
393
|
-
self.speech =
|
|
394
|
-
self.text =
|
|
399
|
+
self.speech = speech.AsyncSpeechResourceWithRawResponse(client.speech)
|
|
400
|
+
self.text = text.AsyncTextResourceWithRawResponse(client.text)
|
|
401
|
+
self.files = files.AsyncFilesResourceWithRawResponse(client.files)
|
|
395
402
|
|
|
396
403
|
|
|
397
404
|
class SpitchWithStreamedResponse:
|
|
398
405
|
def __init__(self, client: Spitch) -> None:
|
|
399
|
-
self.speech =
|
|
400
|
-
self.text =
|
|
406
|
+
self.speech = speech.SpeechResourceWithStreamingResponse(client.speech)
|
|
407
|
+
self.text = text.TextResourceWithStreamingResponse(client.text)
|
|
408
|
+
self.files = files.FilesResourceWithStreamingResponse(client.files)
|
|
401
409
|
|
|
402
410
|
|
|
403
411
|
class AsyncSpitchWithStreamedResponse:
|
|
404
412
|
def __init__(self, client: AsyncSpitch) -> None:
|
|
405
|
-
self.speech =
|
|
406
|
-
self.text =
|
|
413
|
+
self.speech = speech.AsyncSpeechResourceWithStreamingResponse(client.speech)
|
|
414
|
+
self.text = text.AsyncTextResourceWithStreamingResponse(client.text)
|
|
415
|
+
self.files = files.AsyncFilesResourceWithStreamingResponse(client.files)
|
|
407
416
|
|
|
408
417
|
|
|
409
418
|
Client = Spitch
|