spitch 1.34.0__tar.gz → 1.36.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.

Files changed (92) hide show
  1. spitch-1.36.0/.release-please-manifest.json +3 -0
  2. {spitch-1.34.0 → spitch-1.36.0}/CHANGELOG.md +40 -0
  3. {spitch-1.34.0 → spitch-1.36.0}/PKG-INFO +83 -12
  4. {spitch-1.34.0 → spitch-1.36.0}/README.md +82 -11
  5. spitch-1.36.0/api.md +42 -0
  6. {spitch-1.34.0 → spitch-1.36.0}/pyproject.toml +55 -3
  7. {spitch-1.34.0 → spitch-1.36.0}/requirements-dev.lock +5 -3
  8. {spitch-1.34.0 → spitch-1.36.0}/requirements.lock +6 -3
  9. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/__init__.py +3 -1
  10. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_base_client.py +12 -12
  11. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_client.py +33 -24
  12. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_compat.py +47 -47
  13. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_models.py +51 -45
  14. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_qs.py +7 -7
  15. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_types.py +53 -12
  16. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_utils/__init__.py +9 -2
  17. spitch-1.36.0/src/spitch/_utils/_compat.py +45 -0
  18. spitch-1.36.0/src/spitch/_utils/_datetime_parse.py +136 -0
  19. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_utils/_transform.py +13 -3
  20. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_utils/_typing.py +6 -1
  21. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_utils/_utils.py +4 -5
  22. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_version.py +1 -1
  23. spitch-1.36.0/src/spitch/pagination.py +50 -0
  24. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/resources/__init__.py +14 -0
  25. spitch-1.36.0/src/spitch/resources/files.py +580 -0
  26. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/resources/speech.py +22 -22
  27. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/resources/text.py +15 -15
  28. spitch-1.36.0/src/spitch/types/__init__.py +19 -0
  29. spitch-1.34.0/src/spitch/types/text_tone_mark_response.py → spitch-1.36.0/src/spitch/types/diacritics.py +2 -2
  30. spitch-1.36.0/src/spitch/types/file.py +26 -0
  31. spitch-1.36.0/src/spitch/types/file_delete_response.py +11 -0
  32. spitch-1.36.0/src/spitch/types/file_download_params.py +11 -0
  33. spitch-1.36.0/src/spitch/types/file_download_response.py +15 -0
  34. spitch-1.36.0/src/spitch/types/file_list_params.py +16 -0
  35. spitch-1.36.0/src/spitch/types/file_upload_params.py +13 -0
  36. spitch-1.36.0/src/spitch/types/file_usage.py +17 -0
  37. spitch-1.36.0/src/spitch/types/files.py +14 -0
  38. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/types/speech_transcribe_params.py +1 -1
  39. spitch-1.34.0/src/spitch/types/speech_transcribe_response.py → spitch-1.36.0/src/spitch/types/transcription.py +2 -2
  40. spitch-1.34.0/src/spitch/types/text_translate_response.py → spitch-1.36.0/src/spitch/types/translation.py +2 -2
  41. spitch-1.36.0/tests/api_resources/test_files.py +454 -0
  42. {spitch-1.34.0 → spitch-1.36.0}/tests/api_resources/test_speech.py +9 -9
  43. {spitch-1.34.0 → spitch-1.36.0}/tests/api_resources/test_text.py +13 -13
  44. {spitch-1.34.0 → spitch-1.36.0}/tests/test_client.py +6 -47
  45. {spitch-1.34.0 → spitch-1.36.0}/tests/test_models.py +24 -24
  46. {spitch-1.34.0 → spitch-1.36.0}/tests/test_transform.py +17 -10
  47. spitch-1.36.0/tests/test_utils/test_datetime_parse.py +110 -0
  48. {spitch-1.34.0 → spitch-1.36.0}/tests/utils.py +13 -5
  49. spitch-1.34.0/.release-please-manifest.json +0 -3
  50. spitch-1.34.0/api.md +0 -25
  51. spitch-1.34.0/mypy.ini +0 -47
  52. spitch-1.34.0/src/spitch/types/__init__.py +0 -11
  53. {spitch-1.34.0 → spitch-1.36.0}/.gitignore +0 -0
  54. {spitch-1.34.0 → spitch-1.36.0}/CONTRIBUTING.md +0 -0
  55. {spitch-1.34.0 → spitch-1.36.0}/LICENSE +0 -0
  56. {spitch-1.34.0 → spitch-1.36.0}/SECURITY.md +0 -0
  57. {spitch-1.34.0 → spitch-1.36.0}/bin/check-release-environment +0 -0
  58. {spitch-1.34.0 → spitch-1.36.0}/bin/publish-pypi +0 -0
  59. {spitch-1.34.0 → spitch-1.36.0}/examples/.keep +0 -0
  60. {spitch-1.34.0 → spitch-1.36.0}/examples/example.py +0 -0
  61. {spitch-1.34.0 → spitch-1.36.0}/noxfile.py +0 -0
  62. {spitch-1.34.0 → spitch-1.36.0}/release-please-config.json +0 -0
  63. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_constants.py +0 -0
  64. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_exceptions.py +0 -0
  65. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_files.py +0 -0
  66. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_resource.py +0 -0
  67. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_response.py +0 -0
  68. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_streaming.py +0 -0
  69. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_utils/_logs.py +0 -0
  70. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_utils/_proxy.py +0 -0
  71. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_utils/_reflection.py +0 -0
  72. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_utils/_resources_proxy.py +0 -0
  73. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_utils/_streams.py +0 -0
  74. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/_utils/_sync.py +0 -0
  75. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/lib/.keep +0 -0
  76. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/py.typed +0 -0
  77. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/types/speech_generate_params.py +0 -0
  78. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/types/text_tone_mark_params.py +0 -0
  79. {spitch-1.34.0 → spitch-1.36.0}/src/spitch/types/text_translate_params.py +0 -0
  80. {spitch-1.34.0 → spitch-1.36.0}/tests/__init__.py +0 -0
  81. {spitch-1.34.0 → spitch-1.36.0}/tests/api_resources/__init__.py +0 -0
  82. {spitch-1.34.0 → spitch-1.36.0}/tests/conftest.py +0 -0
  83. {spitch-1.34.0 → spitch-1.36.0}/tests/sample_file.txt +0 -0
  84. {spitch-1.34.0 → spitch-1.36.0}/tests/test_deepcopy.py +0 -0
  85. {spitch-1.34.0 → spitch-1.36.0}/tests/test_extract_files.py +0 -0
  86. {spitch-1.34.0 → spitch-1.36.0}/tests/test_files.py +0 -0
  87. {spitch-1.34.0 → spitch-1.36.0}/tests/test_qs.py +0 -0
  88. {spitch-1.34.0 → spitch-1.36.0}/tests/test_required_args.py +0 -0
  89. {spitch-1.34.0 → spitch-1.36.0}/tests/test_response.py +0 -0
  90. {spitch-1.34.0 → spitch-1.36.0}/tests/test_streaming.py +0 -0
  91. {spitch-1.34.0 → spitch-1.36.0}/tests/test_utils/test_proxy.py +0 -0
  92. {spitch-1.34.0 → spitch-1.36.0}/tests/test_utils/test_typing.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "1.36.0"
