Nodes/ComfyUI-TG_pydocmaker/TG_PydGetMetadata
ComfyUI Node

TG_PydGetMetadata

Read the metadata off a pydocmaker Doc without touching Python

By TobiasGlaubach·Created 9 months ago·Updated 9 months ago· 0
TG_PydGetMetadata
  • doc
  • metadata_dict
  • metadata_json

The honest setup first

Let's be upfront: this node is useless on its own. TG_PydGetMetadata reads the metadata block out of a pydocmaker Doc - and this pack doesn't build those docs, it just consumes them. If you're not already feeding pydocmaker Doc objects through your graph (usually via the author's Python-execution nodes from the same TG_* family, or by constructing the doc's part-list yourself), there's nothing for this node to read. If you are in that world, this is the cleanest way to get the doc's header info out without writing Python.

Here's the context that makes it click. pydocmaker is TobiasGlaubach's own Python library - a "minimal python document maker" that builds reports with text, markdown, tables, and figures and exports them to HTML, PDF, Markdown, or Word. This whole pack is a bridge so those reports can live inside ComfyUI. A Doc is just a list of parts - dicts tagged meta, markdown, table, and so on. The first meta part carries a data dict where the builder stashes things like doc_name, author, or the template to use.

How it works

The node does one thing. It takes your doc input, makes sure it's a real pydocmaker.Doc (wrapping it if not, and flattening a list of docs), then calls get_metadata(). That returns the data dict from the first meta element - or an empty {} if the doc has no metadata at all. No API, no key, no model download. It's a pure in-memory read.

The inputs and outputs that matter

Inputs are trivial - there's exactly one:

  • doc (*) - a pydocmaker Doc, or a list of Docs. Feed it from wherever your report is built.

Outputs, and you get both at once:

  • metadata_dict (*) - the raw metadata dict, for wiring into any node that takes a generic input.
  • metadata_json (STRING) - the same data as a JSON string, for text inputs. Wire this into a Show Text node to eyeball it, or into anything expecting a string.

Where this actually gets used

Honestly, it's a plumbing node. The JSON output is the more useful one - it lets you pipe a report's metadata into downstream logic or a display node without a Python detour. The dict output matters if you're feeding a node that wants structured data rather than text. Neither output is a tensor, so this never touches the image path of your workflow.

Installing it

Same as any custom node - the whole pack is one repo, and it's tiny. Via ComfyUI Manager, search ComfyUI-TG_pydocmaker. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/TobiasGlaubach/ComfyUI-TG_pydocmaker
cd ComfyUI-TG_pydocmaker
pip install -r requirements.txt

Then restart ComfyUI. The only dependency is pydocmaker itself, which pulls in a surprisingly fat stack of transitive deps (jinja2, markdown, pillow, rich, python-docx, and friends) - it's a report generator, not a lightweight util. No model files, no weights, nothing to download beyond the pip package.

Gotchas

  • Don't feed it a raw string. If you pass something that isn't a Doc, the node wraps it with pydocmaker.Doc(...), and Python treats a string as an iterable - you'll get one part per character, which is garbage. Hand it a real Doc or a list of part-dicts.
  • Empty metadata returns {}, not an error. If your JSON output looks empty, the doc you're reading simply has no meta part yet.
  • This pack is 2 nodes. Don't install it expecting a toolkit; it's a utility belt for one specific report library.
CategoryTG_pydocmaker

Inputs (1)

NameTypeDefaultDescription
doc*

Outputs (2)

NameTypeDescription
metadata_dict*
metadata_jsonSTRING