pyproject.toml is a standardized file (PEP 518, PEP 621) used to configure Python packaging, building, and tools.
build-system
Defines how your project is built.
This tells Python which tools to use when running pip install or python -m build.
setuptools is the classic standard and widely use
other build tools
- Poetry
- Hatch
- flit
python build
How to turn your source code into an installable package
Tip
use --no-isolation flag to disabled creating isolated virtual environment during build
project metadata (PEP 621)
The [project] section in pyproject.toml that describes your Python package:
- name
- version
- dependencies
- dependencies
- entry points
- requires-python
- and more
version
Set manual
or dynamic using tools like setuptools-scm.
dependencies
more project settings
- [project.optional-dependencies]: install optional package
pip install my_package[dev] - [project.scripts]: entry point/CLI command run
coolappto run application after install
Build Your First Python Package with pyproject.toml
From wheel to deb
| Tool | Uses .install |
Easy | Policy-correct | Best for |
|---|---|---|---|---|
| dpkg-deb | ❌ | ⭐⭐⭐⭐ | ❌ | quick hacks |
| dpkg-buildpackage | ✅ | ⭐⭐ | ✅ | real Debian |
| debuild | ✅ | ⭐⭐ | ✅ | same as above |
| stdeb | ⚠️ | ⭐⭐⭐ | ⚠️ | Python-only |