Hands-on exercises with complete runnable code and a zero-setup environment.
Open any lab in GitHub Codespaces or Gitpod (or docker compose up
locally) and the required services are already running — no DB connections, no
cloud, no devops.
| Lab | Module | Layers | What You'll Learn | Time |
|---|---|---|---|---|
| lab-01-n-plus-one-profiling | N+1 Queries | stdlib | Observe N+1, fix with JOIN and IN batch, measure improvement | 30 min |
| lab-02-connection-pool-tuning | Connection Pooling | stdlib | Implement a pool; pool size impact on p50/p99/throughput | 45 min |
| lab-03-cache-aside | Caching Strategy | Postgres + Redis | Read-through cache, prove cache hits skip the DB, invalidation | 40 min |
lab-XX-name/lab.json manifest: module link, infra needed, languages, run/test commandsREADME.md instructionspython/stub.py the file you implement (TODOs)solution.py reference solutiontest_lab.py run to validate your work
To validate your work:
bashcd labs/<lab>/pythonpython -m unittest test_lab.py # green OK = done
Labs with infra in their lab.json (e.g. lab-03) use real Postgres and
Redis — but you never write a connection string. Import the ready handles:
pythonfrom labkit import db, cache
db is Postgres (db.query, db.queryone, db.execute, db.query_count);
cache is Redis (cache.get_json, cache.set_json, cache.delete, ...).
The services and credentials are wired by the environment — see
`.devcontainer/` and `tooling/python/labkit`.
test_lab.py go greenin this section