⏱️ Slide Timing: 1 min - Welcome and frame the session: every Python project needs its own sandbox for packages - Promise: by the end, everyone will have created, used, and torn down a venv themselves - Bridge: start with the pain venvs actually solve, before showing the commands
⏱️ Slide Timing: 3 min - Ask: has anyone had a project randomly break after installing something for a different project? - This is almost always a shared-environment collision - Frame it as inevitable, not a mistake — the default Python setup has no isolation - Set up the next slide: show exactly how the collision happens ❓ Ask: "Has your code ever broken after installing something for a totally different project?"
⏱️ Slide Timing: 5 min - Left panel: Project A and Project B both install into the same global site-packages - Whichever `pip install` ran most recently wins — the other project silently starts failing - Emphasize "silently" — no error at install time, just broken imports or wrong behavior later - Right panel: each project gets its own `venv` folder with its own copy of packages - No shared state between projects, so conflicting version requirements are a non-issue - This diagram is the one-slide summary of "why venvs exist" — refer back to it if questions come up later
⏱️ Slide Timing: 3 min - Correct a common misconception: a venv does not copy the entire Python interpreter - `pyvenv.cfg` inside it just records the path to the real system Python it was built from - This is why venvs are cheap to create and safe to throw away - Bridge: show the folder structure and activation flow visually
⏱️ Slide Timing: 3 min - Walk left to right: `python -m venv .venv` creates the folder from the system Python - `bin/` (or `Scripts/` on Windows) holds venv-local `python` and `pip` executables - `lib/site-packages/` is where `pip install` actually puts packages — isolated per project - `activate` just prepends `bin/` to your shell's PATH, so `python`/`pip` resolve inside the venv first
⏱️ Slide Timing: 2 min - Keep this brief — the goal is recognition, not mastery of every tool - If students see `uv.lock` in a repo later, they should recognize it as "this project uses uv, not raw venv" - Reassure: the underlying concept (isolated site-packages per project) is identical across all of these
⏱️ Slide Timing: 4 min - Live-type this in the terminal rather than just showing the slide - Point out the prompt prefix `(.venv)` appearing after activation — that's the visual cue it worked - `which python` / `where python` should now point *inside* the project folder, not `/usr/bin/python` - Have students run this on their own machine in parallel, both OSes represented in the room
⏱️ Slide Timing: 4 min - Show `pip freeze` output — this file is what makes the environment reproducible for teammates/graders - After `deactivate`, re-run `which python` to show it now points back to system Python - Good moment to try `import requests` in a fresh, non-activated shell — it fails, proving isolation
⏱️ Slide Timing: 3 min - Tie back to the opening problem slide: this is the fix — a portable, exact recipe instead of "it works on my machine" - Mention this is also exactly what CI systems and graders do when they run student submissions
⏱️ Slide Timing: 3 min - The activation pitfall is the single most common mistake in this room — worth emphasizing twice - `.venv/` can be hundreds of MB; committing it bloats the repo for no benefit since it's fully reproducible from `requirements.txt` - Reinforce: nothing irreplaceable ever lives inside a venv folder — deleting it is always safe
⏱️ Slide Timing: 2 min - Suggest students screenshot this slide — it's the reference they'll reach for in every future project
⏱️ Slide Timing: 1 min - Highest priority to bookmark: the official `venv` docs — it's the canonical reference for every flag and edge case
⏱️ Slide Timing: 2 min - Close the loop back to the opening problem: isolation is what prevents the "works on my machine" failure mode - Practice prompt: have students create a venv for their next assignment right now, before leaving class