Setuptools

82.0.1 · active · verified Fri Mar 27

Setuptools is Python's original and most established build backend for packaging, distributing, and installing Python packages, with full support for C/C++ extension modules, entry points, and PEP 517/660 editable installs. Current version is 82.0.1 (released Feb 2026). The project ships frequently — multiple major versions per month — and has a history of disruptive but well-warned breaking changes. Requires Python >=3.9 as of v75.4.0.

Warnings

Install

Imports

Quickstart

Minimal modern pyproject.toml-based package layout and programmatic setup.py usage. Run 'python -m build' from the project root to produce sdist + wheel in dist/.

# pyproject.toml (place in your project root — no setup.py needed)
# [build-system]
# requires = ["setuptools>=61"]
# build-backend = "setuptools.build_meta"
#
# [project]
# name = "mypackage"
# version = "0.1.0"
# description = "My package"
# requires-python = ">=3.9"
# license = "MIT"            # PEP 639 SPDX string (setuptools >= 77)
# dependencies = ["requests>=2.25"]
#
# [project.scripts]
# my-cli = "mypackage.cli:main"

# --- Programmatic use (setup.py, still valid as config file) ---
from setuptools import setup, find_packages

setup(
    name="mypackage",
    version="0.1.0",
    packages=find_packages(where="src"),
    package_dir={"": "src"},
    python_requires=">=3.9",
    install_requires=["requests>=2.25"],
)

# --- Runtime metadata (replaces pkg_resources) ---
from importlib.metadata import version, entry_points

pkg_version = version("mypackage")
eps = entry_points(group="console_scripts")

view raw JSON →