setuptools

The standard build backend that turns Python source trees into installable wheels and sdists for pip and PyPI.

Tool
PyPI
v84.0.0
2,864 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
92 /100 Excellent
Development Activity 84
Maintenance 96
Community 88
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
77 /100 Good
Architecture 85
Code Quality 88
Innovation 60
Learning Curve 75

setuptools is the build backend that most of the Python packaging ecosystem is built on top of. Maintained by the Python Packaging Authority (PyPA), it implements the PEP 517/518 build-backend interface that tools like pip and build call into whenever they need to turn a source tree into a wheel or source distribution — whether that’s triggered by pip install ., pip install -e ., or a CI job building a release artifact.

Historically setuptools was invoked directly through a project’s setup.py, and it still supports that legacy entry point (build_ext, bdist_wheel, egg_info, develop, and dozens of other commands), but modern usage is almost entirely declarative: a pyproject.toml with build-backend = "setuptools.build_meta" is enough for pip to hand off the entire build process. Under that interface, setuptools handles package discovery, C/C++ extension compilation via build_ext, entry-point and console-script generation, metadata normalization, and editable installs through PEP 660-compliant editable wheels.

Because nearly every non-trivial Python project either builds with setuptools directly or depends on a chain of tools that eventually call into it, its release cadence and correctness matter far beyond its own user base — a regression here can break installs across the ecosystem. The project vendors its own copies of packaging, wheel, importlib_metadata, and several other dependencies under setuptools/_vendor specifically to avoid circular bootstrap problems, since setuptools itself has to be installable before anything else can be.

What You Get

  • A PEP 517/518-compliant build backend (setuptools.build_meta) that pip and build invoke automatically from pyproject.toml
  • Automatic package and namespace-package discovery (find_packages, find_namespace_packages, PEP 420 support)
  • C/C++ extension module compilation through the build_ext command, with cross-platform compiler detection including MSVC on Windows
  • Console-script and entry-point generation, so a package’s CLI commands get installed as real executables
  • PEP 660 editable installs (pip install -e .) via generated editable wheels, replacing the old .egg-link mechanism
  • Legacy setup.py command support (sdist, bdist_wheel, develop, egg_info, etc.) for projects that haven’t migrated to declarative config

Common Use Cases

  • Declaring build-backend = "setuptools.build_meta" in pyproject.toml so pip install . and python -m build know how to package a project
  • Compiling and distributing Python packages that include C or C++ extension modules
  • Publishing a package to PyPI with automatically generated wheel and sdist artifacts from CI
  • Installing a local package in editable/development mode with pip install -e . while iterating on source code
  • Defining console-script entry points so a library also ships a command-line tool on install

Under The Hood

Architecture

The package is organized as a thin orchestration layer (setuptools/dist.py’s Distribution, setuptools/build_meta.py’s PEP 517 hooks) sitting on top of a vendored fork of the standard library’s distutils (setuptools/_distutils), with individual build steps implemented as Command subclasses under setuptools/command/ (build_ext, bdist_wheel, egg_info, editable_wheel, sdist, and others). build_meta.py is the actual entry point frontends like pip and build call — it translates PEP 517 hook calls (build_wheel, build_sdist, get_requires_for_build_wheel) into invocations of the legacy command objects, so both the modern declarative flow and the historical setup.py command-line flow ultimately converge on the same Distribution/Command machinery. Package and namespace discovery (discovery.py), editable-install generation (editable_wheel.py), and metadata handling (_core_metadata.py) are separated into focused modules rather than living inside the command classes, which keeps the core extensible even though the command-pattern surface area is large by necessity — this is the interface hundreds of thousands of downstream projects build against, so backward compatibility constrains most architectural changes.

Tech Stack

setuptools is pure Python (98%+ of the codebase) with a small C component (launcher.c) used to build Windows console/GUI launcher executables (cli.exe, gui.exe and ARM64 variants) for installed entry-point scripts. It declares zero runtime dependencies in pyproject.toml, instead vendoring everything it needs — packaging, wheel, more_itertools, jaraco.text, importlib_metadata, platformdirs, tomli, and others — under setuptools/_vendor, each pinned to an exact version with its own .dist-info. This vendoring exists specifically to break the bootstrap circularity of a packaging tool that needs a package manager to install itself. Testing infrastructure uses pytest with pytest-xdist for parallelism, virtualenv and jaraco.envs for isolated build fixtures, and ruff for linting; documentation is built with Sphinx and published to setuptools.pypa.io via ReadTheDocs.

