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.2.tar.gz (27.6 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.2-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: comfy_commander-0.1.2.tar.gz
  • Upload date:
  • Size: 27.6 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.2.tar.gz
Algorithm Hash digest
SHA256 51a0c20e22fd21337298234ca6c9630ad79816c0819df271bc1e931b885e9672
MD5 19e2605bc35d9c28d88d1c013d301fec
BLAKE2b-256 2adf4af19ae3e0fa44a3ec0fe969941f7eabfe9ac0ae22bbf06931e83fd20167

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for comfy_commander-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 55053b89a813f780c818f5fbdb668251d2ff09b9e94c932c7a39cb02538209b1
MD5 a91a6d09ee510ee345ad9b809af58edf
BLAKE2b-256 0a8a91f6dfbfbd2026d6ea113e9f9961487efe8388833f1218e7e39194e7ae5c

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