[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ A ] [ B ] [ C ] [ next ]


Debian Python Policy
Chapter 1 - Python Packaging


1.1 Versions

At any given time, the package python will represent the current default Debian Python version.

The default Debian Python version should alway be the latest stable upstream release that can be integrated in the distribution.

Apart from the default version, legacy versions of Python or beta versions of future releases may be included as well in the distribution, as long as they are needed by other packages, or as long as it seems reasonable to provide them. (Note: For the scope of this document, Python versions are synonymous to feature releases, i.e. Python 2.0 and 2.0.1 are subminor versions of the same Python version 2.0, but Python 2.1 and 2.2 are indeed different versions.)

For any version, the main package must be called pythonX.Y.

The set of currently supported python versions can be found in /usr/share/python/debian_defaults.


1.2 Main package

For every Python version provided in the distribution, the package pythonX.Y shall comprise a complete distribution for deployment of Python scripts and applications. The package includes the binary /usr/bin/pythonX.Y and all modules of the upstream Python distribution.

Excluded are any modules that depend on non-required packages, they will be provided in separate packages. Some tools and files for the development of Python modules are split off in a separate package pythonX.Y-dev. Documentation will be provided separately as well.

At any time, the python package must contain a symlink /usr/bin/python to the the appropriate binary /usr/bin/pythonX.Y. The python package must also depend on the appropriate pythonX.Y to ensure this binary is installed. The version of the python package must be greater than or equal to X.Y and smaller than X.Y+1.


1.3 Python Interpreter


1.3.1 Interpreter Name

Python scripts depending on the default Python version (see Main package, Section 1.2) or not depending on a specific Python version should use python (unversioned) as the interpreter name.

Python scripts that only work with a specific Python version must explicitly use the versioned interpreter name (pythonX.Y).


1.3.2 Interpreter Location

The preferred specification for the Python interpreter is /usr/bin/python or /usr/bin/pythonX.Y. This ensures that a Debian installation of python is used and all dependencies on additional python modules are met.

If a maintainer would like to provide the user with the possibility to override the Debian Python interpreter, he may want to use /usr/bin/env python or /usr/bin/env pythonX.Y. However this is not advisable as it bypasses Debian's dependency checking and makes the package vulnerable to incomplete local installations of python.


1.4 Module Path

The module search path for Debian has been amended to include a directory tree in /usr/local at the beginning of the path. By default, sys.path is searched in the following order:

     /usr/lib/pythonXY.zip
     /usr/lib/pythonX.Y
     /usr/lib/pythonX.Y/plat-linux2
     /usr/lib/pythonX.Y/lib-tk
     /usr/lib/pythonX.Y/lib-dynload
     /usr/local/lib/pythonX.Y/site-packages
     /usr/lib/pythonX.Y/site-packages
     /var/lib/python-support/pythonX.Y
     /usr/lib/pythonX.Y/site-packages/module-dir
     /usr/lib/site-python

The use of the /usr/lib/site-python directory is deprecated. The directory may be dropped from the path in a future version. The /usr/lib/pythonXY.zip archive appeared in python2.3; it is not currently used in Debian. Modules should not install directly to the /var/lib/python-support directory; it is for use by python-support, Section B.1.


1.5 Documentation

Python documentation is split out in separate packages pythonX.Y-doc. The package python-doc will always provide the documentation for the default Debian Python version.

TODO: Policy for documentation of third party packages.


[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ A ] [ B ] [ C ] [ next ]


Debian Python Policy

version 0.4.1.0

Neil Schemenauer nas@debian.org
Matthias Klose doko@debian.org
Gregor Hoffleit flight@debian.org
Josselin Mouette joss@debian.org
Joe Wreschnig piman@debian.org