3
+ }
@@ -1,5 +1,45 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.36.0 (2025-10-06)
4
+
5
+ Full Changelog: [v1.35.0...v1.36.0](https://github.com/spi-tch/spitch-python/compare/v1.35.0...v1.36.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** manual updates ([813fc60](https://github.com/spi-tch/spitch-python/commit/813fc60ce810fc61aa542eae3a780bce8b21e506))
10
+
11
+ ## 1.35.0 (2025-10-06)
12
+
13
+ Full Changelog: [v1.34.0...v1.35.0](https://github.com/spi-tch/spitch-python/compare/v1.34.0...v1.35.0)
14
+
15
+ ### Features
16
+
17
+ * **api:** manual updates ([574df33](https://github.com/spi-tch/spitch-python/commit/574df333fdbdc5da00db8995c76764ef35525a98))
18
+ * **api:** manual updates ([ead4d0f](https://github.com/spi-tch/spitch-python/commit/ead4d0f08f3b28578c1a5caea262290dc04d8b27))
19
+ * improve future compat with pydantic v3 ([d0bad68](https://github.com/spi-tch/spitch-python/commit/d0bad682b3e6b51dc0c37c7779a1a87476bd06b2))
20
+ * **types:** replace List[str] with SequenceNotStr in params ([7c4068d](https://github.com/spi-tch/spitch-python/commit/7c4068d1941ff82258c64ea2308574d7f18fd9eb))
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * avoid newer type syntax ([8ca197e](https://github.com/spi-tch/spitch-python/commit/8ca197e3a5dee3caa13c202561a571bd27f426d6))
26
+
27
+
28
+ ### Chores
29
+
30
+ * do not install brew dependencies in ./scripts/bootstrap by default ([65b9b27](https://github.com/spi-tch/spitch-python/commit/65b9b27f367eaf8acd5ac279477133bcc16d474e))
31
+ * **internal:** add Sequence related utils ([165bc5b](https://github.com/spi-tch/spitch-python/commit/165bc5bf7aab042eb26329511d7c3710e8f3013f))
32
+ * **internal:** change ci workflow machines ([47a8c37](https://github.com/spi-tch/spitch-python/commit/47a8c37c9f69a1ab81018ef18e210a6b9ccd3b61))
33
+ * **internal:** codegen related update ([2b78c91](https://github.com/spi-tch/spitch-python/commit/2b78c91f092d0a21452bdf49c1ca030aad41659e))
34
+ * **internal:** fix ruff target version ([8b255f3](https://github.com/spi-tch/spitch-python/commit/8b255f361be3c261ea1949109566caa3ab149000))
35
+ * **internal:** move mypy configurations to `pyproject.toml` file ([a72dfb3](https://github.com/spi-tch/spitch-python/commit/a72dfb3a9f8664c9fe65b8828c730e32d6eb2fe6))
36
+ * **internal:** update comment in script ([b369538](https://github.com/spi-tch/spitch-python/commit/b369538413c8f30c37f58ff479c93cbc592512ee))
37
+ * **internal:** update pydantic dependency ([a187d65](https://github.com/spi-tch/spitch-python/commit/a187d658fd4b0b6dfadac17a88f50bf93569cdda))
38
+ * **internal:** update pyright exclude list ([c2f65df](https://github.com/spi-tch/spitch-python/commit/c2f65df82191ffc6f25baf52eb8b5a30fbbaa4df))
39
+ * **types:** change optional parameter type from NotGiven to Omit ([aa74911](https://github.com/spi-tch/spitch-python/commit/aa74911c2a673a56720e2dab3264151423f88b25))
40
+ * update @stainless-api/prism-cli to v5.15.0 ([d0371a7](https://github.com/spi-tch/spitch-python/commit/d0371a73586deac608ce2e4fae2439b477f90702))
41
+ * update github action ([c3e1045](https://github.com/spi-tch/spitch-python/commit/c3e1045cbfbf202f009042c0de01cd0007881e25))
42
+
3
43
  ## 1.34.0 (2025-08-05)
4
44
 
5
45
  Full Changelog: [v1.33.0...v1.34.0](https://github.com/spi-tch/spitch-python/compare/v1.33.0...v1.34.0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: spitch
3
- Version: 1.34.0
3
+ Version: 1.36.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
@@ -70,8 +70,8 @@ client = Spitch(
70
70
 
71
71
  response = client.speech.generate(
72
72
  language="yo",
73
- text="text",
74
- voice="sade",
73
+ text="Bawo ni, ololufe?",
74
+ voice="femi",
75
75
  )
76
76
  ```
77
77
 
@@ -97,8 +97,8 @@ client = AsyncSpitch(
97
97
  async def main() -> None:
98
98
  response = await client.speech.generate(
99
99
  language="yo",
100
- text="text",
101
- voice="sade",
100
+ text="Bawo ni, ololufe?",
101
+ voice="femi",
102
102
  )
103
103
 
104
104
 
@@ -133,8 +133,8 @@ async def main() -> None:
133
133
  ) as client:
134
134
  response = await client.speech.generate(
135
135
  language="yo",
136
- text="text",
137
- voice="sade",
136
+ text="Bawo ni, ololufe?",
137
+ voice="femi",
138
138
  )
139
139
 
140
140
 
@@ -150,6 +150,77 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
150
150
 
151
151
  Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
152
152
 
153
+ ## Pagination
154
+
155
+ List methods in the Spitch API are paginated.
156
+
157
+ This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:
158
+
159
+ ```python
160
+ from spitch import Spitch
161
+
162
+ client = Spitch()
163
+
164
+ all_files = []
165
+ # Automatically fetches more pages as needed.
166
+ for file in client.files.list(
167
+ limit=10,
168
+ ):
169
+ # Do something with file here
170
+ all_files.append(file)
171
+ print(all_files)
172
+ ```
173
+
174
+ Or, asynchronously:
175
+
176
+ ```python
177
+ import asyncio
178
+ from spitch import AsyncSpitch
179
+
180
+ client = AsyncSpitch()
181
+
182
+
183
+ async def main() -> None:
184
+ all_files = []
185
+ # Iterate through items across all pages, issuing requests as needed.
186
+ async for file in client.files.list(
187
+ limit=10,
188
+ ):
189
+ all_files.append(file)
190
+ print(all_files)
191
+
192
+
193
+ asyncio.run(main())
194
+ ```
195
+
196
+ Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:
197
+
198
+ ```python
199
+ first_page = await client.files.list(
200
+ limit=10,
201
+ )
202
+ if first_page.has_next_page():
203
+ print(f"will fetch next page using these details: {first_page.next_page_info()}")
204
+ next_page = await first_page.get_next_page()
205
+ print(f"number of items we just fetched: {len(next_page.items)}")
206
+
207
+ # Remove `await` for non-async usage.
208
+ ```
209
+
210
+ Or just work directly with the returned data:
211
+
212
+ ```python
213
+ first_page = await client.files.list(
214
+ limit=10,
215
+ )
216
+
217
+ print(f"next page cursor: {first_page.next_cursor}") # => "next page cursor: ..."
218
+ for file in first_page.items:
219
+ print(file.file_id)
220
+
221
+ # Remove `await` for non-async usage.
222
+ ```
223
+
153
224
  ## File uploads
154
225
 
155
226
  Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
@@ -186,7 +257,7 @@ client = Spitch()
186
257
  try:
187
258
  client.speech.generate(
188
259
  language="yo",
189
- text="text",
260
+ text="Bawo ni, ololufe?",
190
261
  voice="sade",
191
262
  )
192
263
  except spitch.APIConnectionError as e:
@@ -233,7 +304,7 @@ client = Spitch(
233
304
  # Or, configure per-request:
234
305
  client.with_options(max_retries=5).speech.generate(
235
306
  language="yo",
236
- text="text",
307
+ text="Bawo ni, ololufe?",
237
308
  voice="sade",
238
309
  )
239
310
  ```
@@ -260,7 +331,7 @@ client = Spitch(
260
331
  # Override per-request:
261
332
  client.with_options(timeout=5.0).speech.generate(
262
333
  language="yo",
263
- text="text",
334
+ text="Bawo ni, ololufe?",
264
335
  voice="sade",
265
336
  )
266
337
  ```
@@ -303,7 +374,7 @@ from spitch import Spitch
303
374
  client = Spitch()
304
375
  response = client.speech.with_raw_response.generate(
305
376
  language="yo",
306
- text="text",
377
+ text="Bawo ni, ololufe?",
307
378
  voice="sade",
308
379
  )
309
380
  print(response.headers.get('X-My-Header'))
@@ -325,7 +396,7 @@ To stream the response body, use `.with_streaming_response` instead, which requi
325
396
  ```python
326
397
  with client.speech.with_streaming_response.generate(
327
398
  language="yo",
328
- text="text",
399
+ text="Bawo ni, ololufe?",
329
400
  voice="sade",
330
401
  ) as response:
331
402
  print(response.headers.get("X-My-Header"))
@@ -34,8 +34,8 @@ client = Spitch(
34
34
 
35
35
  response = client.speech.generate(
36
36
  language="yo",
37
- text="text",
38
- voice="sade",
37
+ text="Bawo ni, ololufe?",
38
+ voice="femi",
39
39
  )
40
40
  ```
41
41
 
@@ -61,8 +61,8 @@ client = AsyncSpitch(
61
61
  async def main() -> None:
62
62
  response = await client.speech.generate(
63
63
  language="yo",
64
- text="text",
65
- voice="sade",
64
+ text="Bawo ni, ololufe?",
65
+ voice="femi",
66
66
  )
67
67
 
68
68
 
@@ -97,8 +97,8 @@ async def main() -> None:
97
97
  ) as client:
98
98
  response = await client.speech.generate(
99
99
  language="yo",
100
- text="text",
101
- voice="sade",
100
+ text="Bawo ni, ololufe?",
101
+ voice="femi",
102
102
  )
103
103
 
104
104
 
@@ -114,6 +114,77 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
114
114
 
115
115
  Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
116
116
 
117
+ ## Pagination
118
+
119
+ List methods in the Spitch API are paginated.
120
+
121
+ This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:
122
+
123
+ ```python
124
+ from spitch import Spitch
125
+
126
+ client = Spitch()
127
+
128
+ all_files = []
129
+ # Automatically fetches more pages as needed.
130
+ for file in client.files.list(
131
+ limit=10,
132
+ ):
133
+ # Do something with file here
134
+ all_files.append(file)
135
+ print(all_files)
136
+ ```
137
+
138
+ Or, asynchronously:
139
+
140
+ ```python
141
+ import asyncio
142
+ from spitch import AsyncSpitch
143
+
144
+ client = AsyncSpitch()
145
+
146
+
147
+ async def main() -> None:
148
+ all_files = []
149
+ # Iterate through items across all pages, issuing requests as needed.
150
+ async for file in client.files.list(
151
+ limit=10,
152
+ ):
153
+ all_files.append(file)
154
+ print(all_files)
155
+
156
+
157
+ asyncio.run(main())
158
+ ```
159
+
160
+ Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:
161
+
162
+ ```python
163
+ first_page = await client.files.list(
164
+ limit=10,
165
+ )
166
+ if first_page.has_next_page():
167
+ print(f"will fetch next page using these details: {first_page.next_page_info()}")
168
+ next_page = await first_page.get_next_page()
169
+ print(f"number of items we just fetched: {len(next_page.items)}")
170
+
171
+ # Remove `await` for non-async usage.
172
+ ```
173
+
174
+ Or just work directly with the returned data:
175
+
176
+ ```python
177
+ first_page = await client.files.list(
178
+ limit=10,
179
+ )
180
+
181
+ print(f"next page cursor: {first_page.next_cursor}") # => "next page cursor: ..."
182
+ for file in first_page.items:
183
+ print(file.file_id)
184
+
185
+ # Remove `await` for non-async usage.
186
+ ```
187
+
117
188
  ## File uploads
118
189
 
119
190
  Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
@@ -150,7 +221,7 @@ client = Spitch()
150
221
  try:
151
222
  client.speech.generate(
152
223
  language="yo",
153
- text="text",
224
+ text="Bawo ni, ololufe?",
154
225
  voice="sade",
155
226
  )
156
227
  except spitch.APIConnectionError as e:
@@ -197,7 +268,7 @@ client = Spitch(
197
268
  # Or, configure per-request:
198
269
  client.with_options(max_retries=5).speech.generate(
199
270
  language="yo",
200
- text="text",
271
+ text="Bawo ni, ololufe?",
201
272
  voice="sade",
202
273
  )
203
274
  ```
@@ -224,7 +295,7 @@ client = Spitch(
224
295
  # Override per-request:
225
296
  client.with_options(timeout=5.0).speech.generate(
226
297
  language="yo",
227
- text="text",
298
+ text="Bawo ni, ololufe?",
228
299
  voice="sade",
229
300
  )
230
301
  ```
@@ -267,7 +338,7 @@ from spitch import Spitch
267
338
  client = Spitch()
268
339
  response = client.speech.with_raw_response.generate(
269
340
  language="yo",
270
- text="text",
341
+ text="Bawo ni, ololufe?",
271
342
  voice="sade",
272
343
  )
273
344
  print(response.headers.get('X-My-Header'))
@@ -289,7 +360,7 @@ To stream the response body, use `.with_streaming_response` instead, which requi
289
360
  ```python
290
361
  with client.speech.with_streaming_response.generate(
291
362
  language="yo",
292
- text="text",
363
+ text="Bawo ni, ololufe?",
293
364
  voice="sade",
294
365
  ) as response:
295
366
  print(response.headers.get("X-My-Header"))
spitch-1.36.0/api.md ADDED
@@ -0,0 +1,42 @@
1
+ # Speech
2
+
3
+ Types:
4
+
5
+ ```python
6
+ from spitch.types import Transcription
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/transcription.py">Transcription</a></code>
13
+
14
+ # Text
15
+
16
+ Types:
17
+
18
+ ```python
19
+ from spitch.types import Diacritics, Translation
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/diacritics.py">Diacritics</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/translation.py">Translation</a></code>
26
+
27
+ # Files
28
+
29
+ Types:
30
+
31
+ ```python
32
+ from spitch.types import File, Files, FileUsage, FileDeleteResponse, FileDownloadResponse
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.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) -> <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>) -> <a href="./src/spitch/types/file_download_response.py">FileDownloadResponse</a></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.py">File</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.py">File</a></code>
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>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "spitch"
3
- version = "1.34.0"
3
+ version = "1.36.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 = "py37"
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.2
91
+ pydantic==2.11.9
93
92
  # via spitch
94
- pydantic-core==2.23.4
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.2
58
+ pydantic==2.11.9
59
59
  # via spitch
60
- pydantic-core==2.23.4
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
- yarl==1.20.1
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 PYDANTIC_V2, model_copy, model_dump
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 = NOT_GIVEN,
149
- json: Body | NotGiven = NOT_GIVEN,
150
- params: Query | NotGiven = NOT_GIVEN,
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 PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
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 PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
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, NOT_GIVEN)
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 = NOT_GIVEN,
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 = NOT_GIVEN,
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 = NOT_GIVEN,
1826
- post_parser: PostParser | NotGiven = NOT_GIVEN,
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 = {}