Loading topic
pyproject.toml is the single configuration file at the root of a Python project. It tells build tools, installers, and developer tools what the project is, what it needs, and how to build it. This chapter explains the tables in the file and how uv reads them. Later chapters cover creating projects6 min readpyproject.toml, lockfiles, and workspaces have a map t5 min readuv init creates, how the three project shapes differ, and what changes after the first uv run. It assumes you know basic pyproject.toml syntax from the earlier chapter on the [project] table, can use a terminal, and have a general idea of what virtual environments do5 min readuv init on a project, you know what pyproject.toml contains, and you have used virtual environments before. Here you will learn how uv decides which Python interpreter a project uses. You will also learn how to control that choice and how to fix the errors peopl4 min readuv init and know what the [project] table in pyproject.toml holds. It also assumes you know what a virtual environment is. Here you will learn what uv add and uv remove do to your files and environment, how to control version constraints5 min readpyproject.toml separates the two with dependency groups, and how uv installs, lock4 min readpyproject.toml, know what uv add and uv sync do, and understand version specifiers such as httpx>=0.27. It explains what uv.lock records, when uv rewrites it, and how to update it on purpose.4 min readpyproject.toml, dependencies, and uv.lock. You should know what a virtual environment is and how uv add changes the [project] table. Here you will learn how uv turns a lockfile into an installed environment, and when to use uv sync4 min readpyproject.toml exposes a function as a terminal command. It assumes you can run uv init, uv add, and uv run, and that you know what a Python module and an import are. Build backends and uv build come in the next cha4 min readuv init, read a pyproject.toml, and run uv sync and uv run. It covers what a build backend is, how the [build-system] table selects one, and what uv build produces.5 min readuv add, and read a pyproject.toml. It also assumes you know that uv.lock records resolved versions. The goal is a CI job that installs the same packages on every run and fails loudly when the project files disagree with ea5 min readpyproject.toml, know how uv add writes to [project].dependencies, and know that uv.lock records resolved versions. By default every dependency comes from PyPI. The [tool.uv.sources] table lets you say "this one comes from somewhere else" without changing4 min readpyproject.toml file. It also assumes you know what uv.lock records. Here you will combine several packages in one repository so they share a single lockfile and a single environment.5 min readuv run, project environments, and dependency groups. Here you will learn when a tool belongs in a project and when it should run on its own.5 min readpyproject.toml, and a virtual environment for that is more setup than the script deserves. Inline script metadata lets the script declare its own Python version and dependencies in a comment block at the top of the file. u4 min readuv publish. It assumes you have read the chapters on pyproject.toml, entry points, and build backends. You should know what [project] and [build-system] contain and how uv build produces files in dist/.4 min readuv init, and that you know what pyproject.toml and uv.lock are. It covers uv pip, the part of uv that mimics pip, pip-tools, and venv. You will use it when a project does not have a uv-5 min readpyproject.toml, uv add, dependency groups, and uv.lock. Here you will move an existing project that uses requirements.txt6 min read