Skip to main content

A package for programmatically running ComfyUI workloads either locally or remotely

Project description

Comfy Commander is a package for programmatically running ComfyUI workloads either locally or remotely

  • Edit any node and its values from Python
  • Supports Local and RunPod ComfyUI instances
  • Convert standard ComfyUI workflows to API format
  • Execute workflows on local ComfyUI servers

Quickstart

Basic Workflow Usage

from comfy_commander import Workflow

# Load an API format workflow
workflow = Workflow.from_file("./image_workflow.json")

# Modify node parameters
sampler_node = workflow.node(id="31")
sampler_node.param("seed").set(1234567890)
sampler_node.param("steps").set(8)

# Access node properties
print(f"Current seed: {sampler_node.param('seed').value}")

Direct Execution

import asyncio
from comfy_commander import ComfyUIServer, Workflow

server = ComfyUIServer("http://localhost:8188")
workflow = Workflow.from_file("./workflow.json")

result = server.execute(workflow)
for i, image in enumerate(result.media):
    image.save(f"./image_{i}.png")

Queue for Later Processing

from comfy_commander import ComfyUIServer, Workflow

server = ComfyUIServer("http://localhost:8188")
workflow = Workflow.from_file("./workflow.json")

# Queue workflow and get prompt ID immediately
prompt_id = server.queue(workflow)
print(f"Workflow queued with ID: {prompt_id}")

# Later, check status or get results
history = server.get_history(prompt_id)

Requirements

For Standard Workflow Conversion

To convert standard ComfyUI workflows to API format, you need:

  1. ComfyUI running locally on http://localhost:8188
  2. Workflow Converter Extension installed:
    cd ComfyUI/custom_nodes
    git clone https://github.com/SethRobinson/comfyui-workflow-to-api-converter-endpoint
    
    Then restart ComfyUI.

Testing

Unit Tests (Default)

# Runs all unit tests by default (e2e tests are in separate files)
pytest tests/ -v

End-to-End Tests

# Make sure ComfyUI is running with the converter extension
python run_e2e_tests.py

Or run e2e tests directly:

pytest tests/e2e_test_local_server.py -v

All Tests (Including E2E)

# Run all tests including e2e (requires running ComfyUI instance)
pytest tests/ tests/e2e_test_local_server.py -v

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

comfy_commander-0.1.1.tar.gz (21.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

comfy_commander-0.1.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file comfy_commander-0.1.1.tar.gz.

File metadata

  • Download URL: comfy_commander-0.1.1.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for comfy_commander-0.1.1.tar.gz
Algorithm Hash digest
SHA256 748aa05f90452b1282f15d152640c1a1ca40800d97dd6b92b40991def26830d3
MD5 c3a2aaaa83d4f6ca4f40ca69016a913a
BLAKE2b-256 1f0a9d8d5208a67db990bee1bf25f46810d933a786228baafd894d8e9637d814

See more details on using hashes here.

File details

Details for the file comfy_commander-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for comfy_commander-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d45629f1a1ce442d9992fb7cd380992cb98c579ef5f1cc969bcce8ce03e3bd8f
MD5 cd31a77d5dbc4711c920f2855bfbc9bd
BLAKE2b-256 c25f749e400c02e1ecc86056c62ef843852c6327fe4e2e16225e70a2f071bed3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page