Builds and bundles¶
Build, load, and validate active project build bundles.
ProjectBuilder
¶
Build project artifacts without retaining per-build mutable state.
build
¶
build(*, python_spec: str | None = None, json_spec: JsonSourceInput = None, yaml_spec: YamlSourceInput = None, features: FeatureSelection = None, code: CodeSettings | None = None) -> models.BuildBundle
Build and publish a spec, execution plan, and Explorer snapshot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
python_spec
|
str | None
|
Optional |
None
|
json_spec
|
JsonSourceInput
|
Optional explicit spec JSON path, relative to the project root unless absolute. |
None
|
yaml_spec
|
YamlSourceInput
|
Optional YAML file or directory, relative to the project root unless absolute. |
None
|
features
|
FeatureSelection
|
Optional output features to compile with their dependencies. |
None
|
code
|
CodeSettings | None
|
Project code settings. If absent, the language comes from the
packager or defaults to Python, the runtime definition is discovered,
and the source path defaults to |
None
|
Returns:
| Type | Description |
|---|---|
BuildBundle
|
The validated newly published bundle. |
Raises:
| Type | Description |
|---|---|
BuildLockError
|
Another builder or active bundle reader holds the lock. |
ProjectBuildError
|
Loading, compilation, generation, or publication fails. |
BundleStore
¶
Load saved and staged bundles for a fixed project root.
read_explorer_snapshot
¶
Read the snapshot without validating execution artifacts or requiring write access.
load
¶
Load the active build, releasing its reader lock before returning.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
validate
|
bool
|
Run Spec semantic checks. Artifact and plan checks always run. |
True
|
Returns:
| Type | Description |
|---|---|
BuildBundle
|
A validated bundle containing the saved Spec, plan, and artifact paths. |
Raises:
| Type | Description |
|---|---|
BuildError
|
The bundle is missing, incomplete, or invalid. |
read
¶
Load the active build while holding a reader lock.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
validate
|
bool
|
Run Spec semantic checks. All other bundle checks always run. |
True
|
Yields:
| Type | Description |
|---|---|
Generator[BuildBundle]
|
The loaded bundle, protected by the reader lock for the context lifetime. |
load_at
¶
load_at(bundle_root: Path, *, validate: bool = True, log_structure: bool = True) -> models.BuildBundle
Load a saved or staged bundle while the caller holds its project lock.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bundle_root
|
Path
|
Directory containing the saved bundle. |
required |
validate
|
bool
|
Run Spec semantic checks. Structural and artifact checks always run. |
True
|
log_structure
|
bool
|
Emit Spec structural validation debug messages. |
True
|
Returns:
| Type | Description |
|---|---|
BuildBundle
|
The validated bundle at the supplied directory. |
Raises:
| Type | Description |
|---|---|
BuildError
|
The bundle is missing, incomplete, or invalid. |
BuildBundle
dataclass
¶
Validated artifacts, execution plan, and portable code for one active build.
build
¶
build(project_root: str | Path = defaults.DEFAULT_PROJECT_ROOT, python_spec: str | None = None, json_spec: JsonSourceInput = None, features: FeatureSelection = None, *, code: CodeSettings | None = None, yaml_spec: YamlSourceInput = None) -> models.BuildBundle
Build and publish project artifacts through a root-bound builder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
str | Path
|
Project directory, defaulting to the current directory. |
DEFAULT_PROJECT_ROOT
|
python_spec
|
str | None
|
Optional |
None
|
json_spec
|
JsonSourceInput
|
Optional explicit spec JSON path, relative to the project root unless absolute. |
None
|
yaml_spec
|
YamlSourceInput
|
Optional YAML file or directory, relative to the project root unless absolute. |
None
|
features
|
FeatureSelection
|
Optional output features to compile with their dependencies. |
None
|
code
|
CodeSettings | None
|
Project code settings. If absent, the language comes from the
packager or defaults to Python, the runtime definition is discovered,
and the source path defaults to |
None
|
Returns:
| Type | Description |
|---|---|
BuildBundle
|
The validated newly published bundle. |
Raises:
| Type | Description |
|---|---|
BuildLockError
|
Another builder or active bundle reader holds the lock. |
ProjectBuildError
|
Loading, compilation, generation, or publication fails. |
load_build_bundle
¶
Load the active build through a root-bound bundle store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
str | Path
|
Root directory of the analytics project. |
required |
validate
|
bool
|
Run Spec semantic checks. Artifact and plan checks always run. |
True
|
Returns:
| Type | Description |
|---|---|
BuildBundle
|
The validated saved build bundle. |
Raises:
| Type | Description |
|---|---|
BuildError
|
The bundle is missing, incomplete, or invalid. |
read_build_bundle
¶
read_build_bundle(project_root: str | Path, *, validate: bool = True) -> contextlib.AbstractContextManager[models.BuildBundle]
Return a context manager holding a reader lock on the active build.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
str | Path
|
Root directory of the analytics project. |
required |
validate
|
bool
|
Run Spec semantic checks. All other bundle checks always run. |
True
|
Returns:
| Type | Description |
|---|---|
AbstractContextManager[BuildBundle]
|
A context manager yielding the validated saved build bundle. |