setuptools
setuptools is a packaging library and build backend for Python that builds and distributes packages, discovers modules, and defines entry points for applications and plugins.
Installation and Setup
Install it from the Python Package Index (PyPI) into a virtual environment:
Key Features
- Acts as a PEP 517 build backend and supports PEP 621 project metadata in
pyproject.toml. - Discovers packages automatically and supports a
src/layout through simple configuration. - Defines console scripts and plugin entry points that expose commands and extensibility hooks.
- Includes package data and supports extras, environment markers, and optional dependencies.
- Builds pure Python and compiled extension modules and integrates with common build tools.
Usage
A modern project declares its build system and metadata in pyproject.toml:
TOML
pyproject.toml
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "package-name"
version = "0.1.0"
description = "Example package"
readme = "README.md"
requires-python = ">=3.10"
dependencies = ["requests>=2.32"]
# ...
Install your project in editable mode during development:
Shell
$ python -m pip install -e .
By Leodanis Pozo Ramos • Updated Dec. 2, 2025