Differences between revisions 18 and 19
Revision 18 as of 2010-07-23 21:28:33
Size: 4819
Comment:
Revision 19 as of 2010-07-23 21:44:59
Size: 4787
Comment: link to DebianPython/Namespaces removed
Deletions are marked like this. Additions are marked like this.
Line 65: Line 65:
 * [[DebianPython/Namespaces]]

Français

Introduction

Python, the high-level, interactive object oriented language, includes an extensive class library with lots of goodies for network programming, system administration, sounds and graphics. Debian always provides at least two versions of Python, the latest stable Python 2 release, and the latest stable Python 3 release. It may also provide additional versions, as well as tons of third party packages. Python is an important part of the Debian ecosystem, and it is very easy to learn. See the online tutorial if you want to get started programming in Python. You might also be interested in the Python wiki, the Python FAQ, and the online documentation.

Software written in the Python programming language is executed by the Python interpreter. It is usually compiled into platform independent bytecode files to increase performance. Python compiles and writes bytecode *.pyc files alongside the *.py sources. Extension modules can also be written in C, which are distributed as .so shared libraries.

Therefore software written in pure Python can be distributed as source code or as compiled bytecode. The latter is similar to Java.

Python in Debian

Within the Debian project Python packages are maintained by individual developers and three main teams :

There are also :

Supported Python Versions

Debian's latest release Lenny contains multiple Python versions: 2.5 (the default) and 2.4.

Debian Python Policy for Python developers

The Debian Python Policy describes conventions for packaging and distributing Python code in Debian.

The official text is located at http://www.debian.org/doc/packaging-manuals/python-policy/.

Feel free to ask any questions on debian-python@list.debian.org mailing list.

if you want to maintain a Python package, you have to know how the Debian Development works.

Deviations from upstream

Debian distributions modify upstream Python in a few ways that are important to understand. Of course, where at all possible, we try to minimize deviations from upstream, but here is an enumeration of the changes you might encounter on a Debian system (and derivatives, such as Ubuntu).

  • dist-packages instead of site-packages. Third party Python software installed from Debian packages goes into dist-packages, not site-packages. This is to reduce conflict between the system Python, and any from-source Python build you might install manually.

  • The python-setuptools package installs the Distribute fork instead of the standard setuptools.

  • The python-virtualenv also uses distribute by default, but can enable classic setuptools with an optional switch.

  • distutils setup scripts install files in /usr/local/ not sys.prefix (which is normally /usr/). This is because /usr/ is reserved for files installed from Debian packages. Note that /usr/local/lib/pythonX.Y/dist-packages is in sys.path so that modules not installed from Debian packages can still be accessed by the system Python. Tools like debhelper pass the --install-layout=deb option to the setup script while building a Debian package so that its installs files into /usr/ not /usr/local/.

Current regretful practices

  • -dbg packages are not commonly built/packaged for modules with extensions. GDB gets constantly improving allowing to easier debugging of Python modules, and extensions built using python*-dbg libraries are necessary to take advantage.

See also