← all repositories
pydn/ComfyUI-to-Python-Extension

Turn ComfyUI's node graphs into plain Python

It converts ComfyUI's visual node graphs into executable Python, freeing workflows from the UI so they can be automated and version-controlled.

2.4k stars Python Coding AssistantsOther AI
ComfyUI-to-Python-Extension
Not currently ranked — collecting fresh signals.
star history

What it does

ComfyUI-to-Python-Extension translates the visual node graphs you build in ComfyUI into standalone Python scripts. You can export directly from the Web UI through a Save As Script option, or convert existing API-format workflow JSONs via a CLI tool. Either way, the output is a single-shot runner that still depends on your local ComfyUI runtime for models and execution.

The interesting bit

Scripts exported from the Web UI embed enough frontend metadata that the images they produce can be dragged straight back into ComfyUI to restore the original workflow. The generated code also piggybacks on ComfyUI’s own argument parser, so standard memory flags like --lowvram pass through without extra wiring.

Key highlights

  • Two export paths: a Web UI Save As Script button and a CLI converter for API-format JSON workflows.
  • UI-exported scripts carry workflow metadata, enabling drag-and-drop reimport into ComfyUI.
  • Generated scripts accept standard ComfyUI memory flags (--highvram, --lowvram, --cpu, etc.) directly.
  • Best-effort model and cache cleanup is built into the exported main() function.
  • Requires Python 3.12 or newer.

Caveats

  • Generated scripts are single-shot runners, not long-lived prompt servers, and they do not cache results across repeated calls.
  • The exporter does not automatically turn workflow inputs into command-line arguments; you edit the script itself.
  • Scripts depend on an existing ComfyUI install and its Python environment; this is a translator, not a standalone runtime.

Verdict

Worth a look if you want to automate or version-control ComfyUI workflows without clicking through nodes every time. Skip it if you expect a self-contained Python framework that replaces ComfyUI entirely.

Frequently asked

What is pydn/ComfyUI-to-Python-Extension?
It converts ComfyUI's visual node graphs into executable Python, freeing workflows from the UI so they can be automated and version-controlled.
Is ComfyUI-to-Python-Extension open source?
Yes — pydn/ComfyUI-to-Python-Extension is open source, released under the MIT license.
What language is ComfyUI-to-Python-Extension written in?
pydn/ComfyUI-to-Python-Extension is primarily written in Python.
How popular is ComfyUI-to-Python-Extension?
pydn/ComfyUI-to-Python-Extension has 2.4k stars on GitHub.
Where can I find ComfyUI-to-Python-Extension?
pydn/ComfyUI-to-Python-Extension is on GitHub at https://github.com/pydn/ComfyUI-to-Python-Extension.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.