Differences between revisions 2 and 16 (spanning 14 versions)
Revision 2 as of 2006-07-06 07:39:34
Size: 1639
Editor: ?PeterFunk
Comment: I've tried to elaborate this a little more.
Revision 16 as of 2009-09-16 09:07:56
Size: 3210
Editor: ?techtonik
Comment: imperfection of Python policy makes it hard to maintain packages
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
Software written in the Python programming language is usually compiled into platform independent
bytecode files. This is similar to Java. The so-called C-Python interpreter is a software
package containing both the compiler and the bytecode interpreter used to execute Python bytecode
files. Unfortunately precompiled bytecode files are incompatible from Python version to
Python version. Precompiled Python bytecode files distributed in Debian packages must
therefore match one of the available Python interpreter versions available on a certain
Debian system. Within the Debian project the Python compiler/interpreter package is maintained by a developers team known as [http://alioth.debian.org/projects/pkg-python pkg-python]. There are many Python modules and extensions maintained by individual developers and by a coordinated group called [http://python-modules.alioth.debian.org Debian Python Modules Team]. The Debian project contains many other applications written in Python.
Software written in the Python programming language is executed by Python interpreter and is usually
compiled into platform independent bytecode files to increase performance. Thus software that written
in pure Python can be distributed as source code or as compiled bytecode. The latter is similar to
Java. Unfortunately, compiled bytecode files are incompatible from Python version to Python version.
Certain Debian system may have several Python versions available, so to avoid distributing several
packages for each version, Debian Policy makes sure that Python code is distributed in clear form
and compiled only during installation process on target system. Python is able to compile and write
bytecode *.pyc files alongside with *.py sources when *.py is executed, but insufficient permissions
may not allow it to write in corresponding directories, so to avoid drop-down in performance
compiling is done during installation.
Line 11: Line 14:
== Status == The so-called C-Python interpreter is a software
package containing both the compiler and the bytecode interpreter used to execute Python files.
Within the Debian project the Python compiler/interpreter package is maintained by a developers team known as [[http://alioth.debian.org/projects/pkg-python|pkg-python]]. Python modules and extensions are maintained by individual developers and by a coordinated group called [[Teams/PythonModulesTeam|Debian Python Modules Team]]. There are also Python applications that are maintained by a separate [[Teams/PythonAppsPackagingTeam|Python Applications Packaging Team]].
Line 13: Line 18:
Debian latest release Sarge contains multiple Python versions: 2.1, 2.2, 2.3, 2.4. Unfortunately not all the modules, extensions and applications supports every version and support four different Python versions simultaneously with a good quality isn't so easy. == Supported Python Versions ==
Line 15: Line 20:
We're working right now in a better infrastructure for transitions between versions and hopefully we will just include Python 2.4 in our next release to turn the support easier. Actually Debian Unstable (also known as sid) contains Python 2.3 (as default) and Python 2.4 only. Debian's latest release Lenny contains multiple Python versions: 2.5 (the default) and 2.4.
Line 17: Line 22:
== Python Policy == == Debian Python Policy for Python developers ==
Line 19: Line 24:
See DebianPython/NewPolicy Text of 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/ but as a matter of fact many find it outdated and incomplete, so feel free to ask any questions on debian-python@l.d.o mailing list and contribute to DebianPython/Tutorial.

The text of current official policy can be summarized as follows:
 * Debian installation may have multiple Python versions
 * Modules should be installed to /usr/lib/pythonX.Y/site-packages
 * Bytecompilation should occur in post installation step (postinst), bytecompiled files should be removed in prerm
 * /etc/python/debian_config has option to control byte compilation
 * ...

=== Current Policy shortcomings ===
Even though DebianPython/NewPolicy is called New, it is still doesn't reflect the real state of affairs in Python packaging.
 * (ambiguous) It does it's best to explain what should be done, it fails to guide people how it should be done.
 * (obscure) It doesn't explain the reasons behind some of the rules.
 * (complicated) It requires that Python developers should be familiar with Debian tools.
 
That's why the state of support of Python packages in Debian is not super and a separate DebianPython/Tutorial is really needed.

== See also ==

 * [[DebianPythonFAQ]]
 * [[DebianPythonTODO]]
 * DebianPython/ListOfPackages

Python in Debian

Software written in the Python programming language is executed by Python interpreter and is usually compiled into platform independent bytecode files to increase performance. Thus software that written in pure Python can be distributed as source code or as compiled bytecode. The latter is similar to Java. Unfortunately, compiled bytecode files are incompatible from Python version to Python version. Certain Debian system may have several Python versions available, so to avoid distributing several packages for each version, Debian Policy makes sure that Python code is distributed in clear form and compiled only during installation process on target system. Python is able to compile and write bytecode *.pyc files alongside with *.py sources when *.py is executed, but insufficient permissions may not allow it to write in corresponding directories, so to avoid drop-down in performance compiling is done during installation.

The so-called C-Python interpreter is a software package containing both the compiler and the bytecode interpreter used to execute Python files. Within the Debian project the Python compiler/interpreter package is maintained by a developers team known as pkg-python. Python modules and extensions are maintained by individual developers and by a coordinated group called Debian Python Modules Team. There are also Python applications that are maintained by a separate Python Applications Packaging Team.

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

Text of 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/ but as a matter of fact many find it outdated and incomplete, so feel free to ask any questions on debian-python@l.d.o mailing list and contribute to DebianPython/Tutorial.

The text of current official policy can be summarized as follows:

  • Debian installation may have multiple Python versions
  • Modules should be installed to /usr/lib/pythonX.Y/site-packages
  • Bytecompilation should occur in post installation step (postinst), bytecompiled files should be removed in prerm
  • /etc/python/debian_config has option to control byte compilation
  • ...

Current Policy shortcomings

Even though DebianPython/NewPolicy is called New, it is still doesn't reflect the real state of affairs in Python packaging.

  • (ambiguous) It does it's best to explain what should be done, it fails to guide people how it should be done.
  • (obscure) It doesn't explain the reasons behind some of the rules.
  • (complicated) It requires that Python developers should be familiar with Debian tools.

That's why the state of support of Python packages in Debian is not super and a separate DebianPython/Tutorial is really needed.

See also