Skip to content

Commit fc71e90

Browse files
authored
Merge pull request #26 from comfy-deploy/speakeasy-sdk-regen-1743002572
chore: 🐝 Update SDK - Generate 0.7.0
2 parents 26fe7f3 + 01a8273 commit fc71e90

File tree

204 files changed

+366
-11234
lines changed

Some content is hidden

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

204 files changed

+366
-11234
lines changed

.speakeasy/gen.lock

Lines changed: 16 additions & 395 deletions
Large diffs are not rendered by default.

.speakeasy/gen.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ generation:
1010
useClassNamesForArrayFields: true
1111
fixes:
1212
nameResolutionDec2023: true
13+
nameResolutionFeb2025: false
1314
parameterOrderingFeb2024: true
1415
requestResponseComponentNamesFeb2024: true
16+
securityFeb2025: false
1517
auth:
1618
oAuth2ClientCredentialsEnabled: false
1719
oAuth2PasswordEnabled: false
1820
python:
19-
version: 0.6.3
21+
version: 0.7.0
2022
additionalDependencies:
2123
dev: {}
2224
main: {}
@@ -47,5 +49,6 @@ python:
4749
outputModelSuffix: output
4850
packageName: comfydeploy
4951
projectUrls: {}
52+
pytestTimeout: 0
5053
responseFormat: envelope-http
5154
templateVersion: v2

.speakeasy/workflow.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
speakeasyVersion: 1.468.9
1+
speakeasyVersion: 1.523.2
22
sources:
33
comfydeploy-api:
44
sourceNamespace: comfydeploy-api
5-
sourceRevisionDigest: sha256:467e23f8b7329f3f031f8f11eb90705b1a7b543e305f11475a97cf20d1cf32c8
6-
sourceBlobDigest: sha256:8442059b45a3f3a402b6ee31e4bbd83ac4199f8cfc758524ffc97fc3df5a400f
5+
sourceRevisionDigest: sha256:88643a4de11cc9a90c5da0de3ecf6526f61237a30189707b7a6abf6192ad4cb2
6+
sourceBlobDigest: sha256:df07cbe29241948042d8f8f0dc662107805290842e5a6ed7623ccf270744fba1
77
tags:
88
- latest
9-
- speakeasy-sdk-regen-1736645562
9+
- speakeasy-sdk-regen-1743002572
1010
- V2
1111
targets:
1212
comfy-deploy:
1313
source: comfydeploy-api
1414
sourceNamespace: comfydeploy-api
15-
sourceRevisionDigest: sha256:467e23f8b7329f3f031f8f11eb90705b1a7b543e305f11475a97cf20d1cf32c8
16-
sourceBlobDigest: sha256:8442059b45a3f3a402b6ee31e4bbd83ac4199f8cfc758524ffc97fc3df5a400f
15+
sourceRevisionDigest: sha256:88643a4de11cc9a90c5da0de3ecf6526f61237a30189707b7a6abf6192ad4cb2
16+
sourceBlobDigest: sha256:df07cbe29241948042d8f8f0dc662107805290842e5a6ed7623ccf270744fba1
1717
codeSamplesNamespace: code-samples-python-comfy-deploy
18-
codeSamplesRevisionDigest: sha256:6527150797b87444941356e0aec5a950c0568533f7f1733ab06a07791e96a062
18+
codeSamplesRevisionDigest: sha256:adf2885110445ea05f59d31a8a76e34c61bc6c030a258fc1ef5ae0c8836be768
1919
workflow:
2020
workflowVersion: 1.0.0
2121
speakeasyVersion: latest

README.md

