livery.workshop._templates¶
livery.workshop._templates ¶
The workspace's generated files: the drift check, the writer, new members.
The listed extensions' files are composed by the fragment engine
(livery.workshop._shipped_files); the CI files and the codeowners file
are generated from the contract. drift_check judges both against the
repository as the gate's fm drift.check; apply_project writes both,
and fm sync runs it, which is the recovery for drift.
Each installed template is a verb, fm new.package.<template> <name>
--<option>=<answer>, made from its declaration by
generate_template_verbs when the plugin loads. It writes a member
born from the template into packages/<name> through
render_member (livery.workshop._seeds), the one function every
creation calls, and a fresh runner adds the member to the project
files.
Functions:
| Name | Description |
|---|---|
registry_injections |
The contract's python registry, as render inputs. |
render_injections |
The render-time values no answer stores. |
compose_fragments |
The step records' fragments composed per rendered file over data. |
fragment_data |
data with what the step records' fragments read beside it. |
package_injections |
The render-time values a package render takes from the contract. |
project_drift |
The drift report: generated files (CI, codeowners) that disagree with root. |
apply_project |
Write the composed and generated files over root; the files that changed. |
apply_generated |
Write the emitted artifacts (CI files, codeowners); what changed. |
drift_check |
Fail when a composed or generated file drifts from what writes it. |
generate_template_verbs |
Make a verb per template, |
new_wire |
Wire the package under packages/ |
wire_member |
Wire the package under |
render_member |
Write a member born from template into |
Attributes:
| Name | Type | Description |
|---|---|---|
NEW_HELP |
|
|
PACKAGE_HELP |
|
|
new |
|
|
package |
|
NEW_HELP
module-attribute
¶
PACKAGE_HELP
module-attribute
¶
registry_injections ¶
The contract's python registry, as render inputs.
Only the committed [registries] table feeds a render: the
resolution ladder's environment rung is machine truth, and a
rendered file must derive from the repository alone or the drift
check would judge each machine differently. Nothing declared
renders nothing, and uv resolves from the ecosystem default.
Source code in packages/workshop/src/livery/workshop/_templates.py
render_injections ¶
The render-time values no answer stores.
Identity is answered, configuration is declared: the runner's
name belongs to the process, the Python floor to the root
pyproject.toml, the extensions and the registry to
workshop.toml. Every project render mixes these in, so the
answers hold identity and the packages roster alone.
Source code in packages/workshop/src/livery/workshop/_templates.py
compose_fragments ¶
The step records' fragments composed per rendered file over data.
Source code in packages/workshop/src/livery/workshop/_templates.py
fragment_data ¶
data with what the step records' fragments read beside it.
The roster is split the way the project file splits it, py for
the members with a dev entry and native for the rest, and the
per-file ignores the claims render are added for the sets of
extensions the members hold, each entry's extensions. A roster
with no member renders the ignores of the
workspace's own unit alone. The fragment engine reads the step
records' fragments through this.
Source code in packages/workshop/src/livery/workshop/_templates.py
package_injections ¶
The render-time values a package render takes from the contract.
The forge facts feed the changelog's link bases; asking them per package would let one workspace's packages disagree about where they live.
Source code in packages/workshop/src/livery/workshop/_templates.py
project_drift ¶
The drift report: generated files (CI, codeowners) that disagree with root.
Empty when every generated file matches the repository byte for byte.
Source code in packages/workshop/src/livery/workshop/_templates.py
apply_project ¶
Write the composed and generated files over root; the files that changed.
The fragment engine composes the project file, the editor files, the
ignore and attribute lines, so a new member reaches pyproject.toml
here; the CI files and the codeowners file are generated after.
Source code in packages/workshop/src/livery/workshop/_templates.py
apply_generated ¶
Write the emitted artifacts (CI files, codeowners); what changed.
The fragment engine's delivery and this together are apply_project, which an update runs, so an instance's generated workflows move with its workshop.
Source code in packages/workshop/src/livery/workshop/_templates.py
drift_check ¶
Fail when a composed or generated file drifts from what writes it.
The gate's drift check, fm drift.check. fm sync writes both
kinds of file, so it is the recovery for every line this names.
files keeps the findings to those root-relative files: the tree
a change is measured from was judged already, so only a file the
change touched can have drifted since, unless an input of every
file changed, and then the caller passes None.
Source code in packages/workshop/src/livery/workshop/_templates.py
generate_template_verbs ¶
generate_template_verbs(templates: Mapping[str, DeclaredTemplate], into: Group | None = None) -> None
Make a verb per template, fm new.package.<template>, from templates.
templates are the installed ones by name: the base's, and those
of each extension of the installed set an installed distribution
declares, as the mount read them. Each verb takes the package's
name, then each option the template's chain offers as a keyword
option (livery.workshop._seeds.verb_options): choices as a
Literal, the doc as its help line, the default as its default,
and an option without a default required. Nothing else is read, so
the command line, its help and its completion follow from the
declarations alone.
Run again after the installed set changed, it makes the verb of a new template, remakes a verb whose template or options changed, and removes the verb of a template that is gone. A task at a template's address that the generator did not make is left alone.
Source code in packages/workshop/src/livery/workshop/_templates.py
new_wire ¶
Wire the package under packages/
Writes the project files again, so every per-package list picks the member up, then locks and syncs the environment and the tools. A template's verb runs it in the runner the workspace's environment holds once the member is written, and it is the recovery after a wiring that stopped part way. A member that does not hold python joins the roster without a dev-group entry: there is no distribution to install.
Source code in packages/workshop/src/livery/workshop/_templates.py
wire_member ¶
Wire the package under packages/<name> into root.
Writes the composed and generated files again, so every
per-package list picks the member up, then locks and syncs the
environment and the tools. fm new.wire runs it in the runner
the workspace's environment holds, after a template's verb wrote the
member.
Raises:
| Type | Description |
|---|---|
Failed
|
when name breaks the package naming rule, or
|
Source code in packages/workshop/src/livery/workshop/_templates.py
render_member ¶
render_member(root: Path, name: str, template: str, answers: Mapping[str, object] | None = None) -> str
Write a member born from template into packages/<name>; the import path.
The one function behind every creation: each template's verb, fm
ci.scale, and fm new.project --extension call it. Writes the
package-base seeds and the files of the template's chain
(livery.workshop._seeds.create_package), rendered with answers,
each answer to one of the chain's options by its variable, and the
files the records compose for the member. The member's own contract
is one of the template's files, and discovery finds the member
through it, so the roster needs no write. The project files, the
lock and the install are the caller's: wire_member runs them for
one member, and a caller adding many members runs them once after
the last. Refuses an existing directory, naming it, a template the
birth cannot take, and an answer the template's options refuse,
before anything is written.