# What is a Python package?

A Python package is code designed to be imported by other Python programs, bundled with metadata so it can be discovered, installed, and version-managed by tools like [pip](https://pydevtools.com/handbook/reference/pip.md) or [uv](https://pydevtools.com/handbook/reference/uv.md).

This is different from a [Python application](https://pydevtools.com/handbook/explanation/what-is-a-python-application.md), which is a program end users run directly. [Django](https://www.djangoproject.com/) is a package; a Django-powered website is an application. [Requests](https://requests.readthedocs.io/) is a package; a script that calls `requests.get()` is an application.

## What format does a Python package come in?

Python packages reach users in two standard formats on [PyPI](https://pydevtools.com/handbook/explanation/what-is-pypi.md):

- **[Wheels](https://pydevtools.com/handbook/reference/wheel.md)** (`.whl`): pre-built binary distributions. pip and uv install them by copying files into place with no build step, making installation fast even on machines without a compiler.
- **[Source distributions (sdists)](https://pydevtools.com/handbook/reference/sdist.md)** (`.tar.gz`): raw source code. Installing from an sdist requires running the [build backend](https://pydevtools.com/handbook/explanation/what-is-a-build-backend.md) to produce an installable artifact.

Most packages on PyPI publish both. The wheel installs fast on supported platforms; the sdist provides a fallback for platforms with no matching wheel.

[Conda packages](https://pydevtools.com/handbook/reference/conda-package.md) are a third format used in the [conda](https://pydevtools.com/handbook/reference/conda.md) ecosystem. Unlike wheels and sdists, conda packages can include non-Python components such as native libraries.

## Does a Python package need compilation?

A package that contains only `.py` files is platform-independent: one wheel tagged `py3-none-any` installs on any platform and Python 3 version.

A package with extensions written in C, C++, Cython, or Rust requires compilation. The resulting wheel is tied to a specific platform and Python version (e.g., `cp312-manylinux_2_17_x86_64`). For these packages, maintainers typically build wheels for multiple targets in CI using [cibuildwheel](https://pydevtools.com/handbook/reference/cibuildwheel.md) and upload all of them to PyPI.

## What tools build and install packages?

Three categories of tools turn source code into an installable package:

- A **[build backend](https://pydevtools.com/handbook/explanation/what-is-a-build-backend.md)** ([setuptools](https://pydevtools.com/handbook/reference/setuptools.md), [hatchling](https://pydevtools.com/handbook/reference/hatch.md), [flit](https://pydevtools.com/handbook/reference/flit.md)) produces the wheel or sdist from source code.
- A **[build frontend](https://pydevtools.com/handbook/explanation/what-is-a-build-frontend.md)** ([uv](https://pydevtools.com/handbook/reference/uv.md), [build](https://pydevtools.com/handbook/reference/build.md)) coordinates the process, sets up an isolated build environment, and invokes the backend.
- A **package manager** ([uv](https://pydevtools.com/handbook/reference/uv.md), [pip](https://pydevtools.com/handbook/reference/pip.md)) resolves and installs dependencies into [virtual environments](https://pydevtools.com/handbook/explanation/what-is-a-virtual-environment.md).

## Learn More

- [What is a Python application?](https://pydevtools.com/handbook/explanation/what-is-a-python-application.md) explains the related concept and why the distinction matters for tooling
- [What is a wheel?](https://pydevtools.com/handbook/reference/wheel.md) covers the binary distribution format in detail
- [What is a build backend?](https://pydevtools.com/handbook/explanation/what-is-a-build-backend.md) explains setuptools, hatchling, and the alternatives
- [Build and publish a Python package](https://pydevtools.com/handbook/tutorial/build-and-publish-a-python-package.md) is a hands-on tutorial that walks through the full process
