Versions & aliases
Every commit produces an immutable version with a monotonic integer index. Aliases are movable names
that point at a version — latest is managed for you; the rest are yours to set. This page covers the
read/label functions that complement upload and
download.
Inspecting a version
Section titled “Inspecting a version”get_artifact_version resolves a version — by version_index, by alias, or (with neither) the latest
alias — and returns its VersionInfo:
v = metrana.get_artifact_version("model", "llm", alias="production")
v.version_index # int | None — the committed indexv.state # str — lifecycle statev.size_bytes # int — total managed bytesv.num_files # int — files in the manifestv.metadata # dict — the queryable metadata set at uploadv.description # str | Nonev.created_by_run # str | None — run lineage, if recordedv.artifact_id # strv.version_id # strSupplying both alias and version_index raises MetranaArtifactValidationError; the same rule holds for
every resolve-by-version function on this page.
Listing files
Section titled “Listing files”list_artifact_files returns every entry in a version’s manifest (paging through the API for you) as a list
of FileEntry:
for f in metrana.list_artifact_files("model", "llm", version_index=3): f.path # str — in-artifact path f.digest # str — SHA-256 hex f.size # int f.is_reference # bool — True if the bytes live in your bucket f.storage_uri # str — where the bytes are f.content_type # str | NoneUse is_reference / storage_uri to fetch reference bytes yourself (Metrana never serves them — see
Downloading → references are skipped).
Pointing aliases
Section titled “Pointing aliases”set_artifact_alias points a user-managed alias at a version. Target the version by exactly one of
version_index or target_alias (point one alias at wherever another currently resolves):
# Point "production" at version 3.metrana.set_artifact_alias(type="model", name="llm", alias="production", version_index=3)
# Point "production" at wherever "best-eval" currently resolves.metrana.set_artifact_alias(type="model", name="llm", alias="production", target_alias="best-eval")It returns an AliasInfo (.alias, .version_id, .version_index) describing what the alias now resolves
to. Aliases can be re-pointed freely — that’s the point of them: keep production stable in your deploy code
and move it to a new version when you promote one.
delete_artifact_alias removes a user alias:
metrana.delete_artifact_alias(type="model", name="llm", alias="v2.1-rc")Index vs alias: which to use
Section titled “Index vs alias: which to use”- Version index — reproducibility. An index is immutable and always resolves to the same bytes. Pin it in a paper’s artifact list or a frozen eval config.
- Alias — a moving target you control.
productionin your serving code always fetches whatever you last promoted, without editing the code. latest— convenience for “the newest thing”, and the default when you resolve without specifying either.