#!/usr/bin/env bash
# Real demos for P073 "How Python Virtual Environments Work". Made on the Mac (Docker Desktop).
# Ana keeps two small Python projects for her beekeeping club on her laptop: hive-log (weigh.py, written for numpy 1)
# and honey-chart (labels.py, needs numpy 2). One container from a stock Ubuntu 24.04 image (lab/Dockerfile) with
# Ubuntu's own Python 3.12 and python3-venv; numpy comes from PyPI, installed on camera.
# Every command shown is typed into a real interactive bash in a pty, two windows on the same laptop
# (demo_driver.py); every line of output is real.
set -euo pipefail
cd "$(dirname "$0")"
cleanup() { docker rm -f ce-p073-laptop >/dev/null 2>&1 || true; }
cleanup
[ -n "${KEEP:-}" ] || trap cleanup EXIT
docker build -q -t ce-p073 lab >/dev/null
docker run -d --name ce-p073-laptop --hostname laptop ce-p073 >/dev/null
python3 demo_driver.py
