enterprise_ai.packs.build
Source: sdks/python/src/enterprise_ai/packs/build.py. Back to the Python SDK reference index.
This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.
Model BuildResult
Result of build_pack: archive, digest, SBOM, validation report and file digests.
Fields:
| Name | Type | Required | Description |
|---|---|---|---|
archive | Path | yes | The .tar.gz pack, base64 encoded (up to 12 MiB of text). |
digest | str | yes | SHA-256 of the evidence (commands, recording), at most 100 characters. |
sbom | dict[str, Any] | yes | Software bill of materials of the pack. |
sbom_path | Path | yes | Path of the written <name>-<version>.spdx.json. |
report | PackReport | yes | Validation report of the pack (PackReport). |
files | dict[str, str] | yes | Files to import (1 to 200). |
BuildResult.to_dict
to_dict() -> dict[str, Any]
The result as a JSON ready summary.
This element takes no parameter.
Returns: dict[str, Any]. Dict {archive, digest, sbom, files, name, version}: paths as text, files is the number of files.
Functions
sha256_bytes
sha256_bytes(data: bytes) -> str
SHA-256 digest of bytes, prefixed with sha256:.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
data | bytes | yes | Bytes to hash. |
Returns: str. Text sha256:<64 hexadecimal characters>.
source_date_epoch
source_date_epoch() -> int
Fixed time of the archive entries and of the SBOM, read from the SOURCE_DATE_EPOCH environment variable.
This element takes no parameter.
Returns: int. Unix time in seconds; 0 when the variable is not set.
archive_bytes
archive_bytes(root: Path) -> tuple[bytes, dict[str, str]]
Build the reproducible gzip tar of the pack in memory: sorted entries, mode 0644 or 0755, owner 0, time SOURCE_DATE_EPOCH.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
root | Path | yes | Folder of the pack; files are picked by pack_files. |
Returns: tuple[bytes, dict[str, str]]. Tuple (archive bytes, {relative path: sha256:<hex>}).
spdx_sbom
spdx_sbom(report: PackReport, digest: str, files: dict[str, str]) -> dict[str, Any]
SPDX 2.3 JSON document: the pack package, each file with its SHA-256, and the pinned runtime dependencies.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
report | PackReport | yes | Validation report of the pack: name, version, licence and owner come from its manifest; pinned lines of requirements.txt become dependencies. | |
digest | str | yes | Digest sha256:<hex> of the archive, used in the namespace and checksum of the package. | |
files | dict[str, str] | yes | Relative path to sha256:<hex> of every file of the archive. |
Returns: dict[str, Any]. SPDX 2.3 document as a dict.
build_pack
build_pack(path: str | Path, out_dir: str | Path | None = None) -> BuildResult
Validate, then write <name>-<version>.tar.gz and <name>-<version>.spdx.json into out_dir.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
path | str | Path | yes | Folder of the pack to build; an invalid pack raises ValueError listing the errors. | |
out_dir | str | Path | None | None | no | Output folder, created when missing; default dist inside the pack. |
Returns: BuildResult. A BuildResult with the archive path, its sha256: digest and the SBOM.
Raises: ValueError.