Lines changed: 79 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@ To authenticate your requests, include your API key in the `Authorization` heade
4242
* [SDK Example Usage](#sdk-example-usage)
4343
* [Authentication](#authentication)
4444
* [Available Resources and Operations](#available-resources-and-operations)
45-
* [Server-sent event streaming](#server-sent-event-streaming)
46-
* [File uploads](#file-uploads)
4745
* [Retries](#retries)
4846
* [Error Handling](#error-handling)
4947
* [Server Selection](#server-selection)
5048
* [Custom HTTP Client](#custom-http-client)
49+
* [Resource Management](#resource-management)
5150
* [Debugging](#debugging)
5251
* [Development](#development)
5352
* [Maturity](#maturity)
@@ -58,6 +57,11 @@ To authenticate your requests, include your API key in the `Authorization` heade
5857
<!-- Start SDK Installation [installation] -->
5958
## SDK Installation
6059

60+
> [!NOTE]
61+
> **Python version upgrade policy**
62+
>
63+
> 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.
64+
6165
The SDK can be installed with either *pip* or *poetry* package managers.
6266

6367
### PIP
@@ -75,6 +79,37 @@ pip install comfydeploy
7579
```bash
7680
poetry add comfydeploy
7781
```
82+
83+
### Shell and script usage with `uv`
84+
85+
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:
86+
87+
```shell
88+
uvx --from comfydeploy python
89+
```
90+
91+
It's also possible to write a standalone Python script without needing to set up a whole project like so:
92+
93+
```python
94+
#!/usr/bin/env -S uv run --script
95+
# /// script
96+
# requires-python = ">=3.9"
97+
# dependencies = [
98+
# "comfydeploy",
99+
# ]
100+
# ///
101+
102+
from comfydeploy import ComfyDeploy
103+
104+
sdk = ComfyDeploy(
105+
# SDK arguments
106+
)
107+
108+
# Rest of script here...
109+
```
110+
111+
Once that is saved to a file, you can run it with `uv run script.py` where
112+
`script.py` can be replaced with the actual file name.
78113
<!-- End SDK Installation [installation] -->
79114

80115
<!-- Start IDE Support [idesupport] -->
@@ -96,6 +131,7 @@ Generally, the SDK will work well with most IDEs out of the box. However, when u
96131
# Synchronous Example
97132
from comfydeploy import ComfyDeploy
98133

134+
99135
with ComfyDeploy(
100136
bearer="<YOUR_BEARER_TOKEN_HERE>",
101137
) as comfy_deploy:
@@ -117,6 +153,7 @@ import asyncio
117153
from comfydeploy import ComfyDeploy
118154

119155
async def main():
156+
120157
async with ComfyDeploy(
121158
bearer="<YOUR_BEARER_TOKEN_HERE>",
122159
) as comfy_deploy:
@@ -147,6 +184,7 @@ To authenticate with the API the `bearer` parameter must be set when initializin
147184
```python
148185
from comfydeploy import ComfyDeploy
149186

187+
150188
with ComfyDeploy(
151189
bearer="<YOUR_BEARER_TOKEN_HERE>",
152190
) as comfy_deploy:
@@ -168,133 +206,18 @@ with ComfyDeploy(
168206
<summary>Available methods</summary>
169207

170208

171-
### [deployments](docs/sdks/deployments/README.md)
172-
173-
* [create](docs/sdks/deployments/README.md#create) - Create Deployment
174-
* [list](docs/sdks/deployments/README.md#list) - Get Deployments
175-
176-
### [file](docs/sdks/file/README.md)
177-
178-
* [upload](docs/sdks/file/README.md#upload) - Upload File
179-
* [create_folder_assets_folder_post](docs/sdks/file/README.md#create_folder_assets_folder_post) - Create Folder
180-
* [list_assets_assets_get](docs/sdks/file/README.md#list_assets_assets_get) - List Assets
181-
* [delete_asset_assets_asset_id_delete](docs/sdks/file/README.md#delete_asset_assets_asset_id_delete) - Delete Asset
182-
* [get_asset_assets_asset_id_get](docs/sdks/file/README.md#get_asset_assets_asset_id_get) - Get Asset
183-
* [upload_asset_file_assets_upload_post](docs/sdks/file/README.md#upload_asset_file_assets_upload_post) - Upload Asset File
184-
185-
### [models](docs/sdks/models/README.md)
186-
187-
* [public_models_models_get](docs/sdks/models/README.md#public_models_models_get) - Public Models
188-
189209
### [run](docs/sdks/run/README.md)
190210

191211
* [get](docs/sdks/run/README.md#get) - Get Run
192-
* [~~queue~~](docs/sdks/run/README.md#queue) - Queue a workflow :warning: **Deprecated**
193-
* [~~sync~~](docs/sdks/run/README.md#sync) - Run a workflow in sync :warning: **Deprecated**
194-
* [~~stream~~](docs/sdks/run/README.md#stream) - Run a workflow in stream :warning: **Deprecated**
195-
* [cancel_run_run_run_id_cancel_post](docs/sdks/run/README.md#cancel_run_run_run_id_cancel_post) - Cancel Run
212+
* [cancel](docs/sdks/run/README.md#cancel) - Cancel Run
196213

197214
#### [run.deployment](docs/sdks/deployment/README.md)
198215

199-
* [queue](docs/sdks/deployment/README.md#queue) - Deployment - Queue
200-
* [sync](docs/sdks/deployment/README.md#sync) - Deployment - Sync
201-
* [stream](docs/sdks/deployment/README.md#stream) - Deployment - Stream
202-
203-
#### [run.workflow](docs/sdks/workflow/README.md)
204-
205-
* [queue](docs/sdks/workflow/README.md#queue) - Workflow - Queue
206-
* [sync](docs/sdks/workflow/README.md#sync) - Workflow - Sync
207-
* [stream](docs/sdks/workflow/README.md#stream) - Workflow - Stream
208-
209-
### [search](docs/sdks/search/README.md)
210-
211-
* [search_search_model_get](docs/sdks/search/README.md#search_search_model_get) - Search
212-
213-
### [session](docs/sdks/session/README.md)
214-
215-
* [get](docs/sdks/session/README.md#get) - Get Session
216-
* [cancel](docs/sdks/session/README.md#cancel) - Delete Session
217-
* [list](docs/sdks/session/README.md#list) - Get Machine Sessions
218-
* [increase_timeout_session_increase_timeout_post](docs/sdks/session/README.md#increase_timeout_session_increase_timeout_post) - Increase Timeout
219-
* [create](docs/sdks/session/README.md#create) - Create Session
216+
* [queue](docs/sdks/deployment/README.md#queue) - Queue Run
220217

221218
</details>
222219
<!-- End Available Resources and Operations [operations] -->
223220

224-
<!-- Start Server-sent event streaming [eventstream] -->
225-
## Server-sent event streaming
226-
227-
[Server-sent events][mdn-sse] are used to stream content from certain
228-
operations. These operations will expose the stream as [Generator][generator] that
229-
can be consumed using a simple `for` loop. The loop will
230-
terminate when the server no longer has any events to send and closes the
231-
underlying connection.
232-
233-
The stream is also a [Context Manager][context-manager] and can be used with the `with` statement and will close the
234-
underlying connection when the context is exited.
235-
236-
```python
237-
from comfydeploy import ComfyDeploy
238-
239-
with ComfyDeploy(
240-
bearer="<YOUR_BEARER_TOKEN_HERE>",
241-
) as comfy_deploy:
242-
243-
res = comfy_deploy.run.deployment.stream(request={
244-
"deployment_id": "15e79589-12c9-453c-a41a-348fdd7de957",
245-
"inputs": {
246-
"prompt": "A beautiful landscape",
247-
"seed": 42,
248-
},
249-
"webhook": "https://myapp.com/webhook",
250-
})
251-
252-
assert res.run_stream is not None
253-
254-
with res.run_stream as event_stream:
255-
for event in event_stream:
256-
# handle event
257-
print(event, flush=True)
258-
259-
```
260-
261-
[mdn-sse]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
262-
[generator]: https://book.pythontips.com/en/latest/generators.html
263-
[context-manager]: https://book.pythontips.com/en/latest/context_managers.html
264-
<!-- End Server-sent event streaming [eventstream] -->
265-
266-
<!-- Start File uploads [file-upload] -->
267-
## File uploads
268-
269-
Certain SDK methods accept file objects as part of a request body or multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
270-
271-
> [!TIP]
272-
>
273-
> For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files.
274-
>
275-
276-
```python
277-
from comfydeploy import ComfyDeploy
278-
279-
with ComfyDeploy(
280-
bearer="<YOUR_BEARER_TOKEN_HERE>",
281-
) as comfy_deploy:
282-
283-
res = comfy_deploy.file.upload(request={
284-
"file": {
285-
"file_name": "example.file",
286-
"content": open("example.file", "rb"),
287-
},
288-
})
289-
290-
assert res.file_upload_response is not None
291-
292-
# Handle response
293-
print(res.file_upload_response)
294-
295-
```
296-
<!-- End File uploads [file-upload] -->
297-
298221
<!-- Start Retries [retries] -->
299222
## Retries
300223

@@ -305,6 +228,7 @@ To change the default retry strategy for a single API call, simply provide a `Re
305228
from comfydeploy import ComfyDeploy
306229
from comfydeploy.utils import BackoffStrategy, RetryConfig
307230

231+
308232
with ComfyDeploy(
309233
bearer="<YOUR_BEARER_TOKEN_HERE>",
310234
) as comfy_deploy:
@@ -324,6 +248,7 @@ If you'd like to override the default retry strategy for all operations that sup
324248
from comfydeploy import ComfyDeploy
325249
from comfydeploy.utils import BackoffStrategy, RetryConfig
326250

251+
327252
with ComfyDeploy(
328253
retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
329254
bearer="<YOUR_BEARER_TOKEN_HERE>",
@@ -366,6 +291,7 @@ When custom error responses are specified for an operation, the SDK may also rai
366291
from comfydeploy import ComfyDeploy
367292
from comfydeploy.models import errors
368293

294+
369295
with ComfyDeploy(
370296
bearer="<YOUR_BEARER_TOKEN_HERE>",
371297
) as comfy_deploy:
@@ -395,17 +321,18 @@ with ComfyDeploy(
395321

396322
You can override the default server globally by passing a server index to the `server_idx: int` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
397323

398-
| # | Server |
399-
| --- | ----------------------------------------- |
400-
| 0 | `https://api.comfydeploy.com/api` |
401-
| 1 | `https://staging.api.comfydeploy.com/api` |
402-
| 2 | `http://localhost:3011/api` |
324+
| # | Server | Description |
325+
| --- | ----------------------------------------- | ------------------------ |
326+
| 0 | `https://api.comfydeploy.com/api` | Production server |
327+
| 1 | `https://staging.api.comfydeploy.com/api` | Staging server |
328+
| 2 | `http://localhost:3011/api` | Local development server |
403329

404330
#### Example
405331

406332
```python
407333
from comfydeploy import ComfyDeploy
408334

335+
409336
with ComfyDeploy(
410337
server_idx=2,
411338
bearer="<YOUR_BEARER_TOKEN_HERE>",
@@ -426,6 +353,7 @@ The default server can also be overridden globally by passing a URL to the `serv
426353
```python
427354
from comfydeploy import ComfyDeploy
428355

356+
429357
with ComfyDeploy(
430358
server_url="https://api.comfydeploy.com/api",
431359
bearer="<YOUR_BEARER_TOKEN_HERE>",
@@ -522,6 +450,33 @@ s = ComfyDeploy(async_client=CustomClient(httpx.AsyncClient()))
522450
```
523451
<!-- End Custom HTTP Client [http-client] -->
524452

453+
<!-- Start Resource Management [resource-management] -->
454+
## Resource Management
455+
456+
The `ComfyDeploy` 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.
457+
458+
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
459+
460+
```python
461+
from comfydeploy import ComfyDeploy
462+
def main():
463+
464+
with ComfyDeploy(
465+
bearer="<YOUR_BEARER_TOKEN_HERE>",
466+
) as comfy_deploy:
467+
# Rest of application here...
468+
469+
470+
# Or when using async:
471+
async def amain():
472+
473+
async with ComfyDeploy(
474+
bearer="<YOUR_BEARER_TOKEN_HERE>",
475+
) as comfy_deploy:
476+
# Rest of application here...
477+
```
478+
<!-- End Resource Management [resource-management] -->
479+
525480
<!-- Start Debugging [debug] -->
526481
## Debugging
527482

RELEASES.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,14 @@ Based on:
178178
### Generated
179179
- [python v0.6.3] .
180180
### Releases
181-
- [PyPI v0.6.3] https://pypi.org/project/comfydeploy/0.6.3 - .
181+
- [PyPI v0.6.3] https://pypi.org/project/comfydeploy/0.6.3 - .
182+
183+
## 2025-03-26 15:22:36
184+
### Changes
185+
Based on:
186+
- OpenAPI Doc
187+
- Speakeasy CLI 1.523.2 (2.560.1) https://github.com/speakeasy-api/speakeasy
188+
### Generated
189+
- [python v0.7.0] .
190+
### Releases
191+
- [PyPI v0.7.0] https://pypi.org/project/comfydeploy/0.7.0 - .

0 commit comments

Comments
 (0)