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

1 min read

pyssg.core.incremental.depdiff

Dependency diffing.

When a node is reparsed its set of Dependency may change. Diffing old vs new yields connections to add/remove, and the consequences are bidirectional -- the trickiest part of incremental correctness:

  • A removed edge: the old dst loses an incoming edge; if it was a reverse edge (e.g. a backlink) the old dst must re-render.
  • An added edge: the node needs RESOLVE; the new dst gains an incoming edge and, if reverse, must re-render. A dst that does not exist yet becomes a placeholder.

In M5 the markdown pipeline emits no link dependencies (links arrive in M6), so these run as no-ops over real builds; they are implemented and unit-tested here so the machinery is ready and correct.

apply_dep_diff(build: Build, nid: NodeId, new_deps: list[Dependency], work: WorkList) -> None

Reconcile a node's dependencies, propagating both directions.

resolve_pending(build: Build, nids: list[NodeId], work: WorkList) -> None

Resolve dependencies that have no connection yet.

For each given node, run the resolve bail hook on every dependency that lacks a connection; register the edge and, if it is reverse, mark the destination for re-render.