Appendix B. Packaging Tools
Prev |  | Next

# Appendix B. Packaging Tools

This section describes the various tools to help package Python programs and modules for Debian. Although none of these tools are mandatory, their use is strongly encouraged, as the above policy has been designed with them in mind (and vice versa). This appendix is just an overview. If you use these tools, you should read their full documentation.

## B.1. distutils

The standard Python `distutils` module has been modified in Debian to change the default installation directory of public Python modules and to add a new flag to the `install` command to override the default, `--install-layout=`.

Public Python modules installed with a modified distutils default to `/usr/local/lib/python`X`.`Y`/dist-packages` for Python 2.6 and later. This directory is seen by the system-provided Python 2.6.

When using a local Python installation, the default is `/usr/local/lib/python`X`.`Y`/site-packages` which is only seen by the local Python installation.

Using the `--install-layout=deb` flag to the `install` command of `setup.py` with a system-provided Python 2.6 or later versions, Python modules will be installed to `/usr/lib/python`X`.`Y`/dist-packages` which is only seen by the system-provided Python, not by a local installation.

## B.2. setuptools

The related Python `setuptools` module has been modified in Debian along the same lines as `distutils`.

Upstream focus on developments and improvements for Python packaging tools has largely shifted away from `distutils` and to `setuptools`. They offer a similar API and at some point in the future, `setuptools` may fully replace `distutils` in Debian package builds.

## B.3. `dh-python`

`dh-python` provides extensions for `debhelper` to make it easier to package Python modules and extensions. They calculate Python dependencies, add maintainer scripts to byte compile files, etc. Their use is not mandatory, but they are recommended by the Debian Python maintainers.

See `man dh_python3` or `man dh_python2` for details.

## B.4. pybuild

Pybuild is a Debian Python specific build system that invokes various build systems for requested Python versions in order to build modules and extensions. It supports automatically building for multiple Python versions.

## B.5. CDBS

The CDBS `python-distutils.mk` class helps packaging of distutils based Python packages.

## B.6. `python-support` (removed)

`python-support` provided another way to manage Python modules. It has been removed from Debian Stretch and later releases.

## B.7. `python-central` (removed)

`python-central` provided another way to manage Python modules. It has been removed from Debian Jessie and later releases.

Prev |  | Next
Appendix A. Build Dependencies | Home | Appendix C. Upgrade Procedure