Skip to content

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

root instance-attribute

root = Path(root)

manifest_path instance-attribute

manifest_path = root / 'manifest.json'

Functions

load

load() -> AssetManifest

Load manifest, returning an empty manifest if none exists.

save

save(manifest: AssetManifest) -> None

Persist manifest.

list

list() -> list[AssetRecord]

List tracked assets.

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

find

find(name: str) -> AssetRecord | None

Return the first record by name.

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.

Attributes

name instance-attribute

name: str

kind instance-attribute

kind: AssetKind

path instance-attribute

path: Path

source class-attribute instance-attribute

source: str | None = None

sha256 class-attribute instance-attribute

sha256: str | None = None

license class-attribute instance-attribute

license: str | None = None

notice class-attribute instance-attribute

notice: str | None = None

installed_at class-attribute instance-attribute

installed_at: datetime | None = None

provenance class-attribute instance-attribute

provenance: dict[str, Any] = Field(default_factory=dict)

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 True (TOML key copy), copy into the store instead of referencing in place.

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

model_config class-attribute instance-attribute

model_config = ConfigDict(populate_by_name=True)

name instance-attribute

name: str

kind instance-attribute

kind: AssetKind

source instance-attribute

source: str

copy_to_store class-attribute instance-attribute

copy_to_store: bool = Field(default=False, alias='copy')

destination class-attribute instance-attribute

destination: Path | None = None

sha256 class-attribute instance-attribute

sha256: str | None = None

license class-attribute instance-attribute

license: str | None = None

notice class-attribute instance-attribute

notice: str | None = None

provenance class-attribute instance-attribute

provenance: dict[str, Any] = Field(default_factory=dict)

is_download property

is_download: bool

Whether source is an HTTP(S) URL.

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 1).

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

schema_version class-attribute instance-attribute

schema_version: int = 1

assets class-attribute instance-attribute

assets: tuple[AssetRequirement, ...] = ()

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.

Asset kinds

AssetKind

Bases: StrEnum

Types of assets tracked by an asset manifest.

Attributes:

Name Type Description
ROBOT str

Robot model assets.

OBJECT str

Manipulated object meshes or trajectories.

TERRAIN str

Terrain / environment geometry.

MOTION str

Source motion clips.

FIXTURE str

Scene fixtures and props.

ROBOT member

ROBOT = 'robot'

OBJECT member

OBJECT = 'object'

TERRAIN member

TERRAIN = 'terrain'

MOTION member

MOTION = 'motion'

FIXTURE member

FIXTURE = 'fixture'