Skip to content

The animation engine for agents: blazingly fast math and 3D videos with Manim's Python API, on a Rust GPU core.

Python

Document the validated engine, testing and release architecture

Sina Atalayc87915dbaee3
diff --git a/docs/content/developer-guide/documentation.md b/docs/content/developer-guide/documentation.md
index 3c9b7aca..771db6b4 100644
--- a/docs/content/developer-guide/documentation.md
+++ b/docs/content/developer-guide/documentation.md
@@ -97,8 +97,8 @@ title is its first heading (or the `title` of its front matter):
makes the navbar's tabs, and gives the User Guide's reading order: Welcome, the
Quickstart, the chapters, then the Reference.
- `developer-guide/.nav.yml` orders this guide.
-- The reference's navigation is the folder tree that `scripts/docs/reference.py` writes
- (below): each level's own page comes first, as its Overview.
+- The reference's handwritten `.nav.yml` files order its folder tree: each level's own
+ page comes first, as its Overview. `scripts/docs/reference.py` writes only the command-line page.
A section's own page (`index.md`) is a page like the others, listed first in its sidebar:
Welcome, this guide's Setup, a reference level's Overview. `navigation.indexes`, which would
@@ -111,8 +111,12 @@ the User Guide's first page, is the README: `pymdownx.snippets` includes it
(`--8<-- "README.md"`), so the two can't drift. The README reaches the site's images and
pages by absolute URLs, for GitHub and PyPI; on the site they become its own paths
([`docs/links.py`](https://github.com/academa-labs/manimgx/blob/main/docs/links.py)), so
-`just serve-docs` shows the images it built. The README's picture of its scene ends in
-`#readme`: GitHub and PyPI show it, and the site, which shows the film itself above the
+`just serve-docs` shows the images it built. The showcase logos and GIFs use this repository's
+raw GitHub URLs, which the same extension makes local showcase paths: the README and Welcome
+page show the same files. GitHub selects the banner's light or dark source using its reader's
+chosen theme. On the docs site, `javascripts/manimgx.js` follows the Zensical theme toggle,
+including choices that differ from the system preference. The README's picture of its scene
+ends in `#readme`: GitHub and PyPI show it, and the site, which shows the film itself above the
code, hides it (`stylesheets/manimgx.css`).
## The README
@@ -120,32 +124,38 @@ code, hides it (`stylesheets/manimgx.css`).
The README is the front page on GitHub and on PyPI, which render it themselves, so it is
written in plain GitHub Markdown, with absolute links (PyPI resolves no relative link). Its
images are the site's. GitHub and PyPI play no video, so what moves in them is an animated
-image: SVGs that play themselves where the picture is made of paths, sharp at any size and
-a fraction of a video's weight, and an AVIF where it is not. An SVG draws a surface's shape
-exactly (a circle in space is seen as an ellipse, a sphere's outline is one), but not its
-light, and a browser repaints an animated SVG at the screen's rate: six shaded films as SVGs
-cost Firefox two to three cores to play, the AVIF tiles at 25 frames a second 0.6 of one.
+image: SVGs that play themselves where the picture is made of paths, and GIFs for the wall
+of example films. The same banner and GIFs appear on the docs' Welcome page, included from
+the README.
- **The banner** (`showcase/logo-dark.svg` and `logo-light.svg`): the logo, which plays
its opening once. The word ManimGX, typeset by manimgx's Typst (𝕄 as `$bb(M)$`, "anim" in
New Computer Modern Bold, "GX" in Playwrite NO), is written in; then Manim's circle,
square and triangle are drawn and each becomes a solid, a sphere, a cube and a pyramid,
- every frame a projection of their scene.
+ their projected face paths interpolated continuously by the browser. The SVG contains no
+ scripts or raster frames. Its entrance plays once and then holds; a reader that requests
+ reduced motion sees the finished logo immediately.
[`scripts/showcase/logo.py`](https://github.com/academa-labs/manimgx/blob/main/scripts/showcase/logo.py)
draws it, the header's still logo (`images/logo-*.svg`) and the favicon;
- `python -m scripts.showcase.logo` draws them again.
-- **The wall** (`showcase/<film>.avif` and `<film>@2x.avif`): five seconds of six example
- films, three a row, each its own image, linked to its film.
+ `uv run --frozen python -m scripts.showcase.logo` draws them again.
+- **The wall** (`showcase/<film>.gif`): five seconds of nine example
+ films in a three-by-three grid, each its own image linked to its film. HeavyTop,
+ the Hopf fibration and the catenoid–helicoid transformation fill the last row.
[`scripts/showcase/wall.py`](https://github.com/academa-labs/manimgx/blob/main/scripts/showcase/wall.py)
- runs each film's scene and keeps its moment: on no background, so the page's own shows
- through, light or dark; without what the film fixes in the frame (its titles and
- readouts); as an animated AVIF with alpha at 25 frames a second, which GitHub and PyPI
- show; at a tile's size and twice it, which a `<picture>` picks by the screen's density
- (GitHub keeps it; PyPI shows the larger). A browser decodes an animated image on the CPU,
- frame after frame: at 60 frames a second the wall fell behind (Chromium showed some 50, for
- a core's work); at 25 every tile shows every frame. GitHub's image proxy served an image of
- 4.97 MB and refused one of 6.35 MB; the largest tile is 1.3 MB. The films take a minute to
- run, so the tiles are committed; `python -m scripts.showcase.wall` makes them again.
+ renders each film directly at 50 frames a second, without what it fixes in the frame
+ (its titles and readouts). Each clip is cropped and resized to 320 × 180, composited onto
+ a dark background, and encoded by [Gifski](https://gif.ski/) with quality, motion quality
+ and lossy quality all set to 100. The 250 source frames are spaced 20 ms apart. Samples
+ that become visually equivalent during encoding can combine into longer holds while
+ preserving the five-second timeline and continuous looping.
+ Each file must stay below 12,000,000 bytes, and the complete wall below 24,000,000 bytes;
+ the generator validates the whole staged set before replacing any published file.
+ The README points directly to
+ `raw.githubusercontent.com/academa-labs/manimgx/main/docs/content/showcase/`.
+ The docs resolve that exact prefix to their local `/showcase/` assets. There is one image
+ per film and one shared wall, in both places and on both color schemes. The GIFs are
+ committed; `uv run --frozen python -m scripts.showcase.wall` makes them again with
+ Gifski installed and `gifski` on PATH.
- **The chart** (`images/benchmark-light.svg` and `benchmark-dark.svg`): the benchmark, as
a race; `scripts/benchmark/chart.py` draws it from `scripts/benchmark/results.json`.
- **The scene's film** (`films/readme-<scene>.svg`): `docs/examples.py` records the README's
@@ -160,16 +170,55 @@ cost Firefox two to three cores to play, the AVIF tiles at 25 frames a second 0.
renders the examples before the site is built:
1. It gathers the Python blocks (fenced as `python` or `py`) of the pages, of the README
- and of the docstrings in `src/manimgx/`, and keeps those that define a
+ and of the docstrings in `src/manimgx/`, together with the source films in `examples/`,
+ and keeps those that define a
scene: a class whose base's name ends in `Scene` (the block's last, if it defines several).
2. It renders each scene at 1280 × 720 and 60 frames per second, the films' own rate, in a
process of its own (an example may change the configuration: a 9:16 one renders tall),
into `docs/content/films/`: a still of its last frame with anything on it, and a video
too if anything moves.
-3. A film is named after its scene and a digest of its code and of how films are made
- (`FORMAT`), so an example renders once per version of its code, and all of them again
- when the format changes. Only missing films are rendered, and films no example makes
- any more are deleted.
+3. A film is named after its scene and a digest of its code, render settings and shared
+ inputs: Python and Rust sources, shaders, locked runtime dependencies, fonts, voice
+ recordings, rendering helpers and the rendering environment. `docs/render.py` owns
+ drawing; discovery, caching and HTML in `docs/examples.py` are not drawing inputs.
+ `uv export --frozen --offline --no-default-groups` selects the runtime dependencies,
+ including their transitive dependencies and artifact hashes, so updating test or site
+ tools does not invalidate films. A prose or stylesheet edit reuses every film; editing
+ a standalone example renders that example again. Shared rendering inputs are hashed
+ conservatively, including Python docstrings: changing the engine or a shader really
+ does require new films. The keys depend on contents, not Git history or timestamps.
+4. Each render finishes in a temporary directory. Its output files are published with a
+ completion record in `docs/.cache/films/`, written last, that names the files and their
+ checksums. A missing or damaged file is rendered again. Static scenes deliberately
+ produce only a poster; animations also produce a video. Outputs of removed examples
+ are deleted.
+
+`just render-docs` renders the examples, and `just build-docs-pages` generates the Gallery
+and command-line reference and builds the HTML from those films. `just build-docs` does
+both. Rendering reads `examples/` directly, so it does not need generated Gallery pages.
+`just render-docs --jobs 2` limits concurrent render processes; source paths may follow it.
+
+CI uses [GitHub Actions cache](https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching)
+to transport snapshots of the films and completion records. Each film decides its own
+validity; an archive hit never skips validation. Lookup prefers the latest snapshot for
+the requested scene inventory, then one with the same renderer, so changing one example
+can reuse the others. Logs report the cached and missing counts and renderer fingerprint.
+
+GitHub caches are immutable. Each changed snapshot gets a run-and-attempt suffix, so a
+retry can extend a partial set or save repairs. The separate save step uses
+[`always()`](https://github.com/actions/cache/blob/main/save/README.md#always-save-cache):
+if another example fails, completed films are still saved before building the pages.
+Cancellation also gets that opportunity if the runner reaches the save step. An unchanged
+set is not uploaded again, and staging directories are never archived. Main writes the
+shared cache; pull requests can read it without deployment credentials. A cache miss
+rebuilds normally: caches are an optimization and may be evicted.
+
+CI records its Rust compiler and macOS version and build in
+`MANIMGX_DOCS_RENDER_PROFILE`; Python version, OS and architecture are always part of the
+fingerprint. Local builds also include their machine and OS version, keeping their GPU
+output separate. Examples must be self-contained and deterministic (seed random
+generators); shared files they read belong in `docs/assets/` or `docs/voice/`, which are
+fingerprinted. Add any new shared rendering input to `INPUTS` in `docs/examples.py`.
While the site builds, `fence`, the formatter that `zensical.toml` gives Python blocks,
puts each block's film above its code. `show="code"` shows the code alone, and
@@ -194,7 +243,7 @@ render's default (`ultrafast`, 18), alike to the eye, made in the same time.
## The Gallery
[`scripts/docs/gallery.py`](https://github.com/academa-labs/manimgx/blob/main/scripts/docs/gallery.py)
-writes the Gallery from `examples/` alone, before the examples are rendered: a page of cards,
+writes the Gallery from `examples/` after the films are rendered: a page of cards,
one for each film, and a page for each film. What it says is in
[`examples/README.md`](https://github.com/academa-labs/manimgx/blob/main/examples/README.md),
which lists every example once:
@@ -305,9 +354,11 @@ hover shows them. So the summary line of a docstring is also what its previews s
the next heading. `stylesheets/manimgx.css` limits the preview of an API object to its
name, signature, bases and summary, and the preview of a module to its members' names and
summaries. No icon marks a link that previews, because every link to the site does.
-- **After a change to a Markdown extension in `docs/`:** delete `docs/.cache`. Zensical's
- cache does not see a change in an extension's code, so a build reuses the pages it made
- before.
+- **After a change to a Markdown extension in `docs/`:** clear Zensical's files in
+ `docs/.cache`, preserving its `films/` subdirectory. Zensical's page cache does not see a
+ change in an extension's code. The film records belong to `docs.examples` and authenticate
+ reusable media; deleting the whole directory, including with Zensical's `--clean`, removes
+ those records and makes the next render rebuild the films.
## The command line's reference
@@ -346,7 +397,7 @@ writes three things:
A page's one action, Copy as Markdown (`content.action.copy`), copies it.
- **`llms.txt`,** at the site's root, <https://manimgx.academa.ai/llms.txt>, which the
README tells an agent to follow. First, a primer for an agent asked to make a video with
- manimgx: how to install it, a scene, `check` then `render`, and a cheat sheet of the API.
+ manimgx: how to install it, a scene, `inspect` then `render`, and a cheat sheet of the API.
Then a list of every page's Markdown, by section.
- **`llms-full.txt`:** every page's Markdown, in one file.
@@ -383,7 +434,7 @@ into its version's section, which becomes the release's notes (see
just serve-docs
```
-Writes the Gallery, renders the missing films, writes the reference, then serves the site at
+Renders the missing films, writes the Gallery and command-line reference, then serves the site at
<http://localhost:8000> and rebuilds it as its pages change. An example that fails to render
is reported and served without its film. A block added while it serves
has no film until the examples are rendered again, and a name added to or removed from the
@@ -394,7 +445,7 @@ pages are written before it serves.
just build-docs
```
-Writes the Gallery, renders the examples, writes the reference, and builds the site into
+Renders the examples, writes the Gallery and command-line reference, and builds the site into
`docs/site/` with `--strict`: a warning, such as a link to a page or a name that does not
exist, fails the build. This is what CI deploys.
@@ -419,6 +470,12 @@ configures it:
never served): security headers for every page, long caching for the theme's bundles
(their names change with their content), and `noindex` on `workers.dev` hosts.
+Academa's `internal/manimgx-hosting` Terraform unit provisions the Worker identity,
+custom domain and deployment credential. It also provisions the coverage report's
+Worker and domain. Wrangler publishes assets and previews; it leaves domain ownership
+to Terraform. The account ID is a GitHub repository variable, and each site's deployment
+token is installed in its production and preview environments by Terraform.
+
The workflow [`deploy-docs.yaml`](https://github.com/academa-labs/manimgx/blob/main/.github/workflows/deploy-docs.yaml)
builds the site on every push and pull request, deploys it from `main`, and previews each
pull request from a branch of the repository at its own address,
diff --git a/docs/content/developer-guide/engine.md b/docs/content/developer-guide/engine.md
index d624c62c..7a857ba4 100644
--- a/docs/content/developer-guide/engine.md
+++ b/docs/content/developer-guide/engine.md
@@ -52,8 +52,8 @@ The crate's dependencies do the heavy lifting:
| [`src/window.rs`](https://github.com/academa-labs/manimgx/blob/main/rust/engine/src/window.rs) | The player in a window on this machine's screen (winit) |
| [`src/web.rs`](https://github.com/academa-labs/manimgx/blob/main/rust/engine/src/web.rs) | The player on a page's canvas (WebAssembly) |
| [`src/export.rs`](https://github.com/academa-labs/manimgx/blob/main/rust/engine/src/export.rs) | A film's video: frames converted and handed to the encoder |
-| [`src/vector.rs`](https://github.com/academa-labs/manimgx/blob/main/rust/engine/src/vector.rs), [`src/vector.wgsl`](https://github.com/academa-labs/manimgx/blob/main/rust/engine/src/vector.wgsl) | A 2D view, drawn exactly |
-| [`src/blend.wgsl`](https://github.com/academa-labs/manimgx/blob/main/rust/engine/src/blend.wgsl) | The raster pipeline: 3D views, point clouds and meshes |
+| [`src/vector.rs`](https://github.com/academa-labs/manimgx/blob/main/rust/engine/src/vector.rs), [`src/vector.wgsl`](https://github.com/academa-labs/manimgx/blob/main/rust/engine/src/vector.wgsl) | Path coverage and the view's composite |
+| [`src/blend.wgsl`](https://github.com/academa-labs/manimgx/blob/main/rust/engine/src/blend.wgsl) | The raster pipeline: point clouds and meshes |
| [`src/paint.wgsl`](https://github.com/academa-labs/manimgx/blob/main/rust/engine/src/paint.wgsl) | Paint, as both pipelines evaluate it |
| [`src/nv12.wgsl`](https://github.com/academa-labs/manimgx/blob/main/rust/engine/src/nv12.wgsl) | A frame's changed macroblocks, converted for the encoder |
| [`src/encode.rs`](https://github.com/academa-labs/manimgx/blob/main/rust/engine/src/encode.rs) | H.264 through x264 |
@@ -82,7 +82,7 @@ code against it.
- **One module for every Python from 3.13 on.** The crate builds against Python's stable
ABI (PyO3's `abi3-py313`).
- **Bytes, not objects.** What crosses is packed arrays: control points as float64,
- records of 320 bytes, a view of float32s. Python packs them with numpy
+ records of 336 bytes, a view of float32s. Python packs them with numpy
([`rendering/feed.py`](https://github.com/academa-labs/manimgx/blob/main/src/manimgx/rendering/feed.py));
the engine reads them as they are. A shape crosses as its object defines it, and the
engine derives what drawing needs: it flattens a path's curves, and sums a mesh's faces
@@ -119,19 +119,27 @@ it: neither the system's loader nor the environment is involved, and a machine w
never loads it. An engine built from source has none of its own; there, the system's Mesa
draws.
-### A 2D view, exactly
+### Path coverage and compositing
-No tessellation, no stencil, no multisampling: each pixel's coverage is the area of the
-object inside it, computed from the control points.
+Paths use analytic coverage of flattened segments instead of counting multisample hits.
+The same pipeline draws paths in 2D and through a 3D camera.
1. A compute pass flattens every curve of every path into as many segments as its size on
- screen needs (Wang's bound, to 1/32 of a pixel), every frame, at the size it is drawn.
+ screen needs (Wang's bound targets 1/32 of a pixel, with at most 256 segments per curve),
+ every frame, at the size it is drawn.
2. A raster pass adds each segment's exact area into the object's rectangle of a float
- atlas: a fill by its winding, a stroke as pieces along the curve's exact normals, with
+ atlas: a fill by its winding, a stroke as pieces along the curve's normals, with
its joints and caps.
3. A compute pass composites each 16×16 tile of the view over the objects that reach it,
- in draw order. It keeps each pixel as two regions split by a line, so edges that two
- shapes share do not show what lies under them.
+ in depth order, with draw order breaking ties. It keeps each pixel as two regions split
+ by a line to retain the overlap of shared edges.
+
+The segment areas are analytic; the complete image is an approximation. Curves are
+flattened, coverage is accumulated in floating point, and each partially covered layer's
+boundary is reconstructed as a half-plane. Two regions cannot retain every intersection
+of several partial layers. The composite also approximates nearly parallel boundaries
+as parallel, and merges its regions between atlas groups. These limits matter when
+several edges or transparent surfaces meet inside one pixel.
A 2D view's point clouds and meshes are drawn by the raster pipeline, into layers that the
composite lays in their place in the order.
@@ -140,25 +148,25 @@ See `vector.rs` and `vector.wgsl`.
### The raster pipeline
-The raster pipeline draws every object of a 3D view, and a 2D view's point clouds and
-meshes, with real depth. A vertex is placed by the blend itself:
+The raster pipeline draws point clouds and meshes, with per-sample depth. In a 3D view,
+their raster base is combined with the paths' analytic coverage and depth planes.
+A vertex is placed by the blend itself:
clip = C₁·S₁ + C₂·S₂, where Cₖ = camera · Mₖ is composed on the CPU once per object (the
second term only while a shape morphs). The kinds differ only in how their vertices become
triangles:
-- A path's fill is a fan counted into the stencil, then covered, unless the shape is
- convex, fully shown and still; its stroke is a ribbon in screen space.
- A point is a disk that faces the camera.
- A mesh is its triangles, optionally textured.
-Where 3D surfaces can be seen through, each fragment is appended to a list per pixel, and
-the lists are composited in depth order: a pixel shows every surface on its ray, the nearer
-over the farther, whatever order they were drawn in.
+Transparent mesh fragments are collected in lists and composited in depth order. Point
+sprites are sorted and drawn between the other geometry's depth layers. Raster sample
+coverage and the paths' reconstructed coverage are different representations; their
+combination does not preserve every subpixel overlap.
A camera's picture, as a [`ZoomedScene`][manimgx.ZoomedScene] shows it, is a view drawn
first into a texture, which the frame then samples by its key.
-See `blend.wgsl`, and the `Player` in `lib.rs`.
+See `blend.wgsl`, and the `Player` in `render.rs`.
### Paint
@@ -183,8 +191,11 @@ back and analyzed.
3. x264, on a thread of its own, is told which macroblocks are unchanged and skips its
analysis there (`encode.rs`).
4. `mp4.rs` writes each picture as a sample of an MP4; a held frame is one sample that
- lasts longer. The header is written first, so a player can start before the file has
- arrived.
+ lasts longer. Each sample keeps its duration when B-frames change the decoding order.
+ The decode clock accumulates those durations; signed composition offsets preserve the
+ authored display times. This is the MP4 timing contract: sample-table timing determines
+ presentation, including the final hold, independently of the encoder's decode timestamps.
+ The header is written first, so a player can start before the file has arrived.
[`Film.export`][manimgx.Film.export] reports how it went: the seconds taken, the part of
them in x264, the share of macroblocks converted, and the file's size.
@@ -228,7 +239,8 @@ the converted code finds its scope with no files on disk, and the converter and
code it converts for come from the same files. `cargo test -p mitex-spec-gen`, in `rust/`,
checks that the committed spec is still what the package makes, and that the engine serves
every file of it; after an upgrade of mitex, `MITEX_SPEC=write cargo test -p mitex-spec-gen`
-writes the new spec. No workflow runs it.
+writes the new spec. The Test workflow checks the spec with the rest of the Rust workspace
+through `just test-rust`; it never regenerates it.
## The player
@@ -316,9 +328,18 @@ the same record slot drew the frame before, which the writer reads off the frame
film whose shapes change a little every frame is sent as their changes: the example films'
takes are 14 times smaller for it (50 GB in all before, 3.6 GB after), and a 3D film of 30
seconds is tens of megabytes, where it was gigabytes. A mesh's points, uvs and normals go as
-float32, the precision the GPU draws them at; everything else goes exactly as Python gave it. The frames the browser draws match the native engine's: of the
-integration corpus's 841 scenes, 534 are identical in every frame, and the others differ by
-rounding, one level in a few pixels.
+float32, the precision the GPU draws them at; everything else goes exactly as Python gave it.
+The browser and native player share the take decoder and renderer. Replay and direct
+rendering are checked for identical pixels on the same adapter and runtime. Different
+GPU backends, drivers, and authoring runtimes can produce different floating-point results;
+sharing the renderer does not guarantee identical pixels across them.
+
+Each take starts with its format version, exposed to Python as `_engine.TAKE_VERSION`.
+It covers the layouts of views, records, uploads and coded arrays. The shared projector
+checks it before reading resources, so a native window, browser and headless replay reject
+unsupported or unversioned recordings with an explicit error. A change to those layouts
+that alters their meaning needs a new format version; package releases and reference
+manifests have their own versions.
## Others' sources
@@ -334,17 +355,27 @@ offline; one shared by your checkouts downloads each archive once; and a build i
one gathers what it was built from. A build script fetches the same archives on every target,
whatever it compiles of them, so one build gathers what every build reads.
-That is how a release ships the wheels' complete source, which x264's GPL and FFmpeg's LGPL
-ask for: `manimgx-X.Y.Z-source.tar.xz`, on the GitHub release (`just build-source` makes it).
-It is the source distribution with `vendor/`, every crate `rust/Cargo.lock` names
+The release ships `manimgx-X.Y.Z-source.tar.xz` beside the wheels (`just build-source` makes it).
+It is the committed repository, identified by `SOURCE_COMMIT`, with `vendor/`, every crate `rust/Cargo.lock` names
(`cargo vendor`), `sources/`, the archives, and a `.cargo/config.toml` that reads them,
-offline. The wheel the recipe builds from it gathers the archives into `sources/`, and shows
-that nothing else is needed. Unpacked, it builds a wheel with the tools alone (Rust, a C
-compiler, and maturin, which uv installs), reading nothing else from the network:
+offline. Mesa, glslang and LLVM use the same store through `fetch-file`, pinned by their
+archive hashes. LLVM is built with its native target and a source correction that preserves
+register-class constraints during rematerialization; its patch and build recipe are in
+`scripts/release/`. The Linux wheel jobs also retain the exact source RPMs of libraries
+auditwheel actually bundles, identified by auditwheel's SBOM. Each
+platform's manifest records its wheel hash, binary package versions and source hashes.
+`just build-source` consumes both Linux source artifacts, merged into `release-sources/`,
+and checks those hashes before adding them to the source archive.
+
+The archive supplies the distributed components' source; it does not freeze the operating
+system or compiler toolchain. Rebuilding lavapipe uses its checked archives, source patch
+and build recipe with the required Linux build tools. The engine itself builds without fetching
+native sources or Cargo crates once Rust, a C compiler and the Python build dependencies
+(including maturin) are installed:
```sh
tar -xf manimgx-X.Y.Z-source.tar.xz
-cd manimgx-X.Y.Z && uv build --wheel
+cd manimgx-X.Y.Z && uv build --wheel --no-build-isolation --offline
```
Each is built by its crate's build script with the `cc` crate, the C compiler alone, the same
@@ -359,6 +390,12 @@ reference decoder, which passes all of RFC 8251's test vectors (FFmpeg's own fai
(wider sound is downmixed to stereo, scaled so it can't clip), starting and ending where the
file declares.
+On Windows, `rust/dxc/` prepares the exact upstream DirectX Shader Compiler archive, verifies
+its SHA-256, and places `dxcompiler.dll` beside the installed extension. The engine loads it
+from that package location. Its separately pinned source tree and source dependencies are
+retained for source distribution, with their notices in `LICENSE-DXC`; the DLL is an official
+binary input, not a compiler rebuilt by every wheel installation.
+
## Building
- `uv sync`, and every `uv run`, rebuild the engine when one of its sources changes, with
@@ -379,12 +416,15 @@ file declares.
- `rust/engine/Cargo.toml` denies Clippy's correctness lints and warns on its suspicious and
performance ones. No recipe, check or workflow runs Clippy: run `cargo clippy` in `rust/`.
-The engine is tested through Python, by the suite and the integration corpus (see
-[Testing](testing.md)); its Rust unit tests (`cargo test --lib`, in `rust/`) check that a take
-reads back as it was written, that its arrays' codings decode exactly, and how the projector
+The installed-wheel suite and integration corpus test the Python boundary (see
+[Testing](testing.md)). `just test-rust` tests the Rust workspace on Linux, macOS and Windows,
+with the render, export, typeset and player features, without embedding Python. These tests
+check that a take reads back as it was written, that its arrays' codings decode exactly, and how the projector
takes takes in: a newer one replacing the shown one at the frame shown, a failed one dropped
or ended, the stream read whole however it is cut. They also check the player: its keys by the
web's names, its chapters, a take's sound read as it was written, and the face's lines, set as
-Typst sets them. The player in a page is tried by hand, in a browser. `cargo test -p fetch`
-checks `MANIMGX_SOURCES`: an empty folder gathers an archive, whole, and a full one builds
-with the archive gone from its URL.
+Typst sets them. `just check-rust-web` checks the browser feature boundary, and
+`just test-rust-web` runs its browser tests with wasm-bindgen-test-runner and a browser
+driver; CI uses Chrome. These focused laws complement manual playback of full scenes in a
+browser. The fetch crate's tests, also part of `just test-rust`, check `MANIMGX_SOURCES`: an
+empty folder gathers an archive, whole, and a full one builds with the archive gone from its URL.
diff --git a/docs/content/developer-guide/github-workflows.md b/docs/content/developer-guide/github-workflows.md
index 5bfdeda4..d09e25c6 100644
--- a/docs/content/developer-guide/github-workflows.md
+++ b/docs/content/developer-guide/github-workflows.md
@@ -34,7 +34,7 @@ workflows run the justfile's recipes, so a task does the same in CI as on your m
## manimgx's workflows
-manimgx has seven workflows, in
+The seven regular build, release and collaboration workflows are in
[`.github/workflows/`](https://github.com/academa-labs/manimgx/tree/main/.github/workflows).
### 1. [`test.yaml`](https://github.com/academa-labs/manimgx/blob/main/.github/workflows/test.yaml): the checks and the tests
@@ -46,18 +46,24 @@ manimgx has seven workflows, in
- By hand, from GitHub's interface.
- When the Release workflow calls it.
-**What it does**, in five jobs:
-
-1. **Run pre-commit checks**, on Ubuntu: runs `just check`.
-2. **Test the browser package**, on Ubuntu: runs `just test-typescript`, building the
- TypeScript package and checking its player, compiled worker, and public declarations.
-3. **Test**, six times: on Linux, macOS and Windows, with Python 3.13 and with 3.14. Each
- runs `just test-coverage` (on Linux, with Mesa's lavapipe installed to draw with), and
- keeps its coverage data.
-4. **Combine the coverage**, even when a test job failed: `just combine-coverage` makes one
+**What it does**, in six job definitions:
+
+1. **Run pre-commit checks**, on Ubuntu: installs the locked tools without compiling the
+ project, then runs `just check` with automatic environment synchronization disabled.
+2. **Test the browser package**, on Ubuntu: checks the Rust browser feature, runs its
+ browser tests with Chrome, then runs `just test-typescript` against the compiled worker,
+ player and public declarations.
+3. **Build and link**, once on Linux, macOS and Windows: checks source acquisition and
+ linked codecs, builds one stable-ABI wheel, and runs `just test-rust`. Linux installs
+ lavapipe for the renderer tests. Each successful job keeps its wheel.
+4. **Test**, six times: installs that OS's same wheel on Python 3.13 and 3.14, checks the
+ installed product, acquires the verified frozen corpus packages, then runs
+ `just test-coverage`. These jobs do not rebuild the extension. They keep coverage and
+ rendering failure evidence even when the suite fails.
+5. **Combine the coverage**, even when a test job failed: `just combine-coverage` makes one
report of the jobs' data, and its table goes in the run's summary. The report is kept,
with the data of a coverage badge (`badge.json`).
-5. **Publish the coverage**, for `main`'s pushes and for pull requests from a branch of the
+6. **Publish the coverage**, for `main`'s pushes and for pull requests from a branch of the
repository: to the Worker `manimgx-coverage`
([`.github/deploy/coverage.jsonc`](https://github.com/academa-labs/manimgx/blob/main/.github/deploy/coverage.jsonc)).
`main`'s report is served at <https://coverage.manimgx.academa.ai>. Each commit's report
@@ -90,10 +96,13 @@ comparable on one machine at one time.
**What it does**, in four jobs:
-1. **Build**, on every run except a pull request's closing: installs Mesa's lavapipe (the
- examples' videos are drawn with it), runs `just build-docs` (the narrated examples speak
- from `docs/voice/`, so the build needs no voice's key), and keeps `site/` and
- `.github/deploy/docs.jsonc` for seven days.
+1. **Build**, on macOS for every run except a pull request's closing: checks the docs'
+ JavaScript interactions and reference declarations, restores verified film-cache entries,
+ runs `just render-docs`, saves completed films, then runs `just build-docs-pages`.
+ Metal draws the examples; narrated examples speak from `docs/voice/`, so no voice key is
+ needed. The built `docs/site/` is kept for seven days. Deployment configuration is checked
+ out separately from the trusted base commit, so the build cannot supply commands for a job
+ with credentials to execute.
2. **Deploy**, from `main` (a push, or a run by hand): deploys what the build made to
Cloudflare Workers with `wrangler deploy --config .github/deploy/docs.jsonc`, the
commit's hash as its message. The `docs` environment shows the site's address,
@@ -101,8 +110,9 @@ comparable on one machine at one time.
3. **Preview**, for a pull request from a branch of the repository: uploads the build as a
preview named `pr-<number>`, at its own address, shown on the `docs-preview`
environment.
-4. **Delete the preview**, when a pull request closes. A pull request that was never
- previewed has no preview to delete, and that failure is ignored.
+4. **Delete the previews**, when a pull request closes, for both docs and coverage. An
+ absent preview is already clean; authentication failures and other API errors fail
+ the job.
See [Documentation](documentation.md#deployment) for how the site is served.
@@ -125,35 +135,58 @@ See [Documentation](documentation.md#deployment) for how the site is served.
`bN` or `rcN` is a pre-release.
2. **Test**, on a tag: it runs the Test workflow.
3. **Build:** the wheels (`create-wheels.yaml`), the source distribution and the wheels'
- complete source (`just build-source`: the source distribution with every crate and each
- archive the engine's build fetches, which a wheel is built from, offline for the crates,
- gathering the archives, so it holds all the wheels are built from; see
+ complete source (`just build-source`: the committed repository, including its build
+ recipes, fonts and browser sources, with every crate and each
+ archive the engine's build fetches, plus the exact distribution sources retained by the
+ Linux wheel jobs; the source archive waits for those platform builds; see
[Others' sources](engine.md#others-sources)), the font packages (`just build-fonts`), and
- the executables, from the wheels (`create-executables.yaml`).
+ the executables, from the wheels (`create-executables.yaml`), and the packed npm artifact.
+ Each Linux architecture builds its Docker image from these same wheel and font artifacts,
+ with external dependencies authenticated against `uv.lock`. The images pass the product
+ smoke test without network access. BuildKit retains their provenance and SBOM in OCI archives.
4. **Draft the GitHub release**, on a tag: it signs each file's provenance (an attestation
of the workflow, the commit and the run that built it, which
`gh attestation verify FILE --repo academa-labs/manimgx` checks), and drafts the release
`manimgx X.Y.Z` with the files (the complete source too, which PyPI doesn't get), its notes
the changelog's section for the version (`just release-notes`), then where the complete
- source is, which x264's and FFmpeg's licenses ask for.
-5. **Publish to PyPI:** the wheels and the source distribution, with `uv publish`, each
- with its [PEP 740](https://peps.python.org/pep-0740/) attestation, and the font packages'
- files PyPI doesn't have yet (`--check-url` skips the others: the fonts are released when
- they change). It authenticates by trusted publishing, with the workflow's OIDC token: no
- PyPI token is stored.
-6. **Publish to npm:** the package for the browser (`just build-npm`), which installs this
+ source is, which x264's and FFmpeg's licenses ask for. The draft then becomes public,
+ making those sources available before registry uploads start.
+5. **Publish to PyPI:** the font packages first, then manimgx's wheels and source
+ distribution, with `uv publish`, each with its
+ [PEP 740](https://peps.python.org/pep-0740/) attestation. `--check-url` skips files PyPI
+ already has: the fonts are released when they change. Each package has its own GitHub
+ environment and trusted publisher: `pypi` for `manimgx`, `pypi-fonts` for
+ `manimgx-fonts`, and `pypi-fonts-cjk` for `manimgx-fonts-cjk`. The font jobs run as a
+ matrix, each downloading only its package's distributions. Before the first release,
+ register three pending publishers on PyPI with owner `academa-labs`, repository
+ `manimgx`, workflow `release.yaml`, and those environment names; create the matching
+ GitHub environments with release tags (`v*`) allowed. Pending publishers need distinct
+ workflow/environment combinations, even when their project names differ. Publishing
+ uses the workflow's OIDC token: no PyPI token is stored.
+6. **Publish to npm:** the already-built tarball for the browser, which installs this
release of manimgx from PyPI, so it comes after PyPI; by trusted publishing too, with
- provenance.
-7. **Publish the Docker image:** [docker/github-builder](https://github.com/docker/github-builder)
- builds `docker/Dockerfile` for the version, for `linux/amd64` and `linux/arm64`,
- with a signed provenance and SBOM (each package the image holds, with its license), and
- pushes it to `ghcr.io/academa-labs/manimgx`, tagged `X.Y.Z` and `X.Y` (a pre-release,
+ provenance. A retry accepts an existing version only when its SHA512 integrity matches
+ the exact tarball. For the first release, before the package exists on npm, create a
+ short-lived granular token with read/write access to all packages and bypass 2FA,
+ and store it as `NPM_TOKEN` in the GitHub `npm` environment (allow only `v*` tags).
+ The token is passed only to the publishing step. Once the package exists, configure
+ its npm trusted publisher with owner `academa-labs`, repository `manimgx`, workflow
+ `release.yaml`, and environment `npm`; enable direct publishing (`npm publish`),
+ since the workflow does not stage releases. Then revoke the token and delete the
+ GitHub secret: subsequent releases use OIDC.
+7. **Publish the Docker image:** copy the tested OCI archives without changing their digests,
+ including the provenance and SBOM, and assemble the `linux/amd64` and `linux/arm64`
+ platform index. Its provenance is signed, and it is published to
+ `ghcr.io/academa-labs/manimgx`, tagged `X.Y.Z` and `X.Y` (a pre-release,
`X.Y.Z` only), labeled `MIT AND GPL-3.0-or-later`: manimgx's code, and the engine, which
- x264 makes GPL-3.0-or-later as a whole. The image installs manimgx from PyPI, so it comes
- after PyPI.
-8. **Publish the GitHub release:** the draft becomes public last, once PyPI, npm and
- ghcr.io have their files. GitHub's immutable releases lock a published release's files
- and tag, which is why the files are attached while the release is a draft.
+ x264 makes GPL-3.0-or-later as a whole. It needs no new package resolution or image build.
+8. **Confirm completion:** all registry uploads have succeeded and the GitHub release is
+ public. Publication across registries is not atomic; a failed destination can be retried
+ using the retained artifacts. Publishing alone does not lock the release's files or tag: that requires
+ GitHub's [immutable releases](https://docs.github.com/en/code-security/concepts/supply-chain-security/immutable-releases)
+ to be enabled for the repository. This workflow attaches every file while the release
+ is a draft and does not change that setting. Recorded artifact digests and provenance
+ attestations verify acquired bytes; they do not enable GitHub's immutability policy.
### 5. [`create-wheels.yaml`](https://github.com/academa-labs/manimgx/blob/main/.github/workflows/create-wheels.yaml): the wheels
@@ -161,8 +194,8 @@ See [Documentation](documentation.md#deployment) for how the site is served.
and by hand, to try a branch's wheels.
**What it does:** a job per platform (Linux x86_64 and arm64, macOS arm64 and x86_64,
-Windows x86_64) runs `just build-wheel`; the macOS x86_64 wheel is cross-compiled on an
-arm64 runner (`CIBW_ARCHS`), and tested there under Rosetta, and a Linux job builds Mesa's
+Windows x86_64, and Pyodide) runs `just build-wheel`; the macOS x86_64 wheel is cross-compiled
+on an arm64 runner (`CIBW_ARCHS`), and tested there under Rosetta, and a Linux job builds Mesa's
lavapipe for its wheel first (`scripts/release/build_lavapipe.sh`). cibuildwheel builds the
platform's wheel and tests it on every
supported Python, as `[tool.cibuildwheel]` in `pyproject.toml` says (see
@@ -177,10 +210,29 @@ builds the wheels first.
**What it does:** a job per platform takes the platform's wheel and runs
`just create-executable`
([`scripts/release/create_executable.py`](https://github.com/academa-labs/manimgx/blob/main/scripts/release/create_executable.py)),
-which renders a scene with the executable before it keeps it: on Linux with Mesa's
-lavapipe, which the job installs (macOS has Metal, Windows WARP). Each executable is kept as
+which renders a scene with the executable before it keeps it. Linux builds the launcher
+inside the wheel's manylinux SDK, so both require glibc 2.28 or newer. A fresh glibc 2.28
+container then runs the executable without Python, a GPU driver, network access, or an
+installation cache: it uses its embedded Python and bundled lavapipe. macOS uses Metal and
+Windows uses WARP. Each executable is kept as
`executable-<platform>`: `manimgx-<os>-<arch>.tar.gz`, or a `.zip` on Windows.
+The interpreter is an exact Python Build Standalone release and target archive, verified
+by SHA-256. The executable archive includes `build-inputs.json`, the original `PYTHON.json`,
+and `LICENSE-PYTHON`; the metadata and notices also remain inside the embedded Python.
+The source artifact retains the launcher's locked sources and `python-inputs.tar.xz`,
+which contains the interpreter's build recipe, metadata, and notices. The corresponding
+open-source runtime inputs are retained once, by digest, in `release-sources/python/`;
+each platform's receipt identifies its inputs and the final source build verifies them.
+Selection follows the pinned PBS and CPython build recipes, including Windows' separate
+libffi, Tcl and Tk inputs. Sources needed only to recover an upstream notice are marked
+separately in the receipt.
+
+Windows' interpreter also carries Microsoft's proprietary `vcruntime140.dll` and
+`vcruntime140_1.dll`, recorded as `vcruntime:140` in `PYTHON.json`. These are binary
+redistributables governed by [Microsoft's distribution terms](https://learn.microsoft.com/en-us/cpp/windows/redistributing-visual-cpp-files),
+not open-source components supplied by the source archive.
+
### 7. [`ai.yaml`](https://github.com/academa-labs/manimgx/blob/main/.github/workflows/ai.yaml): Claude on issues and pull requests
Claude runs through [claude-code-action](https://github.com/anthropics/claude-code-action),
@@ -213,16 +265,21 @@ pull request is opened or marked ready for review.
to run `just check` and the tests its change touches before it pushes, and to open a
change as a draft pull request. On a pull request from a fork, it only reads.
-## Secrets never meet the code
+## Deployment credentials
-The jobs that run the repository's code get no secrets, and the jobs that get secrets do
-not run it:
+Builds and tests receive no deployment credentials. Publishing jobs use only the trusted
+base commit's deployment files and the static artifacts:
- The checks, the tests and the docs' build run the repository's code (they build the
engine and render scenes), with a token that can only read the repository. The jobs that
- get Cloudflare's API token and account ID (the docs' deploy, preview and deletion, and
- the coverage's publishing) never run the repository's code: they only run a pinned
- version of wrangler, on what a build made (and `gh`, to set the coverage status).
+ get Cloudflare's API token run a pinned Wrangler on the built files (and `gh`, to set
+ the coverage status). Cleanup uses the trusted base commit's `cleanup.py`. Neither
+ deployment configuration nor executable code is taken from a build artifact.
+- Academa's `internal/manimgx-hosting` Terraform unit owns the Worker identities,
+ custom domains, GitHub environments and credentials. Each site's
+ `CLOUDFLARE_API_TOKEN` can edit only that Worker; the account ID is the repository
+ variable `CLOUDFLARE_ACCOUNT_ID`. Production environments allow `main`; preview
+ environments also allow pull request merge refs.
- Pull requests from forks and from Dependabot get no secrets: they are built and tested,
not previewed, and their coverage is not published.
- The first reply's model can only read, and the job that posts its reply runs no model.
@@ -239,28 +296,34 @@ it needs.
commit to a pull request cancels its running one, while a run on `main` finishes before
the next one begins.
- Every action is pinned to a commit, its version in a comment beside it, and wrangler's
- version is pinned in `WRANGLER_VERSION`. Dependabot moves the pins (below), and
+ version is pinned in `WRANGLER_VERSION`. Maintainers review updates to these pins, and
[zizmor](https://docs.zizmor.sh), one of the checks of `just check`, finds security
problems in the workflows.
-- The Test, docs and AI workflows share one cache of the engine's compiled Rust
- dependencies; only `main`'s runs save it.
-
-## [`dependabot.yml`](https://github.com/academa-labs/manimgx/blob/main/.github/dependabot.yml): updates
-
-[Dependabot](https://docs.github.com/en/code-security/dependabot) opens pull requests that
-move dependencies to new releases, one per ecosystem, its updates grouped:
-
-| Ecosystem | What moves | How often |
-| --- | --- | --- |
-| GitHub Actions | The workflows' pinned actions (a pinned action gets no security alerts) | Weekly |
-| uv | `uv.lock`; a requirement in a `pyproject.toml` only when a release falls outside it | Monthly |
-| Cargo | The engine's crates, in `Cargo.lock` | Monthly |
-| pre-commit | The hooks' repositories in `.pre-commit-config.yaml` | Monthly |
-| Docker | The Docker image's base, and its uv | Monthly |
-| bun | The browser package's tools and the review panel's packages, grouped separately | Monthly |
-
-A release waits a week before Dependabot proposes it: most compromised releases are caught
-within days. Security updates do not wait.
+- The Test, docs and AI workflows reuse compiled Rust dependencies. The browser engine
+ has a separate cache key. Pull request builds do not write the shared caches; docs saves
+ only from `main`, Test also saves from explicit non-PR runs, and AI only restores them.
+
+## Dependency updates
+
+Maintainers initiate dependency updates and validate them before integrating them into
+`main`. There is no scheduled Dependabot configuration, so version updates do not create
+branches automatically. [Dependabot alerts](https://docs.github.com/en/code-security/concepts/supply-chain-security/dependabot-alerts)
+remain enabled; automatic security-update pull requests are disabled. Alerts and upstream
+release notes guide maintenance, including checks of the actions pinned by commit.
+
+- `just upgrade` refreshes the Python and Rust lockfiles within the manifests' version
+ requirements and regenerates the third-party notice. Review major-version changes
+ explicitly, including their API, behavior and license; some requirements already allow them.
+- Review the browser and corpus review panel's dependencies in their own `package.json`
+ and `bun.lock`. Run their checks and builds with the new lockfiles.
+- Review action commits, pre-commit hook revisions, Docker base images and the native
+ source pins separately. These are not changed by `just upgrade`; update their recorded
+ versions and source identities together.
+
+Run `just check` and the affected tests after an update. Changes to the native dependency
+closure also need the platform builds, package smoke tests and source/notice checks; changes
+to the render path need the corpus and paired benchmarks. A new version alone is not evidence
+of compatibility.
## Other files in `.github/`
@@ -274,4 +337,4 @@ use of AI). GitHub shows each where it applies.
- [`.github/workflows/`](https://github.com/academa-labs/manimgx/tree/main/.github/workflows):
the workflow files.
- [GitHub Actions' documentation](https://docs.github.com/en/actions).
-- [Dependabot's options](https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference).
+- [Dependabot alerts](https://docs.github.com/en/code-security/concepts/supply-chain-security/dependabot-alerts).
diff --git a/docs/content/developer-guide/index.md b/docs/content/developer-guide/index.md
index f4cd5d5f..8f184983 100644
--- a/docs/content/developer-guide/index.md
+++ b/docs/content/developer-guide/index.md
@@ -36,9 +36,12 @@ its wheels.
The engine draws with [wgpu](https://wgpu.rs): through Metal on macOS, Direct3D 12 on
Windows (WARP, on the CPU, where there is no GPU), and Vulkan on Linux. It takes the
-high-performance adapter, which must be able to blend float32 render targets (a 2D view
-adds up its coverage in one). Without such an adapter, rendering raises an error that says
-what is missing.
+high-performance adapter, which must blend float32 render targets (a view adds its coverage
+in one) and support float32 depth with stencil (`depth32float-stencil8`). The reversed-Z
+projection needs floating-point depth to distinguish distant surfaces. An adapter missing
+either capability is rejected; Linux then tries the bundled lavapipe. If no suitable adapter
+is available, rendering reports the missing capability. The browser requires the same two
+WebGPU capabilities.
On Linux without a GPU driver, Mesa's lavapipe draws on the CPU. The Linux wheels bundle it
(`scripts/release/build_lavapipe.sh` builds it, and the engine loads it itself: see
@@ -51,7 +54,15 @@ sudo apt-get install libvulkan1 mesa-vulkan-drivers
### Manim Community Edition
-The integration corpus compares every case with Manim Community Edition's rendering of it. CE's reference hashes and frame data are in the repository; the videos are generated locally when needed. Rendering them (a new case, or a changed scene) needs CE, which is in its own dependency group: `uv sync --group ce` (`just sync` leaves it out again). Its bindings to Cairo and Pango build from source where they have no wheels (pycairo on macOS and Linux, ManimPango on Linux), so that needs those libraries: `brew install cairo pkg-config` on macOS, `apt-get install libcairo2-dev libpango1.0-dev pkg-config` on Debian or Ubuntu.
+The integration corpus retains reviewed Manim Community Edition renders for comparison. The
+regular tests compare the frozen and current manimgx packages on the same host and do not need
+CE. Restore canonical movies from the [fixture
+release](https://github.com/academa-labs/manimgx/releases/tag/corpus-reference-377a0df) to
+inspect them; rerendering proposes a reference change. Rendering a new or changed scene with
+CE needs its dependency group: `uv sync --group ce` (`just sync` leaves it out again). Its
+bindings to Cairo and Pango build from source where they have no wheels (pycairo on macOS and
+Linux, ManimPango on Linux), so that needs those libraries: `brew install cairo pkg-config` on
+macOS, `apt-get install libcairo2-dev libpango1.0-dev pkg-config` on Debian or Ubuntu.
## Setting up the development environment
@@ -123,6 +134,10 @@ lockfile as it is. Run anything else the same way (`uv run --frozen python …`)
- `just test [args]`: the suite, in parallel; `args` go to pytest, as in
`just test tests/integration/test_time.py -x`.
+- `just test-rust`: the Rust workspace's core and native-library tests, without embedding Python.
+- `just check-rust-web`: compile-check the browser engine.
+- `just test-rust-web`: the engine's browser tests, using wasm-bindgen-test-runner and a
+ browser driver.
- `just test-typescript`: build and test the browser package, including its compiled worker
and public declarations.
- `just test-coverage [args]`: the same, measuring coverage (see
@@ -137,7 +152,9 @@ lockfile as it is. Run anything else the same way (`uv run --frozen python …`)
### Docs
- `just serve-docs`: the docs site at <http://localhost:8000>, rebuilt as its pages change.
-- `just build-docs`: the docs site, into `site/`, as it is deployed.
+- `just build-docs`: the docs site, into `docs/site/`, as it is deployed.
+- `just render-docs [args]`: render missing or changed example films.
+- `just build-docs-pages`: build the pages from completed films.
See [Documentation](documentation.md#local-preview).
@@ -155,8 +172,7 @@ See [Project management](project-management.md#releases).
### By hand
-Two tools have no recipe, and no workflow runs them. Run them in `rust/`:
-
-- `cargo test -p mitex-spec-gen`: whether the committed LaTeX command spec is still what
- mitex's package makes (see [The engine](engine.md#typesetting)).
-- `cargo clippy`: the lints `rust/engine/Cargo.toml` sets for the engine.
+`cargo clippy`, run in `rust/`, checks the lints `rust/engine/Cargo.toml` sets for the
+engine. It has no recipe and no workflow runs it. The LaTeX command-spec tests are part of
+`just test-rust`; run `cargo test --locked -p mitex-spec-gen` in `rust/` to check only those
+(see [The engine](engine.md#typesetting)).
diff --git a/docs/content/developer-guide/project-management.md b/docs/content/developer-guide/project-management.md
index 5bcfa751..0439b3f8 100644
--- a/docs/content/developer-guide/project-management.md
+++ b/docs/content/developer-guide/project-management.md
@@ -34,7 +34,7 @@ The repository is the package, manimgx, and holds more than its code:
├── LICENSE-LAVAPIPE ← the notices of the lavapipe the Linux wheels bundle
├── LICENSES/ ← the text of each license a file of the repository is under
├── REUSE.toml ← whose each file is, and under which license, where it doesn't say
-└── .github/ ← the workflows, deployment configs, Dependabot, the
+└── .github/ ← the workflows, deployment configs, the
contributing guide, issue forms and pull request template
```
@@ -87,8 +87,8 @@ gets the image. [Releases](#releases) says how a release is made.
Developer A installs the dependencies today and the tests pass. Developer B installs them
a month later, gets a newer Typst or numpy, and the tests fail. For manimgx the risk is
-sharper than usual: the integration corpus compares frames by the hash of their pixels, so
-any change in how a glyph is laid out or a color is rounded shows.
+sharper than usual: the integration corpus compares the current and frozen packages' frames
+pixel for pixel, so any change in how a glyph is laid out or a color is rounded shows.
So everyone needs the same Python, the same version of every package and crate, and the
same tools with the same settings, in one command:
@@ -144,6 +144,7 @@ types the same long commands with different options. With it:
```sh
just test # pytest, in parallel, in the locked environment
+just test-rust # the Rust core and native libraries, without embedding Python
just check # every check of .pre-commit-config.yaml
just serve-docs # render the docs' examples, write the reference, serve the site
```
@@ -250,7 +251,7 @@ the GPL-3.0-or-later. Its section 6 (and the LGPL's, which refers to it) asks
that whoever gets the wheels can get their complete source, from where the wheels are or from
a place the wheels point to, for as long as the wheels are offered: all of it, the crates too,
not links to where others publish them, which can go. Each GitHub release carries it,
-`manimgx-X.Y.Z-source.tar.xz`, which builds the wheels offline (see
+`manimgx-X.Y.Z-source.tar.xz`, with the sources and build recipes (see
[Others' sources](engine.md#others-sources)); the wheels' notice, the README (PyPI's page) and
the release's notes point to it, and the README and the notes say what FFmpeg asks every page
that offers it to say. A release is never deleted while PyPI offers its wheels.
@@ -263,8 +264,8 @@ What writes and builds, a folder for each thing it makes:
cibuildwheel run.
- [`create_executable.py`](https://github.com/academa-labs/manimgx/blob/main/scripts/release/create_executable.py)
(`just create-executable`) makes this machine's executable from its wheel in `dist/`:
- a standalone Python (3.14, through uv) with the wheel, the font packages and the
- dependencies `uv.lock` pins installed, packed into one file by
+ an exact, SHA-256-verified Python Build Standalone archive with the wheel, the font
+ packages and the dependencies `uv.lock` pins installed, packed into one file by
[PyApp](https://ofek.dev/pyapp). The file's
first run unpacks the Python it holds; every run then runs `manimgx` there, with no
network and no Python on the machine, and `manimgx self` manages it (`self pip install`
@@ -272,17 +273,24 @@ What writes and builds, a folder for each thing it makes:
`dist/manimgx-<os>-<arch>.tar.gz` (a `.zip` on Windows), after running what it made once.
- [`smoke_test.py`](https://github.com/academa-labs/manimgx/blob/main/scripts/release/smoke_test.py)
renders a scene with an installed manimgx: the check a wheel or an executable passes
- before it is kept.
+ before it is kept. It decodes generated PCM and the reference Opus fixture, exports
+ their soundtrack and reopens the MP4's AAC sound. Pyodide records the same scene and
+ checks the take's version, frame count, sound and successful end, and its embedded player.
- [`build_lavapipe.sh`](https://github.com/academa-labs/manimgx/blob/main/scripts/release/build_lavapipe.sh)
builds Mesa's lavapipe for a Linux wheel, in the manylinux image (cibuildwheel's
- `before-all`): Mesa and glslang from their sources, checked against pinned hashes, with
- the image's LLVM linked in, exporting only what Vulkan's loader calls. It writes
- `src/manimgx/lavapipe/libvulkan_lvp.so`, which the wheel then takes in.
+ `before-all`): Mesa, glslang and LLVM from their sources, checked against pinned hashes.
+ LLVM carries the register-class correction in `scripts/release/llvm/`. The driver
+ exports only what Vulkan's loader calls. The script writes
+ `src/manimgx/lavapipe/libvulkan_lvp.so`, which the wheel then takes in. Its checked
+ archives go through the engine's source store. After repair, `linux_sources.py` uses
+ auditwheel's SBOM and RPM metadata to retain the exact distribution source packages
+ for bundled libraries. These are sources and provenance; the system build
+ tools are not a frozen, hermetic environment.
- [`licenses.py`](https://github.com/academa-labs/manimgx/blob/main/scripts/release/licenses.py)
(`just licenses`) writes the wheels' third-party notice (see
[The package](#the-package)).
- [`docs/`](https://github.com/academa-labs/manimgx/tree/main/scripts/docs): the docs' generated pages, which `just build-docs` writes
- before the site is built: the Gallery and the API reference (see
+ before the site is built: the Gallery and the command-line reference (see
[Documentation](documentation.md)).
- [`showcase/`](https://github.com/academa-labs/manimgx/tree/main/scripts/showcase): the README's pictures, made by hand and committed:
the logo (the banner, the header's, the favicon) and the wall of example films.
@@ -327,7 +335,7 @@ The repository's root is the package, defined in
`license` names every license of what the distributions hold, as one SPDX expression:
manimgx's own MIT, those of the crates compiled into the engine (x264's GPL-2.0-or-later
among them), of Typst's fonts and data, and of the lavapipe a Linux wheel bundles.
- `license-files` puts `LICENSE` and the two notices beside it into the wheel's metadata.
+ `license-files` puts `LICENSE` and the three notices beside it into the wheel's metadata.
Its README is the repository's, `README.md`.
- `[project.scripts]`: makes `manimgx` a command, running `manimgx.cli:main`.
- `[build-system]` and `[tool.maturin]`: [maturin](https://www.maturin.rs) builds the
@@ -355,6 +363,9 @@ Beside it, at the root, the notices `license-files` names besides `LICENSE`:
sources it is built from, and those of what it holds, of the libraries it links to and of
LLVM. It is written by hand, from Mesa's sources: a test fails when
`scripts/release/build_lavapipe.sh` builds another Mesa than the one it describes.
+- [`LICENSE-DXC`](https://github.com/academa-labs/manimgx/blob/main/LICENSE-DXC):
+ the notices of the pinned DirectX Shader Compiler the Windows wheel carries, including
+ its source dependencies. The source archive retains the matching source closure.
In `src/manimgx/`, besides the Python:
@@ -413,6 +424,7 @@ crate's exact version, committed (`just upgrade` moves it too). Cargo runs here,
Typst, mitex, winit, rustybuzz) and the Clippy lints it answers to.
- `x264/`, `nasm/`: x264 and NASM, built from their sources.
- `ffmpeg/`: FFmpeg's audio decoders and libopus, built from their sources, behind one call.
+- `dxc/`: the verified DirectX Shader Compiler binary and matching source closure for Windows.
- `mitex-spec-gen/`: mitex's Typst package, which the engine serves to Typst (with its own
`lib.typ`, which imports only the scope the converted LaTeX calls), and the command spec made
from it.
@@ -446,7 +458,10 @@ draws on the CPU, and a GPU given to the container (`--device /dev/dri` for AMD
docker run --rm -v "$PWD:/work" ghcr.io/academa-labs/manimgx render scene.py
```
-`just build-docker-image <version>` builds it; a release publishes it.
+`just build-docker-image <version>` builds that `published` target for local use. A release
+builds the separate `release` target from its already-tested wheel and font artifacts, with
+runtime dependencies authenticated against `uv.lock`. It smoke-tests and retains OCI
+archives before any registry publication; publishing copies those same image digests.
## Releases
diff --git a/docs/content/developer-guide/testing.md b/docs/content/developer-guide/testing.md
index 89b9768b..30fba5f8 100644
--- a/docs/content/developer-guide/testing.md
+++ b/docs/content/developer-guide/testing.md
@@ -254,25 +254,53 @@ checks every case three ways:
checker (suppression comments, `Any`, `cast`, …), and no value that manimgx leaves
`Any` or `Unknown`
([`typecheck.py`](https://github.com/academa-labs/manimgx/blob/main/tests/integration/corpus/typecheck.py)).
-3. `test_regression`: the scene renders, and the MP4 the product exports shows every frame
- of its film. Today's manimgx matches its stored frames, hash for hash, as well as the
- duration and timeline. This check covers every case, including those that differ from
- Manim or await review.
-
-When `test_regression` fails, it reports changes to the duration, timeline or frames. If the local reference video is present, it measures the difference and writes the worst pair, the reference's frame beside today's, into `tests/integration/_diffs/<case>/`. A fresh clone can still check every stored frame hash without those videos.
+3. `test_regression`: a frozen manimgx package and today's package render the scene in
+ separate fresh processes on the same host and adapter. Every RGB pixel, exact duration,
+ timeline and frame count must agree, and the exported MP4 must contain every frame.
+ This check covers every case, including those that differ from Manim or await review.
+
+The committed `tests/integration/baselines.json` binds each case's inputs, canonical movie
+and review to an immutable package generation. A generation names the complete Python and
+native wheels for the CI platforms, their SHA-256 identities, the locked runtime
+dependencies, font payload and the shared execution contract (launching, seeding,
+authoring and reading frames). Changing that contract requires canonical validation, so
+a runner change cannot silently change both sides together. The wheels are downloaded and verified once per local
+cache; a test worker extracts each generation once. The baseline never follows `main`.
+
+Promotion first proves that the frozen package reproduces the actual canonical movie
+pixel for pixel. Subsequent tests compare the two packages on their shared host, so
+Metal, Vulkan and Direct3D may rasterize differently without weakening regression detection
+within any one backend. SHA-256 protects artifact identity; RGB bytes decide image equality.
+No image tolerance is used for regression acceptance.
+
+Failures keep the baseline movie, both process logs and the first differing frame pairs
+in `tests/integration/_diffs/<case>/`, and report the full stream's mismatch counts and
+largest channel difference. They use the original comparison; no diagnostic rerender is
+needed. Successful comparisons remove their transient films. A fresh clone needs the
+verified package downloads, not the canonical movies, to run these tests.
### Working with the corpus
`test_corpus.py` only checks; `just corpus` renders and reviews. A reference changes only
when a change means it to, and after someone has looked at the new frames.
-On a fresh clone, run `just corpus render CASE` before opening a case in the review panel or running `just corpus diff CASE`; those views need the locally generated videos. The regression test uses the committed frame hashes without them.
+The review panel and `just corpus diff CASE` need the canonical movies identified by the
+committed sidecars. Restore those movies to inspect an existing review; rendering with a
+new engine is a proposal to change the reference, not a way to restore it. The initial
+[fixture release](https://github.com/academa-labs/manimgx/releases/tag/corpus-reference-377a0df)
+preserves both engines' canonical movies, their checksums and review records. Verify a
+restored movie against its committed sidecar before using it.
- **A new case** is a folder in `cases/` holding its `scene.py`. Render it with `just corpus render CASE`, which renders it in both engines and compares them; look at it (`just review`); and record your verdict with `just corpus review CASE working` (or `not_matching`, or `not_working`; `--note` says why). Commit the scene, facts, review and video hash sidecars; Git ignores the videos.
- **A change that is meant to change how cases look** renders their references again with
`just corpus render CASE…`. A case's review is pinned to the renders it was given for,
so it no longer speaks for the new ones: look at the new frames before you commit them,
and renew the verdict (in the review panel, or with `just corpus review`).
+- **A baseline promotion** freezes the wheels of an explicit commit with
+ `just corpus baseline freeze`, then verifies selected cases against their canonical
+ movies with `just corpus baseline stage`. Review the staged catalog and its evidence
+ before replacing `tests/integration/baselines.json`. Missing mappings, stale reviews,
+ changed dependencies and changed inputs fail closed; they never update a baseline.
- `just corpus status` says where every case stands, and `just corpus --help` lists the
rest.
diff --git a/docs/content/developer-guide/understanding-manimgx.md b/docs/content/developer-guide/understanding-manimgx.md
index 4347bbf3..293c8261 100644
--- a/docs/content/developer-guide/understanding-manimgx.md
+++ b/docs/content/developer-guide/understanding-manimgx.md
@@ -194,12 +194,13 @@ geometry, paint, animation, and rendering then work like the square's.
them with selectable formula pieces. Changing a character's color can split a
ligature at its carets without changing the typeset layout.
-Layouts are cached on disk in the system's temporary `manimgx-layouts` directory,
-keyed by source and environment. Decoded glyph records are reused in a bounded cache,
-while layouts and live glyphs hold what they need themselves. Clearing that cache does
-not invalidate existing text. The fonts come from the caller's paths, the installed
-manimgx font packages, and Typst's embedded fonts; a system font is considered only for
-a family the document explicitly names. See [The engine](engine.md#typesetting) for
+Layouts and font scans use the current user's cache directory, or the page runtime's
+private filesystem in the browser. Layouts are keyed by source and environment. Decoded
+glyph records are reused in a bounded cache, while layouts and live glyphs hold what they need themselves. Clearing that cache does
+not invalidate existing text. `MANIMGX_CACHE_DIR` relocates both disk caches to an explicit
+directory, useful in containers and isolated tests. The fonts come from the caller's paths,
+the installed manimgx font packages, and Typst's embedded fonts; a system font is considered
+only for a family the document explicitly names. See [The engine](engine.md#typesetting) for
the native compiler and font environment.
Two consumers have their own layout responsibilities.
@@ -256,9 +257,17 @@ behaves differently at 30 and at 60 frames per second. What a scene shows would
its frame rate.
Scene time is exact, a `Fraction` of seconds, and frames sample it.
-
-- A play or wait of duration _d_ that begins at time _T_ owns the frames whose times fall
- in [_T_, _T_ + _d_). Frame _k_ shows the world at exactly _k_/fps.
+Floating durations, lag ratios and frame rates mean the simplest rational that rounds
+back to the supplied float: `5 / 6` stays exactly five sixths, while distinct floats stay
+distinct and a positive duration never rounds down to zero. Compositions keep their
+computed durations as fractions; observation and animation evaluation use floats.
+
+- A play or wait of duration _d_ that begins at time _T_ owns the frames whose observed
+ times fall in [_T_, _T_ + _d_). Frame _k_ samples _k_/fps. An event and a sample that
+ round to the same binary64 instant are observed together: the frame sees every event
+ there, in exact order, without rewinding the last event. This applies to nested
+ animations as well as successive plays: rounding differences that leave an observed
+ instant unchanged do not add a frame. Still exports select from this same sample grid.
- Then the world is brought to _T_ + _d_ itself, where `construct` goes on.
- When `construct` returns, a closing frame shows the scene as it ends.
@@ -266,8 +275,9 @@ At each instant, the playing animation is evaluated at its point in its window o
then the updaters run, then the recorders (such as a [`TracedPath`][manimgx.TracedPath]).
A per-frame updater restores a relation. A time-based updater that is a *flow* is exact at
any instant; any other time-based updater is *simulated*, stepped on a clock of its own
-(`config.simulation_rate` ticks a second, 60 by default), so the world is the same at every
-frame rate.
+(`config.simulation_rate` ticks a second, 60 by default), independently of the output frame
+rate. A per-frame callback that accumulates a change on each invocation still depends on
+how many frames are requested; express such motion in time or as a restored relation.
The frames of a play are computed in one of two ways:
@@ -286,7 +296,7 @@ scene's author sees it.
## Step 5: The film and its feed
The renderer consumes drawing values rather than the Python object graph. A frame
-is described to the engine as a *view* (the camera's matrices and the background) and one 320-byte *record* per object: its two shape keys and
+is described to the engine as a *view* (the camera's matrices and the background) and one 336-byte *record* per object: its two shape keys and
two 3×4 matrices (the blend's terms), its reveal window, its colors, its gradient or
per-vertex color rows (by key), its widths and flags. Shapes, color rows and textures are
uploaded once, keyed by their content and interpretation (an xxh3 digest). Equal shapes
@@ -298,7 +308,7 @@ The [`Film`][manimgx.Film] sends each frame:
- to the video, encoded as it comes;
- to a function, if one is given, as a [`Frame`][manimgx.rendering.film.Frame] that draws its pixels
only when asked;
-- or without per-frame output: `manimgx check` evaluates the timeline and draws only
+- or without per-frame output: `manimgx inspect` evaluates the timeline and draws only
selected storyboard snapshots.
A frame equal to the one before is not sent again: it lengthens it, into a hold. Each play,
@@ -316,28 +326,31 @@ in `audio/fal.py`, while any function returning a Speech can be a voice.
## Step 6: The engine
The engine is a Rust crate compiled into the package as `manimgx._engine`. It draws the
-records on the GPU with [wgpu](https://wgpu.rs), 2D paths exactly (each pixel covered by
-the area inside it, computed from the control points), and 3D scenes, point clouds and
-meshes with a raster pipeline. For a video, it converts only the parts of a frame that
-changed, hands them to x264 on a thread of its own, and writes the MP4. It also typesets.
+records on the GPU with [wgpu](https://wgpu.rs): paths use analytic segment coverage after
+curve flattening, while point clouds and meshes use a raster pipeline. The view's
+composite combines their coverage, paint, and depth. For a video, it converts only the
+parts of a frame that changed, hands them to x264 on a thread of its own, and writes the
+MP4. It also typesets.
[The engine](engine.md) describes it.
## The command line
-`manimgx render`, `still` and `check` are a [Typer](https://typer.tiangolo.com) app in
-[`cli/`](https://github.com/academa-labs/manimgx/tree/main/src/manimgx/cli). Each loads the
-scene file, picks the scene, sets the configuration, and renders it with the film's hooks:
-a *take*. `render` and `check` report the timeline, a storyboard, and the layout problems a
-viewer would see when each play ends (what the frame cuts off, texts that overlap, lines
-through a text, fills drawn over one, text too small to read), measured on geometry, not
-pixels; `still` draws the frames at given times on one sheet. An error in the scene is
-shown through the lines of the author's own code. `manimgx preview` records the scene as a
+The `manimgx` command line is a [Typer](https://typer.tiangolo.com) app in
+[`cli/`](https://github.com/academa-labs/manimgx/tree/main/src/manimgx/cli).
+Each command loads the scene file, picks the scene, sets the configuration, and renders it
+with the film's hooks: a *take*. `render` and `inspect` write annotated storyboards and
+report 2D layout problems (what the frame cuts off, texts that overlap, lines through a
+text, fills drawn over one, text too small to read), measured on geometry. `inspect` also
+lists the timeline. It samples play endings
+by default, or selected frames with `-t`; pictures and checks use the same scene state.
+An error in the scene is shown through the lines of the author's own code.
+`manimgx preview` records the scene as a
take and sends it to a [`Window`][manimgx.Window], a process of its own that plays it, and
runs the scene again each time its file is saved (see [The engine](engine.md#the-player)).
The command-line modules follow those operations: `cli/scenes.py` loads and selects
-scenes and records takes; `cli/export.py` writes videos, stills and presentation
+scenes and records takes; `cli/export.py` writes videos, inspections and presentation
pages; `cli/preview.py` manages re-recording for the window. `cli/diagnostics.py`
reads visible scene geometry and reports layout problems. `cli/storyboard.py`
collects frame sheets and timeline reports. These are clients of scene execution
@@ -371,7 +384,7 @@ When you run `manimgx render scene.py`:
immutable shapes and whose style is one immutable paint.
3. **Sample**: frame _k_ shows the world at _k_/fps; a pure play's frames are computed at
once.
-4. **Feed**: each frame becomes a view and a 320-byte record per object; shapes cross to
+4. **Feed**: each frame becomes a view and a 336-byte record per object; shapes cross to
the engine once.
5. **Draw and encode**: the engine draws each frame on the GPU and encodes what changed
into an H.264 MP4.