an.project#
Project init/load/save — the on-disk anatomy of an an project.
Layout (from spec §11):
my-scene/ ├── an.toml ├── scene.md ├── ir/scene.json ├── assets/{characters,props,environments,voices,styles,sounds}/ ├── artifacts/{audio,visemes,shots,previews}/ ├── output/ └── .an/{decisions.jsonl,verifier_runs/,memory.md}
Module Attributes
A render report records what a render on THIS machine found — warnings, exception text — so it is per-machine output, not project source (an#254). |
|
Probe frames and contact sheets ( |
|
The file locks an options manifest's writers take ( |
|
What a project's |
Functions
|
|
|
Whether a project's |
|
Create a fresh an project at |
|
Add |
|
Add |
|
Load an existing project. |
|
Persist a Project's current scene back to disk (md + json). |
Classes
|
A loaded an project: directory + mall + current scene. |
- an.project.LOCKS_GITIGNORE: tuple[str, ...] = ('artifacts/voice_options/*.lock',)#
The file locks an options manifest’s writers take (
<ref>.json.lock, an#587): empty, per machine, never project source.
- an.project.PROBES_GITIGNORE: tuple[str, ...] = ('artifacts/probes/',)#
Probe frames and contact sheets (
an probe,an library sheet, an#347): looks at work in progress, which may show private-study material.
- an.project.PROJECT_GITIGNORE: tuple[str, ...] = ('artifacts/render_reports/', 'artifacts/probes/', 'artifacts/voice_options/*.lock')#
What a project’s
.gitignorekeeps out of version control (an initadds each line a.gitignorelacks, never removing one).
- class an.project.Project(root, mall, scene)[source]#
Bases:
objectA loaded an project: directory + mall + current scene.
- an.project.RENDER_REPORTS_GITIGNORE: tuple[str, ...] = ('artifacts/render_reports/',)#
A render report records what a render on THIS machine found — warnings, exception text — so it is per-machine output, not project source (an#254).
- an.project.gitignore_matcher(lines=('artifacts/render_reports/', 'artifacts/probes/', 'artifacts/voice_options/*.lock'))[source]#
rel -> bool: whether any oflines(each a.gitignoreline) covers the project-relative POSIX pathrel, by git’s rules (an#725): a line with a/before its end is anchored at the project root, one without matches a name at any depth; a trailing/matches folders only; wildcards never cross a/; a matched folder covers everything under it; case counts. A facade overdol.gitignore_matcher()(an#800), byte-exact againstgit check-ignore. What it does not read the way git does is refused with aValueErrorrather than misread (a misread line could copy what it should keep local): negation (!), comments (#),**, escapes (\),[^...], POSIX classes ([:alpha:]),//, an unterminated or malformed[...], surrounding spaces and empty lines; so is arelthat is not a plain project-relative POSIX path (a backslash,./,..). Case always counts, as git’s does withcore.ignorecase=false(on macOS git ignores case by default). For a genre or tool that copies a project (a sync, an export) and keeps the same files local as git.>>> local = gitignore_matcher(("artifacts/shot_cache/", "notes.txt", "artifacts/v/*.lock")) >>> local("artifacts/shot_cache/blobs/x"), local("deep/notes.txt"), local("artifacts/audio/a.wav") (True, True, False) >>> local("artifacts/v/a.json.lock"), local("artifacts/v/sub/a.lock") (True, False) >>> gitignore_matcher(("cache/",))("cache"), gitignore_matcher(("a/*/c",))("a/b/c/d") (False, True)
- an.project.gitignored(rel, *, lines=('artifacts/render_reports/', 'artifacts/probes/', 'artifacts/voice_options/*.lock'))[source]#
Whether a project’s
.gitignorekeepsrel(a project-relative POSIX path) local:PROJECT_GITIGNORE, orlines, read by git’s rules (gitignore_matcher(), an#725).>>> gitignored("artifacts/probes/shot1/frame.png"), gitignored("scene.md") (True, False) >>> gitignored("artifacts/voice_options/jerry.json.lock") True
- Return type:
- an.project.init(project_dir, *, name=None, force=False)[source]#
Create a fresh an project at
project_dir.Idempotent unless the directory already contains a non-empty
scene.md; passforce=Trueto overwrite. Returns the absolute project root. The project’s.gitignoregainsPROJECT_GITIGNORE(lines it lacks).- Return type:
- an.project.keep_out_of_git(pdir, lines)[source]#
Add
linesto an OLDER project’s.gitignore(anan initfrom before they existed left them out) — conservatively: never a line whose folder the file already says anything about (a project may have chosen to commit its reports,!artifacts/render_reports/), never through a symlink (a shared ignore file), and never creating a.gitignorein a project that is not in a git work tree.- Return type:
- an.project.keep_reports_out_of_git(pdir)[source]#
Add
RENDER_REPORTS_GITIGNOREto an older project’s.gitignorethe first time a render writes a report (an#309), bykeep_out_of_git()’s rules.- Return type:
- an.project.load(project_dir, *, check_kinds=True, scene_file='scene.md', sync=True)[source]#
Load an existing project. Reconciles scene.md / ir/scene.json first (unless
sync=False).sync=Falseis the read-only load (an#573): the scene is read past a stale pair withan.ir.sync.read_scene()and nothing is written to the scene files;project.mall["scenes"]is then a read-only view of that scene. For commands that only look (an cache info,an cache gc,credits,world show).an validatekeeps syncing: it reports the sync’s own warnings (a tie that disagrees) as findings, which this path does not emit.scene_filenames another scene of the project (scene.studio.md, its JSON twinir/scene.studio.json, an#539; resolved byan.ir.sync.resolve_scene_file(), so a bad or missing one raisesSceneFileError); the assets are the project’s.Registers the installed genres first (
an.genres.load(), ADR 0001 decision 3: discovery is explicit, and loading a project is one of the places it happens), so the scene’s genre kinds — the cut-out genre’splay,expressionandcharacter— read as their own models.Then refuses a scene that names an action kind, entity kind or renderer nothing registered (
an.ir.validate.require_registered_kinds()): the schema holds those asstr(ADR 0001 decision 2), so without this a typo’dkind: enviromentwould load and render silently without its backdrop.check_kinds=Falseis foran validate, which reports them as findings instead.- Return type: