an.stores#
Project mall: a dict of dol-backed MutableMapping stores.
The mall is the unit of persistence in an. Every long-lived state — assets (characters, props, environments, voices, styles, sounds), the scene file pair, intermediate artifacts (audio, viseme tracks, best-of-N take records, per-shot mp4s, the content-keyed shot cache), final output and its caption sidecar, the agent’s decision log, and the asset library’s lockfile of pinned check-outs — is keyed inside a store. Stores are dol-backed so the same call sites work against filesystem, SQLite, S3, etc.
>>> import tempfile
>>> from pathlib import Path
>>> with tempfile.TemporaryDirectory() as d:
... mall = build_project_mall(d, ensure=True)
... sorted(mall.keys()) == [
... 'audio', 'captions', 'characters', 'contact_sheets', 'decisions',
... 'environments', 'library_lock', 'measurements', 'output',
... 'pictures', 'previews', 'props', 'render_reports', 'scenes',
... 'shot_cache', 'shots', 'sounds', 'sources', 'styles', 'takes',
... 'visemes', 'voices',
... ]
True
Functions
|
Build the standard project mall over |
Classes
|
Per-character directory store. |
|
Per-environment directory store (meta + sidecar art). |
|
JSON-only voice descriptors. |
|
Pure-JSON style descriptors. |
|
Per-prop directory store. |
|
|
|
Per-sound directory store. |
|
TTS-rendered audio clips (.wav). |
|
Lip-sync viseme tracks (.json) — stored as bytes for cache uniformity. |
|
Best-of-N take records (.json bytes), keyed by the line's audio key: which take was kept, its sha256, every take's score and the scorer (an#265). |
|
Per-shot rendered mp4s. |
|
Low-res preview renders (mp4 or png sequence wrapper). |
|
Contact sheets (.png): frames of a render at its settled beats, labelled with their time, for a person or an agent to LOOK at (core study §2.10). |
|
Measurements a clock-owning renderer made of its content (.json bytes), keyed by that content's key — DERIVED data, never the author's (an#279): a Manim shot's length, its timeline of beats, its findings. |
|
An opaque renderer's raw picture (.mp4) — a Manim scene's own render, before it is conformed to a film's fps and size, so a change that is not to the picture (narration, fps) does not run Manim again (an#279). |
|
What a render found (.json), keyed like the output it describes — |
|
Python scene sources ( |
|
Final composited renders. |
|
Append-only JSONL log keyed by ordinal index (as string). |
|
|
- class an.stores.AudioArtifactStore(root_dir)[source]#
Bases:
_BlobStoreTTS-rendered audio clips (.wav).
- class an.stores.CharactersStore(root_dir)[source]#
Bases:
JsonSidecarStorePer-character directory store.
>>> import tempfile >>> with tempfile.TemporaryDirectory() as d: ... store = CharactersStore(d) ... store['maya'] = {'name': 'Maya', 'voice_ref': 'maya-warm'} ... store['maya']['name'] 'Maya'
- class an.stores.ContactSheetStore(root_dir)[source]#
Bases:
_BlobStoreContact sheets (.png): frames of a render at its settled beats, labelled with their time, for a person or an agent to LOOK at (core study §2.10).
Content-addressed — the key is the sha256 of the PNG bytes — so a shot whose render is reused from the shot cache still points at its sheet through the cached provenance, and two shots with one picture share one file.
- class an.stores.DecisionLogStore(log_path)[source]#
Bases:
MutableMappingAppend-only JSONL log keyed by ordinal index (as string).
Mutating in-place (
__setitem__,__delitem__) is intentionally forbidden; the log is append-only by design.>>> import tempfile, os >>> with tempfile.TemporaryDirectory() as d: ... log = DecisionLogStore(os.path.join(d, 'decisions.jsonl')) ... _ = log.append(kind='test', body={'x': 1}) ... _ = log.append(kind='test', body={'x': 2}) ... entries = list(log.values()) ... entries[0]['body']['x'], entries[1]['body']['x'] (1, 2)
- class an.stores.EnvironmentsStore(root_dir)[source]#
Bases:
JsonSidecarStorePer-environment directory store (meta + sidecar art).
- class an.stores.MeasurementStore(root_dir)[source]#
Bases:
_BlobStoreMeasurements a clock-owning renderer made of its content (.json bytes), keyed by that content’s key — DERIVED data, never the author’s (an#279): a Manim shot’s length, its timeline of beats, its findings.
- class an.stores.PictureStore(root_dir)[source]#
Bases:
_BlobStoreAn opaque renderer’s raw picture (.mp4) — a Manim scene’s own render, before it is conformed to a film’s fps and size, so a change that is not to the picture (narration, fps) does not run Manim again (an#279). Content-addressed (the key is the sha256 of the mp4): the measurement record under the picture key names it, so a record and its picture are written as one (an#291).
- class an.stores.PreviewArtifactStore(root_dir)[source]#
Bases:
_BlobStoreLow-res preview renders (mp4 or png sequence wrapper).
- class an.stores.ProjectLock(project_dir)[source]#
Bases:
MutableMapping<store>/<key> -> pinover a project’sassets.lock.json.Every write rewrites the whole (small) file, sorted, so the lockfile diffs cleanly under version control. The mapping is the
assetssection;kitsis thekitssection, and a write to either keeps the other.
- class an.stores.PropsStore(root_dir)[source]#
Bases:
JsonSidecarStorePer-prop directory store.
>>> import tempfile >>> with tempfile.TemporaryDirectory() as d: ... store = PropsStore(d) ... store['lamp'] = {'name': 'Desk lamp'} ... store['lamp']['name'] 'Desk lamp'
- class an.stores.RenderReportStore(root_dir)[source]#
Bases:
_BlobStoreWhat a render found (.json), keyed like the output it describes —
render_reports["main"]— soorchestrateand MCP read the findings thatan renderwarned (an#279).
- class an.stores.ScenesStore(project_dir)[source]#
Bases:
MutableMappingMutableMappingexposing the scene file pair under a project root.Keys: currently always
"main". The store enforces this by raisingKeyErrorfor other keys.- patch_shot_durations(durations)[source]#
Set
durationon the named shots WITHOUT regeneratingscene.md.__setitem__rewrites the markdown from the IR, which drops every word of prose and every comment the IR does not hold. This writes the JSON through the read boundary as usual, and patches only each shot’sduration:line in the markdown (inserting one into its `````yaml shot ``block, or the block itself, when there is none) — whatan sync --accept-measureduses to take a measured duration into the authored scene (an#279).- Return type:
- class an.stores.SoundsStore(root_dir)[source]#
Bases:
JsonSidecarStorePer-sound directory store.
>>> import tempfile >>> with tempfile.TemporaryDirectory() as d: ... store = SoundsStore(d) ... store['hit'] = {'description': 'a stick on a table'} ... store.write_audio('hit', b'RIFF....') ... store['hit']['description'], store.read_audio('hit') ('a stick on a table', b'RIFF....')
- AUDIO_NAME = 'audio.wav'#
an.soundsreads its header for the duration a fade-out needs, deterministically.- Type:
The sidecar holding the audio bytes. WAV only in v1
- class an.stores.SourcesStore(root_dir)[source]#
Bases:
_BlobStorePython scene sources (
.pybytes) — a Manim scene file per key.
- class an.stores.TakesArtifactStore(root_dir)[source]#
Bases:
_BlobStoreBest-of-N take records (.json bytes), keyed by the line’s audio key: which take was kept, its sha256, every take’s score and the scorer (an#265).
- class an.stores.VisemeArtifactStore(root_dir)[source]#
Bases:
_BlobStoreLip-sync viseme tracks (.json) — stored as bytes for cache uniformity.
- class an.stores.VoicesStore(root_dir)[source]#
Bases:
JsonDirStoreJSON-only voice descriptors.
>>> import tempfile >>> with tempfile.TemporaryDirectory() as d: ... store = VoicesStore(d) ... store['maya-warm'] = {'provider': 'elevenlabs', 'voice_id': 'xyz'} ... 'maya-warm' in store True
- an.stores.build_project_mall(project_dir, *, ensure=False, **overrides)[source]#
Build the standard project mall over
project_dir.Pass
ensure=Trueto create the per-store directories on disk if they don’t exist. Pass keyword overrides to swap in alternate stores (e.g. an in-memorydictfor tests).- Return type:
Modules
Artifact stores — derived, regeneratable products of the pipeline. |
|
Characters store — descriptor + sidecar folder per character. |
|
Decision log — append-only JSONL of agent decisions and user approvals. |
|
Environments store — backgrounds, set pieces, and prop bundles. |
|
The project lockfile: which library version each checked-out asset came from. |
|
Props store — descriptor + sidecar folder per prop. |
|
Scenes store — wraps the project's |
|
Sounds store — one directory per sound: |
|
The project's opaque scene sources: files a whole-shot renderer runs as they are. |
|
Styles store — visual style presets (color palette, line weight, fonts). |
|
Voices store — pure JSON; one entry per voice. |