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 the resolved template root into |
- 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.ymland.jinjafiles). The copy is a frozen snapshot of the exact template source that produced this instance.- Parameters:
resolved (
ResolvedTemplate) – The resolved template whosename/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:
- Returns:
The provenance copy’s path RELATIVE to
dstas a POSIX string, e.g.".exlab-wizard/templates/run/confocal_run".- Raises:
FileNotFoundError –
resolved.pathdoes not exist (should not happen after a successful render). The caller wraps this best-effort.