Code Quality

The project has an extensive setuptools/tests/ directory (48+ test modules) covering build backends, editable installs, extension compilation, and legacy command behavior, run under pytest with --doctest-modules enabled so docstring examples are themselves executable tests, and warnings are promoted to errors in CI (filterwarnings = error in pytest.ini). Type checking is configured via both mypy.ini and pyrightconfig.json, though mypy strict is explicitly disabled — the codebase carries partial, opt-in typing rather than being fully strict-typed, which is typical for a project this old with this much legacy-compatibility surface. Linting is enforced through ruff.toml with an extended rule set, and multiple GitHub Actions workflows (main.yml, test-suite.yml, pyright.yml, plus a separate Sage-integration workflow) run on every change, giving the project strong automated coverage relative to its size and age.

What Makes It Unique

setuptools’ distinguishing trait isn’t novel packaging theory — it’s being the de facto reference implementation that PEP 517/518/660 were partly designed around, which means it has to support both the fully modern declarative pyproject.toml flow and decades of legacy setup.py behavior simultaneously without breaking either. Vendoring its own dependency tree to solve the packaging-tool bootstrap problem, shipping a full internal fork of the deprecated standard-library distutils, and maintaining Windows-native launcher executables for console scripts are all solutions to constraints that are largely unique to being packaging infrastructure at ecosystem scale rather than being technically groundbreaking on their own.

Used by 23 apps in this directory

TypeScript
91%
Apache 2.0

Helicone

AI Development · Analytics · Monitoring

6,211

An open-source AI gateway and LLM observability platform that routes requests to 100+ models while logging cost, latency, and full traces for every call.

View details
72
Repo Health
81
Technical
65
Dependency
Built with
TypeScript 91%
Updated 1 weeks ago
HTML
46%
LGPL-2.1

Horilla

ERP · Human Resources

1,453

Open-source HRMS covering recruitment, attendance, payroll, and biometrics in one self-hosted Django application.

View details
91
Repo Health
60
Technical
65
Dependency
Built with
HTML 46%
Python 38%
JavaScript 12%
Updated 1 weeks ago
TypeScript
39%
Apache 2.0

Label Studio

AI Development · Data Engineering

28,431

Label Studio is an open-source, multi-type data labeling platform that lets teams annotate images, text, audio, video, and time series data with a configurable XML-based UI and export annotations in formats ready for any ML framework.

View details
94
Repo Health
87
Technical
67
Dependency
Built with
TypeScript 39%
JavaScript 27%
Python 25%
Updated 1 weeks ago
Python
69%
MIT

Langflow

AI Agents · AI Development

155,451

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
65
Dependency
Built with
Python 69%
TypeScript 22%
Updated 1 weeks ago
Svelte
32%
GPL 3.0

Mathesar

Databases

5,148

Spreadsheet-like interface for your PostgreSQL database — self-hosted, no SQL required, native Postgres access control.

View details
70
Repo Health
80
Technical
71
Dependency
Built with
Svelte 32%
TypeScript 27%
Python 21%
Updated 1 weeks ago
C++
66%
Other

Memgraph

AI Development · Databases

4,606

High-performance in-memory graph database for AI context and real-time analytics

View details
90
Repo Health
79
Technical
66
Dependency
Built with
C++ 66%
Python 18%
Updated 1 weeks ago
TypeScript
93%
Other

OpenHands

AI Code Assistants · AI Development

90,429

The self-hosted developer control center for running AI coding agents — locally, in Docker, on VMs, or across cloud backends — with automation workflows for GitHub, Slack, and more.

View details
91
Repo Health
82
Technical
67
Dependency
Built with
TypeScript 93%
Updated 1 weeks ago
Python
74%
AGPL 3.0

OpenViking

AI Development · AI Memory · Databases

39,552

An open-source context database that gives AI agents a unified filesystem for memory, resources, and skills with hierarchical tiered retrieval.

View details
85
Repo Health
75
Technical
64
Dependency
Built with
Python 74%
Rust 12%
TypeScript 11%
Updated 1 weeks ago
Python
99%
Apache 2.0

Rasa Open Source

AI Assistants · AI Development · Voice AI

21,345

Rasa Open Source is a Python machine learning framework for building contextual, multi-turn chatbots and voice assistants that understand natural language and maintain conversation state.

View details
63
Repo Health
78
Technical
63
Dependency
Built with
Python 99%
Updated 3 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers