Project layout & pyproject
P35.project-layout.01 · Audience: Guest, IT/ML learner, Language professional
P35.project-layout.01 · Audience: Guest, IT/ML learner, Language professional
A script becomes a package the moment someone else has to install it. That
step is all about one file — pyproject.toml — and one decision: where the code
lives. This module has you write a real pyproject.toml, so the pieces that turn
a folder of .py files into something pip install-able are yours.
pyproject.toml declares the package: its name and version, what it dependencies need, which Python it requires-python, and — in [build-system] — the backend that turns your source into a wheel. There is no setup.py to run: the file is data, read the same way by every tool.Why it matters — Every modern tool — pip, uv, build — reads pyproject.toml, so one declarative file replaces the old setup.py and configures the whole package.
This repo is the worked example. Its pyproject.toml declares the same tables you
are about to write — build backend, project metadata, dependencies:
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "tlab-compute"
version = "0.1.0"
requires-python = ">=3.11"
dependencies = ["numpy", "pandas"]
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.
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.
Write a valid pyproject.toml for a small package, then reason about project layout and installs in an interview-style prompt.
Loading exercise…
Loading exercise…
You can declare a package. The next module is about its dependencies — how versions are constrained, and how a lockfile makes a build reproducible.
Loading your notes...