Hands-on labs · from your computer to production

Python Labs

Build real Python projects from your laptop to production: a modern project setup, a command-line tool and a tested API, then containers with Postgres, a Google Cloud deployment and a production-grade service. Every lab shows what changes when the same code runs a real system.

Start the first lab →

Every lab ends with In production: what changes when the same work runs a real system, and a checklist you can use at work.

Local

Your own computer. No account, no cost.

  1. A Modern Python Project: uv, src Layout, Tests and Linting

    Set up a Python project the way professional teams do: uv for environments and dependencies, a src layout, a lockfile, pytest for tests and ruff for linting and formatting, all driven from pyproject.toml.

    Beginner30 minFree

  2. Build, Test and Ship a Command-Line Tool

    Write a real command-line tool with argparse subcommands, test it with pytest's capsys and tmp_path, give it an entry point, build a wheel and install it like any other tool.

    Beginner40 minFree

  3. A Tested REST API with FastAPI and SQLAlchemy

    Build a small product catalog API with FastAPI, SQLAlchemy and SQLite: validated input, proper status codes, a dependency-injected database session and tests that use their own in-memory database.

    Intermediate50 minFree

Container

Docker or Docker Compose on your computer.

  1. Containerise the API: Dockerfile, Compose and Postgres

    Package the catalog API in a small, non-root container image built with uv, then run it with Postgres in Docker Compose: health checks, start-up order, persistent data and switching databases with one environment variable.

    Intermediate45 minFree

Google Cloud

A Google Cloud project with billing. Free tier where possible; always clean up.

  1. Deploy the API to Google Cloud Run

    Push the catalog image to Artifact Registry and run it on Cloud Run: a managed, autoscaling container service with HTTPS, revisions and per-request billing. Then remove everything so nothing keeps costing money.

    Intermediate40 minUsually $0 within the free tier; check current pricing

Production

Production design: environments, CI/CD, security, monitoring, rollback.

  1. A Production-Grade Python Service

    Turn the catalog API into a service you could run in production: settings from the environment, structured JSON logs with request IDs, liveness and readiness checks, Alembic migrations, a hardened container, graceful shutdown and a CI pipeline.

    Advanced90 minFree (runs on your computer)

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake