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.0.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.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: comfy_commander-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 907f4c612f47b7b88d8e5b2d82adc7014d018cd35bed032d5876338f49c734ab
MD5 e992987abc167b3c1aba6afc26f1c1ee
BLAKE2b-256 3945add07767ef732bc04d6f7cde5a43517a1b93640d0b546e2843e3f949cd66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for comfy_commander-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1df77b4c3689a7227727685ca0cd280a53ea004e16f27d07229a4fdddeb3eb50
MD5 39525be64dc34dfb12eae391b2840269
BLAKE2b-256 b2f13ee8eafe3b53520f8eeaee977ab287dd1040b1b9c2e56461e20957323583

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