exlab_wizard.template.provenance#

Frozen template provenance copy. Design spec (Phase 3b).

After a template renders into a destination folder, the exact template source is copied – verbatim, including copier.yml and .jinja files – into that instance’s own typed template store under <dst>/.exlab-wizard/templates/<own_type>/<name>/. This freezes the provenance so a later reader can see precisely which template produced the instance, even if the shared templates directory drifts.

The copy path is recorded in creation.json (the template block’s provenance_path). This module is intentionally pure and dependency light: it reads only resolved.name / resolved.path and performs a single copytree.

Functions

copy_template_into_instance(resolved, dst, ...)

Copy the resolved template root into dst's own typed provenance store.

exlab_wizard.template.provenance.copy_template_into_instance(resolved, dst, own_type)[source]#

Copy the resolved template root into dst’s own typed provenance store.

Writes <dst>/.exlab-wizard/templates/<own_type>/<resolved.name>/ as a verbatim copy (incl. copier.yml and .jinja files). The copy is a frozen snapshot of the exact template source that produced this instance.

Parameters:
  • resolved (ResolvedTemplate) – The resolved template whose name / path (template root directory) are copied. Only these two attributes are read.

  • dst (Path) – The instance destination directory the template rendered into.

  • own_type (str) – The instance’s own template type segment – "run" for a run, "project" for a project.

Return type:

str

Returns:

The provenance copy’s path RELATIVE to dst as a POSIX string, e.g. ".exlab-wizard/templates/run/confocal_run".

Raises:

FileNotFoundErrorresolved.path does not exist (should not happen after a successful render). The caller wraps this best-effort.