Tools ready.
Ideas unlimited.
One download. All 101 experiments and solutions. A clear path from your first script to charts, algorithms, and database-backed projects.
Download the full workbench ↓01 Get a clean Python environment
Install Python 3.11 or newer and extract the ZIP. Open a terminal in the extracted python-lab-workbench folder. The examples run on your machine; this website does not execute Python or connect to your databases.
macOS / Linux
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txtWindows PowerShell
py -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txtIf activation is restricted, call the environment’s Python executable directly. If Linux reports that ensurepip is missing, install the matching Python venv package using your distribution’s package manager.
02 Run an experiment
Keep the terminal at the workbench root. Use the module name shown on each lesson page. Matplotlib scripts save PNG files; open those files to see the plots.
python -m experiments.csv_records
python -m experiments.matplotlib_first_figure
python -m solutions.matplotlib_first_figureFile examples deliberately write practice files in the current directory. Work inside the extracted course folder. Database examples use temporary MySQL tables or uniquely named disposable MongoDB collections.
03 Bring the databases online
Install Docker with the Compose plugin. Copy .env.example to .env and choose two different local MySQL passwords. The workbench reads this configuration without embedding secrets in lesson code.
cp .env.example .env
# Edit .env and choose your local passwords.
docker compose up -d mysql mongo
docker compose ps
docker compose run --rm mongo-initOn Windows use Copy-Item .env.example .env for the copy step. Wait until both database services are healthy. The MongoDB initialization command creates a single-node replica set for the transaction lesson; it may need a few seconds to elect its primary.
MySQL
MySQL 8.4 · Connector/Python
Local port 3307 · database python_lab
Four tasks and two projects, recreated as temporary tables for each connection.
MongoDB
MongoDB 8.0 · PyMongo
Local port 27018 · replica set labrs
Four task documents in a fresh collection for each example.
The MongoDB practice service has no authentication and binds only to your local loopback address. It is a disposable development setup, not a production deployment. A real deployment needs authentication, TLS, appropriate network controls, and a private connection URI.
python -m experiments.mysql_connect
python -m experiments.mongodb_connect
python -m experiments.mongodb_models04 Verify before you trust
The workbench includes a verifier that checks snippet syntax, executes examples and solutions in temporary folders, compares expected text output, and checks generated chart files.
# Standard library and charts; database examples are reported as not run.
python scripts/check_python_lessons.py
# Also execute real MySQL and MongoDB examples after service setup.
python scripts/check_python_lessons.py --databasesDatabase examples depend on your running practice servers. Use the second command to verify the complete course against your configured MySQL and MongoDB environment before adapting the examples.
05 Know what belongs where
experiments/Every lesson’s runnable examplesolutions/One possible answer to every missionlab_support.pyConnection ownership and isolated database fixturescompose.yamlLocal MySQL and MongoDB services.env.exampleYour configuration starting pointrequirements.txtThe package versions used for authoringcourse.jsonLesson records and expected resultsscripts/The course verifierFor a stopped server, inspect docker compose ps and local logs. For ModuleNotFoundError: lab_support, return to the workbench root and use python -m experiments.module_name. Changing MySQL passwords in .env does not automatically update accounts in an existing database volume.
06 Close up shop
docker compose downThis stops the containers and preserves their named volumes. You do not need to delete volumes to rerun lessons: the fixtures are recreated independently.
Choose your next experiment ↗