pyssg is pre-1.0 and under active development - APIs, config, and themes may change.
pyssg.core.node

1 min read

pyssg.core.node

Graph nodes.

Node is the generic graph vertex; Document / Asset / Page are subclasses. Heavy payloads (parsed AST, rendered bytes) are kept lazy and evictable so only metadata + per-aspect hashes stay resident -- essential for large wikis. All node dataclasses are kw_only so subclasses can add required fields without the default-ordering trap.

class Node

A vertex in the dependency graph.

state is the highest phase whose result is currently valid. hashes holds one digest per aspect (not a single whole-node hash) -- this is what makes early-cutoff possible. _ast / _payload are heavy and evictable; access them via the ast / payload properties.

Node.ast(self) -> object | None

Parser-specific AST; may be None if not yet parsed or evicted.

Node.ast(self, value: object | None) -> None

Node.payload(self) -> bytes | str | None

Rendered HTML / asset bytes; may be None if evicted.

Node.payload(self, value: bytes | str | None) -> None

Node.add_dependency(self, dep: Dependency) -> None

Record a reference request (called by parsers).

class Document(Node)

A parsed source document (Markdown, data, Excalidraw, ...).

class Asset(Node)

Static bytes plus metadata (size, mime). May be copied/optimized.

class Page(Node)

A derived output node.

generated_from records provenance (a page may derive from several documents, e.g. a paginated list). template selects the layout.