knaxuslearn · build · ship

Roadmaps / Python / Phase 4

Phase 4 of 4 · Study weeks 13-16

Packaging, supply chain and upgrades

This phase makes the last checkpoint possible: a service you can ship, keep patched and defend to a team.

Topics every week

  1. Week 138 h
    • uv, lockfiles and workspaces
    • pyproject.toml
    • Wheels, the stable ABI and free-threaded wheels
    • Reproducible builds

    Hand inA lockfile build that gives the same image twice

  2. Week 148 h
    • Container images and a non-root user
    • Startup time and lazy imports
    • Configuration and secrets
    • Health checks

    Hand inAn image that starts in 3 s or less

  3. Week 158 h
    • pip-audit and advisories
    • A dependency budget
    • pickle, eval and unsafe deserialisation
    • Typosquatting and build scripts

    Hand inA policy where a seeded vulnerable package fails CI

  4. Week 168 h
    • Upgrade policy for an annual release
    • The upgrade rehearsal
    • Where Python is enough and where it is not
    • Review

    Hand inCheckpoint 4, the upgrade report and the memo

Practice projects

  • Practice 1, the lockfile (Week 13): build the image twice from the lockfile. Done when: the dependency list is identical and you say what is not reproducible (for example base image tags).
  • Practice 2, the vulnerable package (Week 15): pin a package with a known advisory in a test branch. Done when: pip-audit fails CI and removing it passes.
  • Practice 3, the upgrade rehearsal (Week 16): run the test suite on the previous and the current CPython. Done when: a table compares test results, warnings, startup time and throughput, and says whether to move.
  • Optional, the unsafe pickle: show a pickle that runs a command when loaded, inside a container. Done when: a test proves the service rejects pickled input.

GitHub repos to study

Existence and last commit were checked on 22 Nov 2026 by shallow clone. Every repository below had a commit in the last 12 months.

RepoWhat to readWeek
astral-sh/uvResolution, lockfiles and workspaces13
pypa/pip-auditHow an environment is matched against advisories15
python/cpythonThe release schedule PEP and the deprecation notes16

Milestone checkpoint

Run Checkpoint 4. Build from the lockfile, add the audit gate and the seeded bad package, run the image as a non-root user and measure startup. Run the upgrade rehearsal. Write the memo with the numbers from the checkpoints: where Python was enough, where it was not and what you would use instead. Hand in the CI output (a failing and a passing run), the upgrade table, ADR-7 (the dependency and upgrade policy) and the memo.

Check yourself

Answer each question in your head first, then open it to check.

  1. What does a lockfile give you that pyproject.toml does not?
    The exact versions of every direct and indirect dependency, so two builds match.
  2. Why is loading a pickle from outside unsafe?
    Unpickling can call any function in the process, so a crafted file can run code.
  3. What does an advisory scan miss?
    Vulnerabilities not yet published, malicious packages with no advisory and flaws in your own code.
  4. How do you plan for an annual Python release?
    Run the tests against the new release candidate in CI, read the deprecation notes, rehearse the move on a branch and keep the previous version supported for a stated period.
  5. When would you tell a team not to use Python for a component?
    When the work is a tight CPU loop with strict latency, when memory per process is tight, or when a team needs a single static binary. Put numbers on the cost first.