Differences between revisions 39 and 42 (spanning 3 versions)
Revision 39 as of 2011-02-15 13:48:17
Size: 5144
Comment: Cleanup some old FUD (we don't recommend per-python-version binary packages), and add dh_pythonX
Revision 42 as of 2011-04-25 12:44:09
Size: 5419
Comment: Update stats
Deletions are marked like this. Additions are marked like this.
Line 42: Line 42:
See [[DebianMan:1/dh_python2|dh_python2(1)]] or [[DebianMan:1/dh_python3|dh_python3(1)]] for more details. Instructions for transitioning to dh_python2 from [[Python/PythonSupportToDHPython2|python-support]] and [[Python/PyCentral2DhPython2|python-central]].

See [[DebianMan:1/dh_python2|dh_python2(1)]] ([[http://alioth.debian.org/scm/loggerhead/pkg-python/python-defaults-debian/annotate/head:/dh_python2.rst|bzr HEAD]]) or [[DebianMan:1/dh_python3|dh_python3(1)]] for more details.
Line 62: Line 64:
Some statistics (the number of packages using each method), as of 15 Feb 2011: Some statistics (the number of packages using each method), as of 25 Apr 2011:
Line 65: Line 67:
70 125
Line 67: Line 69:
359 306
Line 69: Line 71:
44 19

Debian Python FAQ

This is the FAQ of the debian-python@l.d.o mailing list. It is of particular interest to members of the Debian Python Modules Team. Please also look at Python for introductory info.

1. What are the projects and documentation available ?

If you're interested in help packaging Python itself, there's pkg-python but if you want to help with the Python modules or packaging a new one, you should look at Debian Python Modules Team project. Both groups discuss its activities in the same debian-python@l.d.o mailing list.

1.1. python-modules

The Debian Python Modules Team has its own policy, but keep in mind that they follow Debian Python Policy and of course Debian Policy too.

2. Multiple python versions support

Debian supports several versions of Python simultaneously. Some packages include modules only for the default version, while others provide modules for all available. These are generally all provided within a single binary package, although in the past multiple packages were sometimes used.

The general trend is to reduce that diversity and provide modules for all Python versions available within Debian using the following guidelines.

2.1. Build dependencies

For compiled modules you need to depend on python-all-dev, and python-all-dbg. For Python-only modules the sole python-all is sufficient if they use Python-based build system (like the very used distutils). A helper such as dh_python2, python-support, or python-central, will automagically manage bytecompilation.

3. Note on bytecompilation for pure Python modules

As the helpers manage late-bytecompilation, no .pyc/.pyo files shall be shipped in your package. You do no need to spend build time for generating them. With distutils use the "--no-compile -O0" options; dh and the python CDBS classes know how to handle this. Beware some upstream sources that contain a setup.cfg which override your build options (see 360848), then you will have to patch it. In all cases, dh_python2 or python-support will remove those files if they are generated.

3.1. What are dh_python2 and dh_python3?

dh_python{2,3} are the python helpers included in the python package since 2.6.6-3.

dh_python2 differs from python-support, in including the per-python-version symlink farm within the binary package, only requiring byte-compilation at install time. Packages using dh_python2 with public modules must be rebuilt when Debian changes the supported Python versions (this should never happen after 2.7).

They can also guess dependencies from requires.txt, for setuptools/distutils packages.

Instructions for transitioning to dh_python2 from python-support and python-central.

See dh_python2(1) (bzr HEAD) or dh_python3(1) for more details.

3.2. What is python-support?

Python-support is a tool to handle byte-compilation of python modules when there are several python versions installed on the system.

See /usr/share/doc/python-support/README.gz or SVN README for up-to-date information.

3.3. What is python-central?

Package that contains some helper scripts for building and installing python modules independent of the current installed Python version.

Some information about python-central can be found here: http://python-modules.alioth.debian.org/python-central_howto.txt

3.4. Should I use dh_pythonX, python-support or python-central?

dh_python2 is recommended for new Python 2 packages. dh_python3 is the only helper for Python3.

Some statistics (the number of packages using each method), as of 25 Apr 2011:

~/python-modules$ egrep -m1 '(dh .*--with.*|dh_)python[23]' packages/*/trunk/debian/rules | wc -l
~/python-modules$ grep -m1 python-support packages/*/trunk/debian/control | wc -l
~/python-modules$ grep -m1 python-central packages/*/trunk/debian/control | wc -l

4. Python eggs

4.1. What are Python eggs?


4.2. How should we package Python eggs?

We don't want to provide ".egg" files within the .deb. However we want to make the "egg meta-information" available so that users can use eggs if they so wish. Python >= 2.5 does that by default in distutils. For setuptools based setup.py you need to pass the option "--single-version-externally-managed" to the "setup.py install" call.

Packages relying on CDBS and setuptools can do that this way:

# Install egg-info directories
DEB_PYTHON_INSTALL_ARGS_ALL += --single-version-externally-managed