ComfyUI Node

YAML Data

Write your workflow config in YAML instead of a pile of text boxes

By chaserhkj·Created about a year ago·Updated 12 months ago· 0
YAML Data
    • PYDICT
    yaml_string

    If you've ever stared at a ComfyUI workflow holding six separate text nodes that all feed one prompt, YAML Data is the node that lets you consolidate. You paste a YAML block into the multiline yaml_string input, and it parses to a PYDICT - a dictionary your template nodes and anything else dict-savvy can read from.

    The mechanism is one line of Python: yaml.safe_load(yaml_string). It's safe_load, not load, which matters - arbitrary YAML can execute code on some parsers, and the safe variant refuses to. For a node that takes untrusted-ish text from a workflow you downloaded, that's the right call and worth knowing you're getting it.

    What it's for. This is the author's approach to keeping prompt data, character sheets, and per-run settings in one readable block instead of scattered across the graph. A typical setup: define your variables in YAML, feed the resulting dict into Prompt Template's data input, and let the template do the interpolation. You get the structure of a config file with the flexibility of the node graph - change a value in one place, not in seven.

    The inputs that matter. Just one: yaml_string, a multiline string. It wants YAML - indentation-sensitive, so:

    subject: a red fox
    style: watercolor
    quality: masterpiece, best quality
    

    parses fine, while tabs or sloppy indentation will throw a parse error or silently produce a dict you didn't intend. The single PYDICT output feeds Prompt Template's data input, Merge Data, or anything else in this pack's dict family.

    Gotchas, from experience:

    • yaml.safe_load("") returns None, not an empty dict. Feed a truly empty string into a consumer that expects a dict and you'll get a crash or a blank render. Keep at least one key-value pair in there.
    • YAML is surprisingly strict about a few things: keys with special characters need quoting, and a value that looks like a number or boolean gets typed as one. If your template renders subject as False when you wrote no, that's YAML typing your string, not a bug.
    • The dict is plain data - no models, no compute. YAML Data is pure plumbing, so performance is a non-issue.

    Install - same as every node in this pack (Chaser's Custom Nodes, by chaserhkj). ComfyUI Manager, search "Chaser's Custom Nodes", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/chaserhkj/ComfyUI-Chaser-nodes
    

    then restart. No model downloads; the pack's dependencies (jinja2, pyyaml, requests, sexpdata, av) install automatically. The README warns these are personal ad-hoc nodes - "use them at your own risk" - which for a parse-YAML node is a fair trade for the convenience.

    CategoryChaser Custom Nodes

    Inputs (1)

    NameTypeDefaultDescription
    yaml_stringSTRING

    Outputs (1)

    NameTypeDescription
    PYDICTPYDICT