spitch 1.37.0__tar.gz → 1.41.1__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.
- spitch-1.41.1/.release-please-manifest.json +3 -0
- {spitch-1.37.0 → spitch-1.41.1}/CHANGELOG.md +77 -0
- {spitch-1.37.0 → spitch-1.41.1}/PKG-INFO +6 -7
- {spitch-1.37.0 → spitch-1.41.1}/README.md +2 -2
- {spitch-1.37.0 → spitch-1.41.1}/SECURITY.md +1 -1
- {spitch-1.37.0 → spitch-1.41.1}/api.md +15 -2
- {spitch-1.37.0 → spitch-1.41.1}/pyproject.toml +9 -6
- {spitch-1.37.0 → spitch-1.41.1}/requirements-dev.lock +1 -1
- {spitch-1.37.0 → spitch-1.41.1}/requirements.lock +1 -1
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_client.py +9 -1
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_models.py +37 -15
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_streaming.py +4 -6
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_utils/_sync.py +3 -31
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_utils/_typing.py +1 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_utils/_utils.py +1 -1
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_version.py +1 -1
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/resources/__init__.py +14 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/resources/files.py +114 -17
- spitch-1.41.1/src/spitch/resources/jobs.py +271 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/resources/speech.py +6 -2
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/resources/text.py +16 -3
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/types/__init__.py +3 -1
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/types/file.py +2 -1
- spitch-1.41.1/src/spitch/types/job.py +19 -0
- spitch-1.41.1/src/spitch/types/job_list_params.py +16 -0
- spitch-1.41.1/src/spitch/types/jobs.py +14 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/types/text_translate_params.py +8 -1
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/types/translation.py +5 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/api_resources/test_files.py +6 -7
- spitch-1.41.1/tests/api_resources/test_jobs.py +169 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/api_resources/test_text.py +22 -4
- {spitch-1.37.0 → spitch-1.41.1}/tests/test_client.py +198 -164
- {spitch-1.37.0 → spitch-1.41.1}/tests/test_models.py +4 -4
- spitch-1.37.0/.release-please-manifest.json +0 -3
- spitch-1.37.0/src/spitch/types/file_delete_response.py +0 -11
- {spitch-1.37.0 → spitch-1.41.1}/.gitignore +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/CONTRIBUTING.md +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/LICENSE +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/bin/check-release-environment +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/bin/publish-pypi +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/examples/.keep +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/examples/example.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/noxfile.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/release-please-config.json +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/__init__.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_base_client.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_compat.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_constants.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_exceptions.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_files.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_qs.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_resource.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_response.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_types.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_utils/__init__.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_utils/_compat.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_utils/_datetime_parse.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_utils/_logs.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_utils/_proxy.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_utils/_reflection.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_utils/_resources_proxy.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_utils/_streams.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/_utils/_transform.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/lib/.keep +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/pagination.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/py.typed +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/types/diacritics.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/types/file_download_params.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/types/file_download_response.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/types/file_list_params.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/types/file_upload_params.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/types/file_usage.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/types/files.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/types/speech_generate_params.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/types/speech_transcribe_params.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/types/text_tone_mark_params.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/src/spitch/types/transcription.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/__init__.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/api_resources/__init__.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/api_resources/test_speech.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/conftest.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/sample_file.txt +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/test_deepcopy.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/test_extract_files.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/test_files.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/test_qs.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/test_required_args.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/test_response.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/test_streaming.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/test_transform.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/test_utils/test_datetime_parse.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/test_utils/test_proxy.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/test_utils/test_typing.py +0 -0
- {spitch-1.37.0 → spitch-1.41.1}/tests/utils.py +0 -0
|
@@ -1,5 +1,82 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.41.1 (2025-11-12)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v1.41.0...v1.41.1](https://github.com/spi-tch/spitch-python/compare/v1.41.0...v1.41.1)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* compat with Python 3.14 ([1ab2493](https://github.com/spi-tch/spitch-python/commit/1ab24934076718e95b5db05ea4bfdd241f8f81da))
|
|
10
|
+
* **compat:** update signatures of `model_dump` and `model_dump_json` for Pydantic v1 ([c57a49c](https://github.com/spi-tch/spitch-python/commit/c57a49c4da4c7002b18875e8e9ba01f96f09b7ae))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Chores
|
|
14
|
+
|
|
15
|
+
* **package:** drop Python 3.8 support ([84254f4](https://github.com/spi-tch/spitch-python/commit/84254f4b0040778492d21e0a6dc1e1d6c72f3989))
|
|
16
|
+
|
|
17
|
+
## 1.41.0 (2025-11-04)
|
|
18
|
+
|
|
19
|
+
Full Changelog: [v1.40.1...v1.41.0](https://github.com/spi-tch/spitch-python/compare/v1.40.1...v1.41.0)
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* **api:** manual updates ([550cf54](https://github.com/spi-tch/spitch-python/commit/550cf54a42a6f06a043d99eff54999db93d49efe))
|
|
24
|
+
|
|
25
|
+
## 1.40.1 (2025-11-04)
|
|
26
|
+
|
|
27
|
+
Full Changelog: [v1.40.0...v1.40.1](https://github.com/spi-tch/spitch-python/compare/v1.40.0...v1.40.1)
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* **client:** close streams without requiring full consumption ([caff450](https://github.com/spi-tch/spitch-python/commit/caff4506e7e4984cb6b9d553cfc144d79658db5b))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Chores
|
|
35
|
+
|
|
36
|
+
* bump `httpx-aiohttp` version to 0.1.9 ([c306d2e](https://github.com/spi-tch/spitch-python/commit/c306d2ea2e61562f51a561efd1b08f251fec4fa2))
|
|
37
|
+
* **internal/tests:** avoid race condition with implicit client cleanup ([1c74fa9](https://github.com/spi-tch/spitch-python/commit/1c74fa902f76c4206b881d3f48175511251dc1da))
|
|
38
|
+
* **internal:** grammar fix (it's -> its) ([2986b36](https://github.com/spi-tch/spitch-python/commit/2986b360854db3075b0cdf6ac5d02be004c26fc1))
|
|
39
|
+
|
|
40
|
+
## 1.40.0 (2025-10-16)
|
|
41
|
+
|
|
42
|
+
Full Changelog: [v1.39.0...v1.40.0](https://github.com/spi-tch/spitch-python/compare/v1.39.0...v1.40.0)
|
|
43
|
+
|
|
44
|
+
### Features
|
|
45
|
+
|
|
46
|
+
* **api:** manual updates ([578dbb8](https://github.com/spi-tch/spitch-python/commit/578dbb81d604d24899f6687fe6dd2a32a923ac15))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Chores
|
|
50
|
+
|
|
51
|
+
* **internal:** detect missing future annotations with ruff ([36529fc](https://github.com/spi-tch/spitch-python/commit/36529fcafde8b0aa37800296b6b27b4f8fbe7984))
|
|
52
|
+
|
|
53
|
+
## 1.39.0 (2025-10-07)
|
|
54
|
+
|
|
55
|
+
Full Changelog: [v1.38.0...v1.39.0](https://github.com/spi-tch/spitch-python/compare/v1.38.0...v1.39.0)
|
|
56
|
+
|
|
57
|
+
### Features
|
|
58
|
+
|
|
59
|
+
* **api:** manual updates ([c02e088](https://github.com/spi-tch/spitch-python/commit/c02e088c99193debbbea6d29f648dfe5435a6585))
|
|
60
|
+
|
|
61
|
+
## 1.38.0 (2025-10-06)
|
|
62
|
+
|
|
63
|
+
Full Changelog: [v1.37.1...v1.38.0](https://github.com/spi-tch/spitch-python/compare/v1.37.1...v1.38.0)
|
|
64
|
+
|
|
65
|
+
### Features
|
|
66
|
+
|
|
67
|
+
* **api:** manual updates ([d84dc7a](https://github.com/spi-tch/spitch-python/commit/d84dc7a2ba91e736117d50c1c5423775ca1c6ed9))
|
|
68
|
+
* **api:** manual updates ([b9b9d1f](https://github.com/spi-tch/spitch-python/commit/b9b9d1fff4e55d8063e2986558385bc6c70a6294))
|
|
69
|
+
* **api:** manual updates ([71da782](https://github.com/spi-tch/spitch-python/commit/71da7823c6b7dd8873204c50854856f4e9f64f6d))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
### Chores
|
|
73
|
+
|
|
74
|
+
* update SDK settings ([eb3676c](https://github.com/spi-tch/spitch-python/commit/eb3676c9b3641a8ec0ed493b730081d925fb9f38))
|
|
75
|
+
|
|
76
|
+
## 1.37.1 (2025-10-06)
|
|
77
|
+
|
|
78
|
+
Full Changelog: [v1.37.0...v1.37.1](https://github.com/spi-tch/spitch-python/compare/v1.37.0...v1.37.1)
|
|
79
|
+
|
|
3
80
|
## 1.37.0 (2025-10-06)
|
|
4
81
|
|
|
5
82
|
Full Changelog: [v1.36.0...v1.37.0](https://github.com/spi-tch/spitch-python/compare/v1.36.0...v1.37.0)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: spitch
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.41.1
|
|
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
|
|
7
|
-
Author-email: Spitch <
|
|
7
|
+
Author-email: Spitch <developer@spitch.app>
|
|
8
8
|
License: Apache-2.0
|
|
9
9
|
Classifier: Intended Audience :: Developers
|
|
10
10
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
@@ -13,7 +13,6 @@ Classifier: Operating System :: Microsoft :: Windows
|
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
14
14
|
Classifier: Operating System :: POSIX
|
|
15
15
|
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -21,7 +20,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.13
|
|
22
21
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
22
|
Classifier: Typing :: Typed
|
|
24
|
-
Requires-Python: >=3.
|
|
23
|
+
Requires-Python: >=3.9
|
|
25
24
|
Requires-Dist: anyio<5,>=3.5.0
|
|
26
25
|
Requires-Dist: cached-property; python_version < '3.8'
|
|
27
26
|
Requires-Dist: distro<2,>=1.7.0
|
|
@@ -31,7 +30,7 @@ Requires-Dist: sniffio
|
|
|
31
30
|
Requires-Dist: typing-extensions<5,>=4.7
|
|
32
31
|
Provides-Extra: aiohttp
|
|
33
32
|
Requires-Dist: aiohttp; extra == 'aiohttp'
|
|
34
|
-
Requires-Dist: httpx-aiohttp>=0.1.
|
|
33
|
+
Requires-Dist: httpx-aiohttp>=0.1.9; extra == 'aiohttp'
|
|
35
34
|
Description-Content-Type: text/markdown
|
|
36
35
|
|
|
37
36
|
# Spitch Python API library
|
|
@@ -39,7 +38,7 @@ Description-Content-Type: text/markdown
|
|
|
39
38
|
<!-- prettier-ignore -->
|
|
40
39
|
[)](https://pypi.org/project/spitch/)
|
|
41
40
|
|
|
42
|
-
The Spitch Python library provides convenient access to the Spitch REST API from any Python 3.
|
|
41
|
+
The Spitch Python library provides convenient access to the Spitch REST API from any Python 3.9+
|
|
43
42
|
application. The library includes type definitions for all request params and response fields,
|
|
44
43
|
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
|
|
45
44
|
|
|
@@ -507,7 +506,7 @@ print(spitch.__version__)
|
|
|
507
506
|
|
|
508
507
|
## Requirements
|
|
509
508
|
|
|
510
|
-
Python 3.
|
|
509
|
+
Python 3.9 or higher.
|
|
511
510
|
|
|
512
511
|
## Contributing
|
|
513
512
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<!-- prettier-ignore -->
|
|
4
4
|
[)](https://pypi.org/project/spitch/)
|
|
5
5
|
|
|
6
|
-
The Spitch Python library provides convenient access to the Spitch REST API from any Python 3.
|
|
6
|
+
The Spitch Python library provides convenient access to the Spitch REST API from any Python 3.9+
|
|
7
7
|
application. The library includes type definitions for all request params and response fields,
|
|
8
8
|
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
|
|
9
9
|
|
|
@@ -471,7 +471,7 @@ print(spitch.__version__)
|
|
|
471
471
|
|
|
472
472
|
## Requirements
|
|
473
473
|
|
|
474
|
-
Python 3.
|
|
474
|
+
Python 3.9 or higher.
|
|
475
475
|
|
|
476
476
|
## Contributing
|
|
477
477
|
|
|
@@ -20,7 +20,7 @@ or products provided by Spitch, please follow the respective company's security
|
|
|
20
20
|
|
|
21
21
|
### Spitch Terms and Policies
|
|
22
22
|
|
|
23
|
-
Please contact
|
|
23
|
+
Please contact developer@spitch.app for any questions or concerns regarding the security of our services.
|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
@@ -29,14 +29,27 @@ Methods:
|
|
|
29
29
|
Types:
|
|
30
30
|
|
|
31
31
|
```python
|
|
32
|
-
from spitch.types import File, FileUsage, Files,
|
|
32
|
+
from spitch.types import File, FileUsage, Files, FileDownloadResponse
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
Methods:
|
|
36
36
|
|
|
37
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.py">SyncFilesCursor[File]</a></code>
|
|
38
|
-
- <code title="delete /v1/files/{file_id}">client.files.<a href="./src/spitch/resources/files.py">delete</a>(file_id) ->
|
|
38
|
+
- <code title="delete /v1/files/{file_id}">client.files.<a href="./src/spitch/resources/files.py">delete</a>(file_id) -> object</code>
|
|
39
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>) -> <a href="./src/spitch/types/file_download_response.py">FileDownloadResponse</a></code>
|
|
40
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.py">File</a></code>
|
|
41
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.py">File</a></code>
|
|
42
42
|
- <code title="get /v1/files:usage">client.files.<a href="./src/spitch/resources/files.py">usage</a>() -> <a href="./src/spitch/types/file_usage.py">FileUsage</a></code>
|
|
43
|
+
|
|
44
|
+
# Jobs
|
|
45
|
+
|
|
46
|
+
Types:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from spitch.types import Job, Jobs
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Methods:
|
|
53
|
+
|
|
54
|
+
- <code title="get /v1/jobs">client.jobs.<a href="./src/spitch/resources/jobs.py">list</a>(\*\*<a href="src/spitch/types/job_list_params.py">params</a>) -> <a href="./src/spitch/types/job.py">SyncFilesCursor[Job]</a></code>
|
|
55
|
+
- <code title="get /v1/jobs/{job_id}">client.jobs.<a href="./src/spitch/resources/jobs.py">get</a>(job_id) -> <a href="./src/spitch/types/job.py">Job</a></code>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "spitch"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.41.1"
|
|
4
4
|
description = "The official Python library for the spitch API"
|
|
5
5
|
dynamic = ["readme"]
|
|
6
6
|
license = "Apache-2.0"
|
|
7
7
|
authors = [
|
|
8
|
-
{ name = "Spitch", email = "
|
|
8
|
+
{ name = "Spitch", email = "developer@spitch.app" },
|
|
9
9
|
]
|
|
10
10
|
dependencies = [
|
|
11
11
|
"httpx>=0.23.0, <0.28.0",
|
|
@@ -16,11 +16,10 @@ dependencies = [
|
|
|
16
16
|
"sniffio",
|
|
17
17
|
"cached-property; python_version < '3.8'",
|
|
18
18
|
]
|
|
19
|
-
requires-python = ">= 3.
|
|
19
|
+
requires-python = ">= 3.9"
|
|
20
20
|
classifiers = [
|
|
21
21
|
"Typing :: Typed",
|
|
22
22
|
"Intended Audience :: Developers",
|
|
23
|
-
"Programming Language :: Python :: 3.8",
|
|
24
23
|
"Programming Language :: Python :: 3.9",
|
|
25
24
|
"Programming Language :: Python :: 3.10",
|
|
26
25
|
"Programming Language :: Python :: 3.11",
|
|
@@ -40,7 +39,7 @@ Homepage = "https://github.com/spi-tch/spitch-python"
|
|
|
40
39
|
Repository = "https://github.com/spi-tch/spitch-python"
|
|
41
40
|
|
|
42
41
|
[project.optional-dependencies]
|
|
43
|
-
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.
|
|
42
|
+
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"]
|
|
44
43
|
|
|
45
44
|
[tool.rye]
|
|
46
45
|
managed = true
|
|
@@ -142,7 +141,7 @@ filterwarnings = [
|
|
|
142
141
|
# there are a couple of flags that are still disabled by
|
|
143
142
|
# default in strict mode as they are experimental and niche.
|
|
144
143
|
typeCheckingMode = "strict"
|
|
145
|
-
pythonVersion = "3.
|
|
144
|
+
pythonVersion = "3.9"
|
|
146
145
|
|
|
147
146
|
exclude = [
|
|
148
147
|
"_dev",
|
|
@@ -225,6 +224,8 @@ select = [
|
|
|
225
224
|
"B",
|
|
226
225
|
# remove unused imports
|
|
227
226
|
"F401",
|
|
227
|
+
# check for missing future annotations
|
|
228
|
+
"FA102",
|
|
228
229
|
# bare except statements
|
|
229
230
|
"E722",
|
|
230
231
|
# unused arguments
|
|
@@ -247,6 +248,8 @@ unfixable = [
|
|
|
247
248
|
"T203",
|
|
248
249
|
]
|
|
249
250
|
|
|
251
|
+
extend-safe-fixes = ["FA102"]
|
|
252
|
+
|
|
250
253
|
[tool.ruff.lint.flake8-tidy-imports.banned-api]
|
|
251
254
|
"functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead"
|
|
252
255
|
|
|
@@ -21,7 +21,7 @@ from ._types import (
|
|
|
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
|
+
from .resources import jobs, text, files, speech
|
|
25
25
|
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
|
26
26
|
from ._exceptions import SpitchError, APIStatusError
|
|
27
27
|
from ._base_client import (
|
|
@@ -47,6 +47,7 @@ class Spitch(SyncAPIClient):
|
|
|
47
47
|
speech: speech.SpeechResource
|
|
48
48
|
text: text.TextResource
|
|
49
49
|
files: files.FilesResource
|
|
50
|
+
jobs: jobs.JobsResource
|
|
50
51
|
with_raw_response: SpitchWithRawResponse
|
|
51
52
|
with_streaming_response: SpitchWithStreamedResponse
|
|
52
53
|
|
|
@@ -107,6 +108,7 @@ class Spitch(SyncAPIClient):
|
|
|
107
108
|
self.speech = speech.SpeechResource(self)
|
|
108
109
|
self.text = text.TextResource(self)
|
|
109
110
|
self.files = files.FilesResource(self)
|
|
111
|
+
self.jobs = jobs.JobsResource(self)
|
|
110
112
|
self.with_raw_response = SpitchWithRawResponse(self)
|
|
111
113
|
self.with_streaming_response = SpitchWithStreamedResponse(self)
|
|
112
114
|
|
|
@@ -219,6 +221,7 @@ class AsyncSpitch(AsyncAPIClient):
|
|
|
219
221
|
speech: speech.AsyncSpeechResource
|
|
220
222
|
text: text.AsyncTextResource
|
|
221
223
|
files: files.AsyncFilesResource
|
|
224
|
+
jobs: jobs.AsyncJobsResource
|
|
222
225
|
with_raw_response: AsyncSpitchWithRawResponse
|
|
223
226
|
with_streaming_response: AsyncSpitchWithStreamedResponse
|
|
224
227
|
|
|
@@ -279,6 +282,7 @@ class AsyncSpitch(AsyncAPIClient):
|
|
|
279
282
|
self.speech = speech.AsyncSpeechResource(self)
|
|
280
283
|
self.text = text.AsyncTextResource(self)
|
|
281
284
|
self.files = files.AsyncFilesResource(self)
|
|
285
|
+
self.jobs = jobs.AsyncJobsResource(self)
|
|
282
286
|
self.with_raw_response = AsyncSpitchWithRawResponse(self)
|
|
283
287
|
self.with_streaming_response = AsyncSpitchWithStreamedResponse(self)
|
|
284
288
|
|
|
@@ -392,6 +396,7 @@ class SpitchWithRawResponse:
|
|
|
392
396
|
self.speech = speech.SpeechResourceWithRawResponse(client.speech)
|
|
393
397
|
self.text = text.TextResourceWithRawResponse(client.text)
|
|
394
398
|
self.files = files.FilesResourceWithRawResponse(client.files)
|
|
399
|
+
self.jobs = jobs.JobsResourceWithRawResponse(client.jobs)
|
|
395
400
|
|
|
396
401
|
|
|
397
402
|
class AsyncSpitchWithRawResponse:
|
|
@@ -399,6 +404,7 @@ class AsyncSpitchWithRawResponse:
|
|
|
399
404
|
self.speech = speech.AsyncSpeechResourceWithRawResponse(client.speech)
|
|
400
405
|
self.text = text.AsyncTextResourceWithRawResponse(client.text)
|
|
401
406
|
self.files = files.AsyncFilesResourceWithRawResponse(client.files)
|
|
407
|
+
self.jobs = jobs.AsyncJobsResourceWithRawResponse(client.jobs)
|
|
402
408
|
|
|
403
409
|
|
|
404
410
|
class SpitchWithStreamedResponse:
|
|
@@ -406,6 +412,7 @@ class SpitchWithStreamedResponse:
|
|
|
406
412
|
self.speech = speech.SpeechResourceWithStreamingResponse(client.speech)
|
|
407
413
|
self.text = text.TextResourceWithStreamingResponse(client.text)
|
|
408
414
|
self.files = files.FilesResourceWithStreamingResponse(client.files)
|
|
415
|
+
self.jobs = jobs.JobsResourceWithStreamingResponse(client.jobs)
|
|
409
416
|
|
|
410
417
|
|
|
411
418
|
class AsyncSpitchWithStreamedResponse:
|
|
@@ -413,6 +420,7 @@ class AsyncSpitchWithStreamedResponse:
|
|
|
413
420
|
self.speech = speech.AsyncSpeechResourceWithStreamingResponse(client.speech)
|
|
414
421
|
self.text = text.AsyncTextResourceWithStreamingResponse(client.text)
|
|
415
422
|
self.files = files.AsyncFilesResourceWithStreamingResponse(client.files)
|
|
423
|
+
self.jobs = jobs.AsyncJobsResourceWithStreamingResponse(client.jobs)
|
|
416
424
|
|
|
417
425
|
|
|
418
426
|
Client = Spitch
|
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
import inspect
|
|
5
|
+
import weakref
|
|
5
6
|
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast
|
|
6
7
|
from datetime import date, datetime
|
|
7
8
|
from typing_extensions import (
|
|
@@ -255,15 +256,16 @@ class BaseModel(pydantic.BaseModel):
|
|
|
255
256
|
mode: Literal["json", "python"] | str = "python",
|
|
256
257
|
include: IncEx | None = None,
|
|
257
258
|
exclude: IncEx | None = None,
|
|
259
|
+
context: Any | None = None,
|
|
258
260
|
by_alias: bool | None = None,
|
|
259
261
|
exclude_unset: bool = False,
|
|
260
262
|
exclude_defaults: bool = False,
|
|
261
263
|
exclude_none: bool = False,
|
|
264
|
+
exclude_computed_fields: bool = False,
|
|
262
265
|
round_trip: bool = False,
|
|
263
266
|
warnings: bool | Literal["none", "warn", "error"] = True,
|
|
264
|
-
context: dict[str, Any] | None = None,
|
|
265
|
-
serialize_as_any: bool = False,
|
|
266
267
|
fallback: Callable[[Any], Any] | None = None,
|
|
268
|
+
serialize_as_any: bool = False,
|
|
267
269
|
) -> dict[str, Any]:
|
|
268
270
|
"""Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump
|
|
269
271
|
|
|
@@ -271,16 +273,24 @@ class BaseModel(pydantic.BaseModel):
|
|
|
271
273
|
|
|
272
274
|
Args:
|
|
273
275
|
mode: The mode in which `to_python` should run.
|
|
274
|
-
If mode is 'json', the
|
|
275
|
-
If mode is 'python', the
|
|
276
|
-
include: A
|
|
277
|
-
exclude: A
|
|
276
|
+
If mode is 'json', the output will only contain JSON serializable types.
|
|
277
|
+
If mode is 'python', the output may contain non-JSON-serializable Python objects.
|
|
278
|
+
include: A set of fields to include in the output.
|
|
279
|
+
exclude: A set of fields to exclude from the output.
|
|
280
|
+
context: Additional context to pass to the serializer.
|
|
278
281
|
by_alias: Whether to use the field's alias in the dictionary key if defined.
|
|
279
|
-
exclude_unset: Whether to exclude fields that
|
|
280
|
-
exclude_defaults: Whether to exclude fields that are set to their default value
|
|
281
|
-
exclude_none: Whether to exclude fields that have a value of `None
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
exclude_unset: Whether to exclude fields that have not been explicitly set.
|
|
283
|
+
exclude_defaults: Whether to exclude fields that are set to their default value.
|
|
284
|
+
exclude_none: Whether to exclude fields that have a value of `None`.
|
|
285
|
+
exclude_computed_fields: Whether to exclude computed fields.
|
|
286
|
+
While this can be useful for round-tripping, it is usually recommended to use the dedicated
|
|
287
|
+
`round_trip` parameter instead.
|
|
288
|
+
round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T].
|
|
289
|
+
warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors,
|
|
290
|
+
"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError].
|
|
291
|
+
fallback: A function to call when an unknown value is encountered. If not provided,
|
|
292
|
+
a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised.
|
|
293
|
+
serialize_as_any: Whether to serialize fields with duck-typing serialization behavior.
|
|
284
294
|
|
|
285
295
|
Returns:
|
|
286
296
|
A dictionary representation of the model.
|
|
@@ -297,6 +307,8 @@ class BaseModel(pydantic.BaseModel):
|
|
|
297
307
|
raise ValueError("serialize_as_any is only supported in Pydantic v2")
|
|
298
308
|
if fallback is not None:
|
|
299
309
|
raise ValueError("fallback is only supported in Pydantic v2")
|
|
310
|
+
if exclude_computed_fields != False:
|
|
311
|
+
raise ValueError("exclude_computed_fields is only supported in Pydantic v2")
|
|
300
312
|
dumped = super().dict( # pyright: ignore[reportDeprecated]
|
|
301
313
|
include=include,
|
|
302
314
|
exclude=exclude,
|
|
@@ -313,15 +325,17 @@ class BaseModel(pydantic.BaseModel):
|
|
|
313
325
|
self,
|
|
314
326
|
*,
|
|
315
327
|
indent: int | None = None,
|
|
328
|
+
ensure_ascii: bool = False,
|
|
316
329
|
include: IncEx | None = None,
|
|
317
330
|
exclude: IncEx | None = None,
|
|
331
|
+
context: Any | None = None,
|
|
318
332
|
by_alias: bool | None = None,
|
|
319
333
|
exclude_unset: bool = False,
|
|
320
334
|
exclude_defaults: bool = False,
|
|
321
335
|
exclude_none: bool = False,
|
|
336
|
+
exclude_computed_fields: bool = False,
|
|
322
337
|
round_trip: bool = False,
|
|
323
338
|
warnings: bool | Literal["none", "warn", "error"] = True,
|
|
324
|
-
context: dict[str, Any] | None = None,
|
|
325
339
|
fallback: Callable[[Any], Any] | None = None,
|
|
326
340
|
serialize_as_any: bool = False,
|
|
327
341
|
) -> str:
|
|
@@ -353,6 +367,10 @@ class BaseModel(pydantic.BaseModel):
|
|
|
353
367
|
raise ValueError("serialize_as_any is only supported in Pydantic v2")
|
|
354
368
|
if fallback is not None:
|
|
355
369
|
raise ValueError("fallback is only supported in Pydantic v2")
|
|
370
|
+
if ensure_ascii != False:
|
|
371
|
+
raise ValueError("ensure_ascii is only supported in Pydantic v2")
|
|
372
|
+
if exclude_computed_fields != False:
|
|
373
|
+
raise ValueError("exclude_computed_fields is only supported in Pydantic v2")
|
|
356
374
|
return super().json( # type: ignore[reportDeprecated]
|
|
357
375
|
indent=indent,
|
|
358
376
|
include=include,
|
|
@@ -569,6 +587,9 @@ class CachedDiscriminatorType(Protocol):
|
|
|
569
587
|
__discriminator__: DiscriminatorDetails
|
|
570
588
|
|
|
571
589
|
|
|
590
|
+
DISCRIMINATOR_CACHE: weakref.WeakKeyDictionary[type, DiscriminatorDetails] = weakref.WeakKeyDictionary()
|
|
591
|
+
|
|
592
|
+
|
|
572
593
|
class DiscriminatorDetails:
|
|
573
594
|
field_name: str
|
|
574
595
|
"""The name of the discriminator field in the variant class, e.g.
|
|
@@ -611,8 +632,9 @@ class DiscriminatorDetails:
|
|
|
611
632
|
|
|
612
633
|
|
|
613
634
|
def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, ...]) -> DiscriminatorDetails | None:
|
|
614
|
-
|
|
615
|
-
|
|
635
|
+
cached = DISCRIMINATOR_CACHE.get(union)
|
|
636
|
+
if cached is not None:
|
|
637
|
+
return cached
|
|
616
638
|
|
|
617
639
|
discriminator_field_name: str | None = None
|
|
618
640
|
|
|
@@ -665,7 +687,7 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
|
|
|
665
687
|
discriminator_field=discriminator_field_name,
|
|
666
688
|
discriminator_alias=discriminator_alias,
|
|
667
689
|
)
|
|
668
|
-
|
|
690
|
+
DISCRIMINATOR_CACHE.setdefault(union, details)
|
|
669
691
|
return details
|
|
670
692
|
|
|
671
693
|
|
|
@@ -57,9 +57,8 @@ class Stream(Generic[_T]):
|
|
|
57
57
|
for sse in iterator:
|
|
58
58
|
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
|
|
59
59
|
|
|
60
|
-
#
|
|
61
|
-
|
|
62
|
-
...
|
|
60
|
+
# As we might not fully consume the response stream, we need to close it explicitly
|
|
61
|
+
response.close()
|
|
63
62
|
|
|
64
63
|
def __enter__(self) -> Self:
|
|
65
64
|
return self
|
|
@@ -121,9 +120,8 @@ class AsyncStream(Generic[_T]):
|
|
|
121
120
|
async for sse in iterator:
|
|
122
121
|
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
|
|
123
122
|
|
|
124
|
-
#
|
|
125
|
-
|
|
126
|
-
...
|
|
123
|
+
# As we might not fully consume the response stream, we need to close it explicitly
|
|
124
|
+
await response.aclose()
|
|
127
125
|
|
|
128
126
|
async def __aenter__(self) -> Self:
|
|
129
127
|
return self
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import sys
|
|
4
3
|
import asyncio
|
|
5
4
|
import functools
|
|
6
|
-
import
|
|
7
|
-
from typing import Any, TypeVar, Callable, Awaitable
|
|
5
|
+
from typing import TypeVar, Callable, Awaitable
|
|
8
6
|
from typing_extensions import ParamSpec
|
|
9
7
|
|
|
10
8
|
import anyio
|
|
@@ -15,34 +13,11 @@ T_Retval = TypeVar("T_Retval")
|
|
|
15
13
|
T_ParamSpec = ParamSpec("T_ParamSpec")
|
|
16
14
|
|
|
17
15
|
|
|
18
|
-
if sys.version_info >= (3, 9):
|
|
19
|
-
_asyncio_to_thread = asyncio.to_thread
|
|
20
|
-
else:
|
|
21
|
-
# backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread
|
|
22
|
-
# for Python 3.8 support
|
|
23
|
-
async def _asyncio_to_thread(
|
|
24
|
-
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
|
|
25
|
-
) -> Any:
|
|
26
|
-
"""Asynchronously run function *func* in a separate thread.
|
|
27
|
-
|
|
28
|
-
Any *args and **kwargs supplied for this function are directly passed
|
|
29
|
-
to *func*. Also, the current :class:`contextvars.Context` is propagated,
|
|
30
|
-
allowing context variables from the main thread to be accessed in the
|
|
31
|
-
separate thread.
|
|
32
|
-
|
|
33
|
-
Returns a coroutine that can be awaited to get the eventual result of *func*.
|
|
34
|
-
"""
|
|
35
|
-
loop = asyncio.events.get_running_loop()
|
|
36
|
-
ctx = contextvars.copy_context()
|
|
37
|
-
func_call = functools.partial(ctx.run, func, *args, **kwargs)
|
|
38
|
-
return await loop.run_in_executor(None, func_call)
|
|
39
|
-
|
|
40
|
-
|
|
41
16
|
async def to_thread(
|
|
42
17
|
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
|
|
43
18
|
) -> T_Retval:
|
|
44
19
|
if sniffio.current_async_library() == "asyncio":
|
|
45
|
-
return await
|
|
20
|
+
return await asyncio.to_thread(func, *args, **kwargs)
|
|
46
21
|
|
|
47
22
|
return await anyio.to_thread.run_sync(
|
|
48
23
|
functools.partial(func, *args, **kwargs),
|
|
@@ -53,10 +28,7 @@ async def to_thread(
|
|
|
53
28
|
def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]:
|
|
54
29
|
"""
|
|
55
30
|
Take a blocking function and create an async one that receives the same
|
|
56
|
-
positional and keyword arguments.
|
|
57
|
-
asyncio.to_thread to run the function in a separate thread. For python version
|
|
58
|
-
3.8, it uses locally defined copy of the asyncio.to_thread function which was
|
|
59
|
-
introduced in python 3.9.
|
|
31
|
+
positional and keyword arguments.
|
|
60
32
|
|
|
61
33
|
Usage:
|
|
62
34
|
|
|
@@ -133,7 +133,7 @@ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]:
|
|
|
133
133
|
# Type safe methods for narrowing types with TypeVars.
|
|
134
134
|
# The default narrowing for isinstance(obj, dict) is dict[unknown, unknown],
|
|
135
135
|
# however this cause Pyright to rightfully report errors. As we know we don't
|
|
136
|
-
# care about the contained types we can safely use `object` in
|
|
136
|
+
# care about the contained types we can safely use `object` in its place.
|
|
137
137
|
#
|
|
138
138
|
# There are two separate functions defined, `is_*` and `is_*_t` for different use cases.
|
|
139
139
|
# `is_*` is for when you're dealing with an unknown input
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
+
from .jobs import (
|
|
4
|
+
JobsResource,
|
|
5
|
+
AsyncJobsResource,
|
|
6
|
+
JobsResourceWithRawResponse,
|
|
7
|
+
AsyncJobsResourceWithRawResponse,
|
|
8
|
+
JobsResourceWithStreamingResponse,
|
|
9
|
+
AsyncJobsResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
3
11
|
from .text import (
|
|
4
12
|
TextResource,
|
|
5
13
|
AsyncTextResource,
|
|
@@ -44,4 +52,10 @@ __all__ = [
|
|
|
44
52
|
"AsyncFilesResourceWithRawResponse",
|
|
45
53
|
"FilesResourceWithStreamingResponse",
|
|
46
54
|
"AsyncFilesResourceWithStreamingResponse",
|
|
55
|
+
"JobsResource",
|
|
56
|
+
"AsyncJobsResource",
|
|
57
|
+
"JobsResourceWithRawResponse",
|
|
58
|
+
"AsyncJobsResourceWithRawResponse",
|
|
59
|
+
"JobsResourceWithStreamingResponse",
|
|
60
|
+
"AsyncJobsResourceWithStreamingResponse",
|
|
47
61
|
]
|