Dependencies, lockfiles & environments

P35.build-publish.01 · Audience: guest, it-ml, language-pro · Prerequisites: Project layout & pyproject

Real LLM grading for this pageLLM grading (this page):

Your pyproject.toml asks for click>=8.1 — a range. A lockfile answers it with an exact version for every package, direct and transitive. That gap between "what I asked for" and "what got installed" is where reproducibility lives (and where builds silently drift). This module builds the check that connects the two.

Step 1 / 3 — Constraints are ranges
ⓘ Concept: Semantic versioning: major.minor.patch
A dependency is a name plus a constraint: click>=8.1 means "click, at least 8.1". Versions are major.minor.patch, and comparing them field by field is how you decide whether a version satisfies a constraint. Normalise short versions first — 8.1 is (8, 1, 0) — so a plain tuple comparison does the right thing.

Why it matters — A constraint like >=8.1 is a bet on SemVer — that a compatible release won't break you — so evaluating one correctly is the basis of dependency resolution.

Ask the mentor about this module

Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.

Images, PDF or text. Kept on this device only.
Keeping your files on this device

Off by default. The mentor always gets your file; this only decides whether your own copy stays here. Copies live in this browser only - they do not follow you to another device, and clearing site data removes them.

Ctrl/Cmd + Enter to send

🎓 Practice ladder

2 graded rungs · ~24 min

Build a version-constraint checker from scratch, then use it to prove a lockfile satisfies a project's constraints.

Rung 1 — version constraints (SemVer)

Loading exercise…

Rung 2 — does the lockfile satisfy the constraints?

Loading exercise…

You can declare and pin dependencies. Next: what a build actually produces — the wheel and sdist artifacts a registry expects.

My notes on this module

Loading your notes...

Where next?

Continue

Building & publishing artifacts →

Dependencies, Builds & Publishing · P35

Later in Dependencies, Builds & Publishing

Dependencies, lockfiles & environments — TransformerLab