Skip to content

Commit 9576035

Browse files
github-actions[bot]speakeasybotawalker4
authored
chore: 🐝 Update SDK - Generate 0.30.0 (#222)
> [!IMPORTANT] > Linting report available at: <https://app.speakeasy.com/org/unstructured/unstructured5xr/linting-report/d1ac8871f6009c5cc7071b32e3c42481> > OpenAPI Change report available at: <https://app.speakeasy.com/org/unstructured/unstructured5xr/changes-report/18a6a5148fd566fe6678e62d6a0ef4c5> # SDK update Based on: - OpenAPI Doc - Speakeasy CLI 1.490.0 (2.512.0) https://github.com/speakeasy-api/speakeasy ## Versioning Version Bump Type: [minor] - 🤖 (automated) ## OpenAPI Change Summary ``` ├─┬Info │ ├──[🔀] title (4:14) │ └──[🔀] version (5:16) ├─┬Paths │ ├──[➕] path (1396:5) │ ├──[➕] path (595:5) │ ├──[➕] path (797:5) │ ├──[➕] path (253:5) │ ├──[➕] path (455:5) │ ├──[➕] path (890:5) │ ├──[➕] path (956:5) │ ├──[➕] path (1020:5) │ ├──[➕] path (1194:5) │ ├──[➕] path (113:5) │ └─┬/general/v0/general │ └─┬POST │ └─┬Servers │ └──[➕] servers (94:20) ├─┬Servers │ └──[➖] servers (1:102)❌ └─┬Components ├──[➕] schemas (2462:30) ├──[➕] schemas (2049:23) ├──[➕] schemas (2387:25) ├──[➕] schemas (2062:42) ├──[➕] schemas (2135:35) ├──[➕] schemas (2307:37) ├──[➕] schemas (2607:27) ├──[➕] schemas (2632:24) ├──[➕] schemas (2640:23) ├──[➕] schemas (2597:27) ├──[➕] schemas (1890:37) ├──[➕] schemas (1988:25) ├──[➕] schemas (2162:25) ├──[➕] schemas (2347:32) ├──[➕] schemas (1939:32) ├──[➕] schemas (2564:23) ├──[➕] schemas (2211:37) ├──[➕] schemas (2284:30) ├─┬partition_parameters │ └─┬chunking_strategy │ ├─┬ANYOF │ │ ├──[🔀] type (1702:25)❌ │ │ └──[➕] default (1703:28)❌ │ └─┬ANYOF │ ├──[➖] enum (1:7220)❌ │ ├──[➖] enum (1:7231)❌ │ ├──[➖] enum (1:7248)❌ │ ├──[➖] enum (1:7211)❌ │ ├──[🔀] type (1706:25)❌ │ └──[➖] default (1:7272)❌ └─┬HTTPValidationError ├──[➕] title (1476:18) ├──[➖] example (1:1982) └─┬detail ├──[➕] items (1470:22)❌ ├──[➕] type (1469:21)❌ ├──[➕] title (1473:22) ├──[➖] oneOf (1:1870)❌ └──[➖] oneOf (1:1948)❌ ``` | Document Element | Total Changes | Breaking Changes | |------------------|---------------|------------------| | info | 2 | 0 | | paths | 11 | 0 | | servers | 1 | 1 | | components | 33 | 12 | ## PYTHON CHANGELOG ## core: 5.11.0 - 2025-02-04 ### 🐝 New Features - make testing security example matching more forgiving *(commit by [@ryan-timothy-albert](https://github.com/ryan-timothy-albert))* ## core: 5.10.9 - 2025-01-31 ### 🐛 Bug Fixes - fixed handling of default fields in usage snippets and tests, fixed validation of required schema property *(commit by [@TristanSpeakEasy](https://github.com/tristanspeakeasy))* ## core: 5.10.8 - 2025-01-30 ### 🐛 Bug Fixes - fixed handling of field names conflicting with reserved keywords *(commit by [@TristanSpeakEasy](https://github.com/tristanspeakeasy))* ## core: 5.10.7 - 2025-01-29 ### 🐛 Bug Fixes - allow for no global server url on pythonv2 sdks *(commit by [@walker-tx](https://github.com/walker-tx))* ## core: 5.10.6 - 2025-01-27 ### 🐛 Bug Fixes - sort subresponses based on the worst scoring response in the group to ensure that no unreachable code paths are created *(commit by [@idbentley](https://github.com/idbentley))* ## core: 5.10.5 - 2025-01-23 ### 🐛 Bug Fixes - register finalizer function to close httpx clients and document context manager usage *(commit by [@disintegrator](https://github.com/disintegrator))* ## core: 5.10.4 - 2025-01-20 ### 🐛 Bug Fixes - unpin pythonv2 dependencies *(commit by [@disintegrator](https://github.com/disintegrator))* ## core: 5.10.3 - 2025-01-20 ### 🐛 Bug Fixes - fixed handling of additional dependencies and running of python tests *(commit by [@TristanSpeakEasy](https://github.com/tristanspeakeasy))* ## core: 5.10.2 - 2025-01-13 ### 🐛 Bug Fixes - handle 4XX and 5XX error ranges seperately *(commit by [@idbentley](https://github.com/idbentley))* ## globalSecurity: 3.0.3 - 2025-02-06 ### 🐛 Bug Fixes - fixes to handling of security at both global and operation level especially for oauth2 *(commit by [@TristanSpeakEasy](https://github.com/tristanspeakeasy))* ## methodServerURLs: 3.1.1 - 2025-01-09 ### 🐛 Bug Fixes - add missing import for per-operation servers *(commit by [@disintegrator](https://github.com/disintegrator))* --------- Co-authored-by: speakeasybot <[email protected]> Co-authored-by: Austin Walker <[email protected]>
1 parent 7202534 commit 9576035

File tree

131 files changed

+9656
-256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+9656
-256
lines changed

Diff for: .speakeasy/gen.lock

+309-13
Large diffs are not rendered by default.

Diff for: .speakeasy/workflow.lock

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
speakeasyVersion: 1.468.6
1+
speakeasyVersion: 1.488.0
22
sources:
33
my-source:
44
sourceNamespace: my-source
5-
sourceRevisionDigest: sha256:54175e5c24d314f86f33f72766514aae3730046ac37c53dc9096391d42db22e1
6-
sourceBlobDigest: sha256:4a1f22c295063b53f9ffd80d429877a1857889cd4cd216808a5ad3077b0fde4d
5+
sourceRevisionDigest: sha256:38de94b8fb4d2ee973b988986c3e0dcd2e2deaf6de38ef40ac58067728720315
6+
sourceBlobDigest: sha256:2cc0f6d125e0a830dfd67e8fc18d001981832c93783af5c9da0d81841deea9f8
77
tags:
88
- latest
9-
- speakeasy-sdk-regen-1736554181
10-
- 1.0.58
9+
- speakeasy-sdk-regen-1739216953
10+
- 1.0.0
1111
targets:
1212
unstructured-python:
1313
source: my-source
1414
sourceNamespace: my-source
15-
sourceRevisionDigest: sha256:54175e5c24d314f86f33f72766514aae3730046ac37c53dc9096391d42db22e1
16-
sourceBlobDigest: sha256:4a1f22c295063b53f9ffd80d429877a1857889cd4cd216808a5ad3077b0fde4d
15+
sourceRevisionDigest: sha256:38de94b8fb4d2ee973b988986c3e0dcd2e2deaf6de38ef40ac58067728720315
16+
sourceBlobDigest: sha256:2cc0f6d125e0a830dfd67e8fc18d001981832c93783af5c9da0d81841deea9f8
1717
codeSamplesNamespace: my-source-code-samples
18-
codeSamplesRevisionDigest: sha256:7aff54e905b986e29c396c5d1b4142521dd48c2db25190d45ca0a3fb3d3b7346
18+
codeSamplesRevisionDigest: sha256:1f17aac0d1c9f3ea69a6d6f4c74814935b8b8210034200d60883eb3662b54ee1
1919
workflow:
2020
workflowVersion: 1.0.0
2121
speakeasyVersion: latest
2222
sources:
2323
my-source:
2424
inputs:
2525
- location: https://api.unstructured.io/general/openapi.json
26+
- location: https://platform.unstructuredapp.io/openapi.json
2627
overlays:
2728
- location: ./overlay_client.yaml
2829
registry:

Diff for: Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ download-openapi-specs:
7171
## client-merge-serverless-platform: Merge the Serverless and Platform APIs specs into a single schema
7272
.PHONY: client-merge-serverless-platform
7373
client-merge-serverless-platform:
74-
speakeasy merge -s ./openapi_serverless.json -s ./openapi_platform_api.json -o ./openapi_merged.yaml
74+
speakeasy merge -s ./openapi_platform_api.json -s ./openapi_serverless.json -o ./openapi_merged.yaml
7575

7676
## client-generate-unified-sdk-local: Generate the SDK using merged schemas
7777
.PHONY: client-generate-unified-sdk-local

Diff for: README.md

+129-83
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,19 @@ Please refer to the [Unstructured docs](https://docs.unstructured.io/api-referen
3838
* [SDK Example Usage](#sdk-example-usage)
3939
* [Configuration](#configuration)
4040
* [File uploads](#file-uploads)
41+
* [Resource Management](#resource-management)
4142
* [Debugging](#debugging)
4243

4344
<!-- End Table of Contents [toc] -->
4445

4546
<!-- Start SDK Installation [installation] -->
4647
## SDK Installation
4748

49+
> [!NOTE]
50+
> **Python version upgrade policy**
51+
>
52+
> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
53+
4854
The SDK can be installed with either *pip* or *poetry* package managers.
4955

5056
### PIP
@@ -62,6 +68,37 @@ pip install unstructured-client
6268
```bash
6369
poetry add unstructured-client
6470
```
71+
72+
### Shell and script usage with `uv`
73+
74+
You can use this SDK in a Python shell with [uv](https://docs.astral.sh/uv/) and the `uvx` command that comes with it like so:
75+
76+
```shell
77+
uvx --from unstructured-client python
78+
```
79+
80+
It's also possible to write a standalone Python script without needing to set up a whole project like so:
81+
82+
```python
83+
#!/usr/bin/env -S uv run --script
84+
# /// script
85+
# requires-python = ">=3.9"
86+
# dependencies = [
87+
# "unstructured-client",
88+
# ]
89+
# ///
90+
91+
from unstructured_client import UnstructuredClient
92+
93+
sdk = UnstructuredClient(
94+
# SDK arguments
95+
)
96+
97+
# Rest of script here...
98+
```
99+
100+
Once that is saved to a file, you can run it with `uv run script.py` where
101+
`script.py` can be replaced with the actual file name.
65102
<!-- End SDK Installation [installation] -->
66103

67104

@@ -76,28 +113,27 @@ from unstructured_client import UnstructuredClient
76113
from unstructured_client.models import shared
77114
from unstructured_client.utils import BackoffStrategy, RetryConfig
78115

79-
with UnstructuredClient() as unstructured_client:
116+
with UnstructuredClient() as uc_client:
80117

81-
res = unstructured_client.general.partition(request={
82-
"partition_parameters": {
83-
"files": {
84-
"content": open("example.file", "rb"),
85-
"file_name": "example.file",
118+
res = uc_client.destinations.create_destination(request={
119+
"create_destination_connector": {
120+
"config": {
121+
"account_key": "azure_account_key",
122+
"account_name": "azure_account_name",
123+
"anonymous": False,
124+
"recursive": True,
125+
"remote_url": "az://<path></path></container-name>",
86126
},
87-
"chunking_strategy": shared.ChunkingStrategy.BY_TITLE,
88-
"split_pdf_page_range": [
89-
1,
90-
10,
91-
],
92-
"strategy": shared.Strategy.HI_RES,
127+
"name": "<value>",
128+
"type": shared.DestinationConnectorType.ASTRADB,
93129
},
94130
},
95131
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
96132

97-
assert res.elements is not None
133+
assert res.destination_connector_information is not None
98134

99135
# Handle response
100-
print(res.elements)
136+
print(res.destination_connector_information)
101137

102138
```
103139

@@ -109,27 +145,26 @@ from unstructured_client.utils import BackoffStrategy, RetryConfig
109145

110146
with UnstructuredClient(
111147
retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
112-
) as unstructured_client:
113-
114-
res = unstructured_client.general.partition(request={
115-
"partition_parameters": {
116-
"files": {
117-
"content": open("example.file", "rb"),
118-
"file_name": "example.file",
148+
) as uc_client:
149+
150+
res = uc_client.destinations.create_destination(request={
151+
"create_destination_connector": {
152+
"config": {
153+
"account_key": "azure_account_key",
154+
"account_name": "azure_account_name",
155+
"anonymous": False,
156+
"recursive": True,
157+
"remote_url": "az://<path></path></container-name>",
119158
},
120-
"chunking_strategy": shared.ChunkingStrategy.BY_TITLE,
121-
"split_pdf_page_range": [
122-
1,
123-
10,
124-
],
125-
"strategy": shared.Strategy.HI_RES,
159+
"name": "<value>",
160+
"type": shared.DestinationConnectorType.ASTRADB,
126161
},
127162
})
128163

129-
assert res.elements is not None
164+
assert res.destination_connector_information is not None
130165

131166
# Handle response
132-
print(res.elements)
167+
print(res.destination_connector_information)
133168

134169
```
135170
<!-- End Retries [retries] -->
@@ -149,50 +184,45 @@ By default, an API error will raise a errors.SDKError exception, which has the f
149184
| `.raw_response` | *httpx.Response* | The raw HTTP response |
150185
| `.body` | *str* | The response content |
151186

152-
When custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `partition_async` method may raise the following exceptions:
187+
When custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `create_destination_async` method may raise the following exceptions:
153188

154189
| Error Type | Status Code | Content Type |
155190
| -------------------------- | ----------- | ---------------- |
156191
| errors.HTTPValidationError | 422 | application/json |
157-
| errors.ServerError | 5XX | application/json |
158-
| errors.SDKError | 4XX | \*/\* |
192+
| errors.SDKError | 4XX, 5XX | \*/\* |
159193

160194
### Example
161195

162196
```python
163197
from unstructured_client import UnstructuredClient
164198
from unstructured_client.models import errors, shared
165199

166-
with UnstructuredClient() as unstructured_client:
200+
with UnstructuredClient() as uc_client:
167201
res = None
168202
try:
169203

170-
res = unstructured_client.general.partition(request={
171-
"partition_parameters": {
172-
"files": {
173-
"content": open("example.file", "rb"),
174-
"file_name": "example.file",
204+
res = uc_client.destinations.create_destination(request={
205+
"create_destination_connector": {
206+
"config": {
207+
"account_key": "azure_account_key",
208+
"account_name": "azure_account_name",
209+
"anonymous": False,
210+
"recursive": True,
211+
"remote_url": "az://<path></path></container-name>",
175212
},
176-
"chunking_strategy": shared.ChunkingStrategy.BY_TITLE,
177-
"split_pdf_page_range": [
178-
1,
179-
10,
180-
],
181-
"strategy": shared.Strategy.HI_RES,
213+
"name": "<value>",
214+
"type": shared.DestinationConnectorType.ASTRADB,
182215
},
183216
})
184217

185-
assert res.elements is not None
218+
assert res.destination_connector_information is not None
186219

187220
# Handle response
188-
print(res.elements)
221+
print(res.destination_connector_information)
189222

190223
except errors.HTTPValidationError as e:
191224
# handle e.data: errors.HTTPValidationErrorData
192225
raise(e)
193-
except errors.ServerError as e:
194-
# handle e.data: errors.ServerErrorData
195-
raise(e)
196226
except errors.SDKError as e:
197227
# handle exception
198228
raise(e)
@@ -301,27 +331,26 @@ Generally, the SDK will work well with most IDEs out of the box. However, when u
301331
from unstructured_client import UnstructuredClient
302332
from unstructured_client.models import shared
303333

304-
with UnstructuredClient() as unstructured_client:
334+
with UnstructuredClient() as uc_client:
305335

306-
res = unstructured_client.general.partition(request={
307-
"partition_parameters": {
308-
"files": {
309-
"content": open("example.file", "rb"),
310-
"file_name": "example.file",
336+
res = uc_client.destinations.create_destination(request={
337+
"create_destination_connector": {
338+
"config": {
339+
"account_key": "azure_account_key",
340+
"account_name": "azure_account_name",
341+
"anonymous": False,
342+
"recursive": True,
343+
"remote_url": "az://<path></path></container-name>",
311344
},
312-
"chunking_strategy": shared.ChunkingStrategy.BY_TITLE,
313-
"split_pdf_page_range": [
314-
1,
315-
10,
316-
],
317-
"strategy": shared.Strategy.HI_RES,
345+
"name": "<value>",
346+
"type": shared.DestinationConnectorType.ASTRADB,
318347
},
319348
})
320349

321-
assert res.elements is not None
350+
assert res.destination_connector_information is not None
322351

323352
# Handle response
324-
print(res.elements)
353+
print(res.destination_connector_information)
325354
```
326355

327356
</br>
@@ -334,27 +363,26 @@ from unstructured_client import UnstructuredClient
334363
from unstructured_client.models import shared
335364

336365
async def main():
337-
async with UnstructuredClient() as unstructured_client:
338-
339-
res = await unstructured_client.general.partition_async(request={
340-
"partition_parameters": {
341-
"files": {
342-
"content": open("example.file", "rb"),
343-
"file_name": "example.file",
366+
async with UnstructuredClient() as uc_client:
367+
368+
res = await uc_client.destinations.create_destination_async(request={
369+
"create_destination_connector": {
370+
"config": {
371+
"account_key": "azure_account_key",
372+
"account_name": "azure_account_name",
373+
"anonymous": False,
374+
"recursive": True,
375+
"remote_url": "az://<path></path></container-name>",
344376
},
345-
"chunking_strategy": shared.ChunkingStrategy.BY_TITLE,
346-
"split_pdf_page_range": [
347-
1,
348-
10,
349-
],
350-
"strategy": shared.Strategy.HI_RES,
377+
"name": "<value>",
378+
"type": shared.DestinationConnectorType.ASTRADB,
351379
},
352380
})
353381

354-
assert res.elements is not None
382+
assert res.destination_connector_information is not None
355383

356384
# Handle response
357-
print(res.elements)
385+
print(res.destination_connector_information)
358386

359387
asyncio.run(main())
360388
```
@@ -431,22 +459,19 @@ Certain SDK methods accept file objects as part of a request body or multi-part
431459
432460
```python
433461
from unstructured_client import UnstructuredClient
434-
from unstructured_client.models import shared
435462

436-
with UnstructuredClient() as unstructured_client:
463+
with UnstructuredClient() as uc_client:
437464

438-
res = unstructured_client.general.partition(request={
465+
res = uc_client.general.partition(request={
439466
"partition_parameters": {
440467
"files": {
441468
"content": open("example.file", "rb"),
442469
"file_name": "example.file",
443470
},
444-
"chunking_strategy": shared.ChunkingStrategy.BY_TITLE,
445471
"split_pdf_page_range": [
446472
1,
447473
10,
448474
],
449-
"strategy": shared.Strategy.HI_RES,
450475
},
451476
})
452477

@@ -458,6 +483,27 @@ with UnstructuredClient() as unstructured_client:
458483
```
459484
<!-- End File uploads [file-upload] -->
460485

486+
<!-- Start Resource Management [resource-management] -->
487+
## Resource Management
488+
489+
The `UnstructuredClient` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
490+
491+
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
492+
493+
```python
494+
from unstructured_client import UnstructuredClient
495+
def main():
496+
with UnstructuredClient() as uc_client:
497+
# Rest of application here...
498+
499+
500+
# Or when using async:
501+
async def amain():
502+
async with UnstructuredClient() as uc_client:
503+
# Rest of application here...
504+
```
505+
<!-- End Resource Management [resource-management] -->
506+
461507
<!-- Start Debugging [debug] -->
462508
## Debugging
463509

0 commit comments

Comments
 (0)