Code Quality & Packaging

setuptools

The old, dependable machinery quietly running underneath almost every pip install you've ever typed.

Install it: pip install setuptools

What does it do?

Setuptools is the foundational tool that packages Python code into a distributable form and defines how it gets built and installed, including projects that mix in faster, lower-level languages like C or C++. Think of it as the industrial packing and shipping department behind an online store: customers just click buy, but a whole system of boxing, labeling, and routing happens invisibly before the product arrives. When a developer runs pip install, setuptools is very often the machinery working behind the scenes to interpret the project’s packaging instructions and assemble the actual installable files. It’s been part of the Python ecosystem for so long that a huge share of existing Python packages still depend on it directly.

See it in action

This is a setup.py file that describes a Python project’s name, version, and requirements so it can be packaged and installed by others.

from setuptools import setup, find_packages

setup(
    name="my-package",
    version="0.1.0",
    packages=find_packages(),
    install_requires=["requests"],
)

Why would a non-developer care?

Nearly every piece of Python software you benefit from indirectly, from web frameworks to data science tools, got onto someone’s computer through a packaging system, and setuptools has quietly been one of the most common ones handling that step for two decades.

Real-world examples

Setuptools predates most modern Python packaging tools, evolving out of an even older tool called distutils, and it remains one of the default build backends recommended for Python packages to this day. Removing it would break the installation process for a substantial portion of existing Python software still configured to use it.

Who uses it

Python package authors defining how their code should be built and distributed, especially projects that include compiled components in other languages.

How it compares to alternatives

It’s the long-standing default compared to newer, more specialized build backends like Poetry’s own or Hatchling; those newer options often aim for simpler configuration, while setuptools remains the most broadly compatible choice for complex packaging needs like C extensions.

New to Python and want to actually try libraries like this yourself?

Find a beginner-friendly course

Related libraries