Skip to content

Commit af4d1fa

Browse files
fix(demos): pin Python 3.11+ for VHS bins and complete launch renders
1 parent 6d7fe40 commit af4d1fa

8 files changed

Lines changed: 88 additions & 28 deletions

File tree

demos/vhs/README.md

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,48 @@ Reproducible terminal demos for README **`demos/demo.gif`** and optional launch
44

55
## Quick start (repo root)
66

7+
Use **bash** (avoids zsh quirks with pasted `#` comments):
8+
79
```bash
810
brew install vhs ffmpeg
9-
./demos/vhs/render.sh # README GIF (default)
10-
./demos/vhs/render.sh --doctor # preflight only
11-
./demos/vhs/render.sh --all # demos/vhs/out/*.mp4
11+
bash scripts/render_launch_demos.sh --doctor
12+
bash scripts/render_launch_demos.sh
13+
bash scripts/render_launch_demos.sh --all
1214
```
1315

14-
`render.sh` runs `doctor.sh`, fixes execute bits on `demos/vhs/bin/*.sh`, then records.
16+
Or:
17+
18+
```bash
19+
./demos/vhs/render.sh --doctor
20+
./demos/vhs/render.sh
21+
./demos/vhs/render.sh --all
22+
```
23+
24+
Run **one command per line**. Do not paste trailing shell comments on the same line.
1525

1626
## Common failure: theme does not exist
1727

18-
VHS cannot load `Set Theme demos/vhs/theme.json` reliably. All tapes use **`Set Theme "Catppuccin Mocha"`** instead.
28+
Use **`Set Theme "Catppuccin Mocha"`** in `.tape` files (not `theme.json` paths).
1929

2030
## Outputs
2131

2232
| Command | Output |
2333
|---------|--------|
24-
| `./demos/vhs/render.sh` | `demos/demo.gif` (~30s) |
25-
| `./demos/vhs/render.sh --all` | `demos/vhs/out/01-install.mp4` ... `04-ship-gate.mp4` |
34+
| `render.sh` (default) | `demos/demo.gif` (~30s) |
35+
| `render.sh --all` | `demos/vhs/out/01-install.mp4` ... `04-ship-gate.mp4` |
2636

27-
After re-rendering the GIF, sync to graphtheory.xyz:
37+
After re-rendering the GIF:
2838

2939
```bash
30-
../codegraphtheory.github.io/scripts/sync_demo_gifs.sh
40+
bash ../codegraphtheory.github.io/scripts/sync_demo_gifs.sh
3141
```
3242

33-
## What is real vs staged
34-
35-
| Beat | Real? |
36-
|------|--------|
37-
| Council plan | Yes (`team_coordinator.py`, no API) |
38-
| Swarm progress | **Staged** (`scripts/demo_vhs_apply_fixture.py`) |
39-
| `swarm_watch` UI | Yes |
40-
| Ship-gate pytest | Yes (`tests/test_swarm_progress.py`) |
41-
42-
## Bin scripts
43+
## Bin scripts (called from tapes)
4344

44-
`demos/vhs/bin/show-team-plan.sh` and `animate-swarm.sh` source `demos/vhs/env.sh` themselves. Tapes invoke them with `bash demos/vhs/bin/...` from repo root.
45+
| Script | Purpose |
46+
|--------|---------|
47+
| `bin/show-team-plan.sh` | Council plan JSON |
48+
| `bin/animate-swarm.sh` | Staged swarm_watch replay |
49+
| `bin/run-ship-gate-pytest.sh` | `pytest tests/test_swarm_progress.py` |
4550

4651
See also: [docs/demo-vhs.md](../../docs/demo-vhs.md).
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4+
# shellcheck source=../env.sh
5+
source "$SCRIPT_DIR/../env.sh"
6+
exec "$PY" -m pytest tests/test_swarm_progress.py -q

demos/vhs/demo-30s.tape

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ Set Height 720
66
Set Theme "Catppuccin Mocha"
77
Set TypingSpeed 48ms
88

9-
Type "# Heavy Coder · council + swarm_watch" Enter
9+
Type "# Heavy Coder - council + swarm_watch" Enter
1010
Sleep 500ms
1111
Type "cat demos/vhs/assets/install-transcript.txt" Enter
1212
Sleep 2s
1313

1414
Hide
15-
Type "bash -lc 'source demos/vhs/env.sh && ./demos/vhs/bin/show-team-plan.sh'" Enter
15+
Type "bash demos/vhs/bin/show-team-plan.sh" Enter
1616
Sleep 4s
1717
Show
1818

@@ -25,6 +25,6 @@ Type "cat demos/vhs/assets/coordinator-excerpt.txt" Enter
2525
Sleep 3s
2626

2727
Hide
28-
Type "bash -lc 'source demos/vhs/env.sh && python3 -m pytest tests/test_swarm_progress.py -q'" Enter
28+
Type "bash demos/vhs/bin/run-ship-gate-pytest.sh" Enter
2929
Sleep 4s
3030
Show

demos/vhs/doctor.sh

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,27 @@ command -v vhs >/dev/null && echo "ok: vhs $(vhs --version 2>/dev/null | head -1
1818
command -v ffmpeg >/dev/null && echo "ok: ffmpeg" || { echo "FAIL: brew install ffmpeg" >&2; ERR=1; }
1919
command -v python3 >/dev/null && echo "ok: python3" || { echo "FAIL: python3 not found" >&2; ERR=1; }
2020

21+
if command -v python3 >/dev/null; then
22+
if ! python3 -c "from datetime import UTC" 2>/dev/null; then
23+
if [[ -x /opt/homebrew/bin/python3 ]] && /opt/homebrew/bin/python3 -c "from datetime import UTC" 2>/dev/null; then
24+
export PY="/opt/homebrew/bin/python3"
25+
echo "ok: using PY=$PY (system python3 too old)"
26+
else
27+
echo "FAIL: need Python 3.11+ (datetime.UTC). brew install python" >&2
28+
ERR=1
29+
fi
30+
else
31+
export PY="${PY:-python3}"
32+
echo "ok: PY=$PY"
33+
fi
34+
fi
35+
2136
for f in \
2237
demos/vhs/demo-30s.tape \
2338
demos/vhs/env.sh \
2439
demos/vhs/bin/show-team-plan.sh \
2540
demos/vhs/bin/animate-swarm.sh \
41+
demos/vhs/bin/run-ship-gate-pytest.sh \
2642
scripts/demo_vhs_apply_fixture.py \
2743
scripts/team_coordinator.py \
2844
scripts/swarm_watch.py; do
@@ -32,11 +48,14 @@ done
3248
chmod +x demos/vhs/bin/*.sh demos/vhs/render_demo_gif.sh demos/vhs/render_all.sh 2>/dev/null || true
3349

3450
if [[ $ERR -eq 0 ]]; then
51+
# shellcheck source=demos/vhs/env.sh
3552
source demos/vhs/env.sh
53+
"$PY" scripts/demo_vhs_apply_fixture.py --repo "$DEMO_REPO" --scene start >/dev/null
54+
echo "ok: demo_vhs_apply_fixture.py"
3655
./demos/vhs/bin/show-team-plan.sh >/dev/null
3756
echo "ok: show-team-plan.sh"
38-
python3 scripts/demo_vhs_apply_fixture.py --repo "$DEMO_REPO" --scene start >/dev/null
39-
echo "ok: demo_vhs_apply_fixture.py"
57+
bash demos/vhs/bin/run-ship-gate-pytest.sh >/dev/null
58+
echo "ok: run-ship-gate-pytest.sh"
4059
fi
4160

4261
exit "$ERR"

demos/vhs/env.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,20 @@ export REPO_ROOT
66
export DEMO_REPO="${DEMO_REPO:-$REPO_ROOT/demos/vhs/staging/repo}"
77
mkdir -p "$DEMO_REPO/.heavy-coder"
88
export PYTHONPATH="$REPO_ROOT/src${PYTHONPATH:+:$PYTHONPATH}"
9-
cd "$REPO_ROOT"
9+
cd "$REPO_ROOT"
10+
11+
# Non-interactive shells often pick /usr/bin/python3 (3.9); demos need 3.11+ (datetime.UTC).
12+
if [[ -z "${PY:-}" ]]; then
13+
if command -v python3 >/dev/null 2>&1; then
14+
_ver="$(python3 -c 'import sys; print(sys.version_info[:2] >= (3, 11))' 2>/dev/null || echo False)"
15+
if [[ "$_ver" == "True" ]]; then
16+
export PY="python3"
17+
fi
18+
fi
19+
if [[ -z "${PY:-}" ]] && [[ -x /opt/homebrew/bin/python3 ]]; then
20+
export PY="/opt/homebrew/bin/python3"
21+
fi
22+
if [[ -z "${PY:-}" ]]; then
23+
export PY="python3"
24+
fi
25+
fi

demos/vhs/render.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ usage() {
99
echo " --gif demos/demo.gif (README + graphtheory.xyz) [default]" >&2
1010
echo " --all demos/vhs/out/*.mp4 launch tapes" >&2
1111
echo " --doctor preflight only" >&2
12+
echo "" >&2
13+
echo "Run from repo root. One flag per invocation:" >&2
14+
echo " ./demos/vhs/render.sh --doctor" >&2
15+
echo " ./demos/vhs/render.sh" >&2
16+
echo " ./demos/vhs/render.sh --all" >&2
1217
}
1318

1419
mode="gif"
@@ -17,7 +22,11 @@ case "${1:-}" in
1722
--all) mode="all" ;;
1823
--doctor) mode="doctor" ;;
1924
-h|--help) usage; exit 0 ;;
20-
*) usage; exit 2 ;;
25+
*)
26+
echo "error: unknown argument: $1" >&2
27+
usage
28+
exit 2
29+
;;
2130
esac
2231

2332
chmod +x demos/vhs/doctor.sh demos/vhs/bin/*.sh demos/vhs/render_demo_gif.sh demos/vhs/render_all.sh 2>/dev/null || true

demos/vhs/tapes/04-ship-gate.tape

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Type "cat demos/vhs/assets/coordinator-excerpt.txt" Enter
1212
Sleep 2.5s
1313

1414
Hide
15-
Type "bash -lc 'source demos/vhs/env.sh && python3 -m pytest tests/test_swarm_progress.py -q'" Enter
15+
Type "bash demos/vhs/bin/run-ship-gate-pytest.sh" Enter
1616
Sleep 5s
1717
Show
1818

scripts/render_launch_demos.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
# Render Heavy Coder launch demos (GIF + optional MP4). Always use bash.
3+
set -euo pipefail
4+
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
exec bash "$ROOT/demos/vhs/render.sh" "$@"

0 commit comments

Comments
 (0)