Asset store¶
Manifest-backed local assets for robots, objects, terrain, motion, and fixtures.
AssetStore reads and writes manifest.json under a store root (default .retarget_assets). Human-editable install manifests (AssetInstallManifest) describe requirements; installed records live in AssetManifest.
AssetStore
¶
AssetStore(root: str | Path = '.retarget_assets')
Local manifest-backed asset store.
Methods:
| Name | Description |
|---|---|
load |
Load manifest, returning an empty manifest if none exists. |
save |
Persist manifest. |
list |
List tracked assets. |
import_path |
Track or copy an asset path into the store. |
install |
Install or reference one manifest requirement. |
install_manifest |
Install every asset in a manifest. |
Attributes:
| Name | Type | Description |
|---|---|---|
root |
|
|
manifest_path |
|
Attributes¶
Functions¶
import_path
¶
import_path(
source: str | Path,
*,
name: str,
kind: AssetKind,
copy: bool = False,
target_path: str | Path | None = None,
sha256: str | None = None,
license: str | None = None,
notice: str | None = None,
provenance: dict[str, Any] | None = None,
) -> AssetRecord
Track or copy an asset path into the store.
install
¶
install(requirement: AssetRequirement, *, allow_downloads: bool = False) -> AssetRecord
Install or reference one manifest requirement.
install_manifest
¶
install_manifest(
manifest: AssetInstallManifest | str | Path, *, allow_downloads: bool = False
) -> list[AssetRecord]
Install every asset in a manifest.
AssetManifest
¶
Bases: BaseModel
Collection of asset records.
Attributes:
| Name | Type | Description |
|---|---|---|
records |
list[AssetRecord]
|
Installed or referenced assets tracked by the store. |
Methods:
| Name | Description |
|---|---|
find |
Return the first record by name. |
Attributes¶
records
class-attribute
instance-attribute
¶
records: list[AssetRecord] = Field(default_factory=list)
Functions¶
AssetRecord
¶
Bases: BaseModel
One tracked asset.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Unique asset name in the store manifest. |
kind |
AssetKind
|
Asset category (robot, object, terrain, motion, fixture). |
path |
Path
|
Resolved on-disk path to the asset file or directory. |
source |
str | None
|
Original import path or download URL, if recorded. |
sha256 |
str | None
|
Expected or verified SHA-256 hex digest for file assets. |
license |
str | None
|
SPDX identifier or short license note. |
notice |
str | None
|
Attribution or NOTICE text. |
installed_at |
datetime | None
|
UTC timestamp when the asset was registered or installed. |
provenance |
dict[str, Any]
|
Origin and processing history for the asset. |
AssetRequirement
¶
Bases: BaseModel
One asset declared by a human-editable install manifest.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Asset name to register in the store. |
kind |
AssetKind
|
Asset category (robot, object, terrain, motion, fixture). |
source |
str
|
Local path or HTTP(S) URL to fetch or reference. |
copy_to_store |
bool
|
When |
destination |
Path | None
|
Optional store-relative or absolute install path. |
sha256 |
str | None
|
Expected SHA-256 hex digest for file assets. |
license |
str | None
|
SPDX identifier or short license note. |
notice |
str | None
|
Attribution or NOTICE text. |
provenance |
dict[str, Any]
|
Origin and processing history supplied by the manifest. |
Methods:
| Name | Description |
|---|---|
resolve_source |
Resolve local relative sources against a manifest directory. |
Attributes¶
copy_to_store
class-attribute
instance-attribute
¶
copy_to_store: bool = Field(default=False, alias='copy')
provenance
class-attribute
instance-attribute
¶
provenance: dict[str, Any] = Field(default_factory=dict)
Functions¶
resolve_source
¶
resolve_source(base_dir: Path) -> AssetRequirement
Resolve local relative sources against a manifest directory.
AssetInstallManifest
¶
Bases: BaseModel
Human-editable manifest describing assets to install or reference.
Attributes:
| Name | Type | Description |
|---|---|---|
schema_version |
int
|
Manifest format version (default |
assets |
tuple[AssetRequirement, ...]
|
Assets to install or reference. |
provenance |
dict[str, Any]
|
Origin and processing history for the manifest. |
Methods:
| Name | Description |
|---|---|
load |
Load a TOML, YAML, or JSON install manifest. |
resolve_sources |
Return a copy with local relative sources resolved. |
Attributes¶
provenance
class-attribute
instance-attribute
¶
provenance: dict[str, Any] = Field(default_factory=dict)
Functions¶
load
classmethod
¶
load(path: str | Path) -> AssetInstallManifest
Load a TOML, YAML, or JSON install manifest.
resolve_sources
¶
resolve_sources(base_dir: Path) -> AssetInstallManifest
Return a copy with local relative sources resolved.