Files
shinyobjectz 4d44519fc1 Local models install and run on a Mac, Windows or Linux with nothing installed first
Each local model's setup is now tools/<model>/setup.py (standard library only, on tools/local_setup.py), run by uv
on any OS as raea runs it: uv on the PATH, else raea's own uv 0.12.24 fetched once into ~/.cache/raea-tools/uv (where
tools/ensure.sh puts it) and checked against its SHA-256. The setup.sh beside each is a wrapper for a Mac or Linux.
Until now each setup was a sh script needing uv already installed (brew install uv), so Windows had no way to
install any local model.

- SAO: Core ML on a Mac, ONNX Runtime elsewhere (CUDA where nvidia-smi finds a GPU; RAEA_SAO_CUDA=0|1); its WAV is
  written by Python's wave module, not an installed ffmpeg (same samples)
- matchmove, splat: footage read through PyAV, whose wheels carry FFmpeg's libraries (no ffmpeg/ffprobe needed);
  splat fetches Brush v0.3.0's release build for macOS arm64, Linux x86_64 or Windows x86_64, each SHA-256 checked
- goo: Taichi on Metal on a Mac, else its best GPU (CUDA, Vulkan) or the CPU; the backend is reported as run
- TokenSynth: its code as GitHub's archive at a pinned commit (no git); coremltools only on a Mac
- the engine runs .venv\Scripts\python.exe on Windows (venv_python), Brush's brush_app.exe
- tools/release.sh ships tools/local_setup.py
2026-11-18 16:24:45 -08:00

33 lines
2.1 KiB
Python

"""Goo for raea's physics (<Goo>, the `physics.goo` native call): objects melted into viscous goo by an MLS-MPM solver
(Taichi: Metal on a Mac, CUDA or Vulkan elsewhere, else the CPU; Apache-2.0), each frame's surface reconstructed
(marching cubes, scikit-image: BSD) into a mesh sequence (.rseq) the engine plays back by frame; thin liquids
("solver": "sph") by SPlisHSPlasH (MIT) instead. run.py and sph.py are copied in beside the venv. Installs into
$RAEA_GOO (default ~/.cache/raea-goo); raea runs this itself the first time a goo bake is asked for
(tools/local_setup.py: how, on any OS). pySPlisHSPlasH is pinned: 2.19.0 hangs after its first step on a Mac
(2026-10-20); 2.17.0 runs. Size: about 600 MB (the venv). No model weights."""
import shutil
import subprocess
import sys
from pathlib import Path
HERE = Path(__file__).resolve().parent
sys.path.insert(0, str(HERE.parent))
from local_setup import Setup # noqa: E402
with Setup("goo", "RAEA_GOO", "raea-goo") as s:
Path(".ready").unlink(missing_ok=True)
# uv's own Python, never a framework build (Homebrew's): SPlisHSPlasH finds its emitters' meshes beside the running
# executable (the venv's bin/resources), and a framework Python runs as Python.app inside its own install
framework = "import sys, sysconfig; sys.exit(1 if sysconfig.get_config_var('PYTHONFRAMEWORK') else 0)"
if s.python.exists() and subprocess.run([str(s.python), "-c", framework]).returncode != 0:
s.say("remaking the venv on uv's Python (this one is a framework build)")
shutil.rmtree(".venv")
s.venv("3.12", ["taichi", "numpy", "scipy", "trimesh", "scikit-image", "zstandard", "pillow", "pySPlisHSPlasH==2.17.0"],
imports=("taichi", "numpy", "scipy", "trimesh", "skimage", "zstandard", "PIL", "pysplishsplash"), managed=True)
s.run([s.python, "-c", "import taichi, numpy, trimesh, skimage; print('taichi', taichi.__version__, 'numpy', numpy.__version__, 'trimesh', trimesh.__version__, 'skimage', skimage.__version__)"],
stdout=sys.stderr)
for f in ("run.py", "sph.py"):
shutil.copy2(HERE / f, f)
s.ready(".venv")