PyMaemo/Python 2.6 porting guide

(New page: == Python 2.6 Porting Guide == <b style="color: red">Important: this document is still a draft. There are currently no planned dates for migration to 2.6, but it will be informed in advan...)
Line 2: Line 2:
<b style="color: red">Important: this document is still a draft. There are currently no planned dates for migration to 2.6, but it will be informed in advance on the maemo-developers and pymaemo-developers mailing lists, so that developers have some time to fix their packages.</b>
<b style="color: red">Important: this document is still a draft. There are currently no planned dates for migration to 2.6, but it will be informed in advance on the maemo-developers and pymaemo-developers mailing lists, so that developers have some time to fix their packages.</b>
 +
 +
This documents contains some general guidelines about how to port your Python application currently being used with Python 2.5 for working without problems with Python 2.6.
 +
 +
=== Introduction ===
 +
 +
Currently, Maemo 4.x (Diablo) has Python 2.5. Maemo 5 Beta (Fremantle) also has 2.5, but we are evaluating upgrading Fremantle to 2.6, so that developers can use the latest features, while keeping compatibility with Python 2.5. See the [http://docs.python.org/whatsnew/2.6.html What’s New in Python 2.6] page for details.
 +
 +
This also means that we have no plans to migrate to Python 3.x in Fremantle. Using Python 2.6 is the best option because developers can use most 3.x features without breaking compatibility with Python 2.5.
 +
 +
One question might arise: why not have both 2.6 and 3.x, or even 2.5, 2.6 and 3.x? We have thought about this, the problem is, in the current mechanism used in Debian and Ubuntu (that we also use), the packages that install Python extensions need to be compiled for all supported versions, and all these versions are installed <b>in a single package</b>. This means that some packages will simply double or triple their size even if only one version is installed.
 +
 +
Besides, if we have two or three versions available in the repository, there is a possibility that some packages depend on e.g. 2.5 while others depend 3.x. So the user would need to have <b>both</b> versions installed in some cases.
 +
 +
For small devices as the Internet Tablets, saving space is also a high priority, so we decided to support a single version during the life cycle of the distribution.
 +
 +
<b>FINISH ME</b>
 +
 +
- Any paths that have "python2.5" or "site-packages" will have to be changed to "python2.6" and "dist-packages", as these are the ones used on Python 2.6. An alternative is to make these paths more generic.
 +
- If you use distutils for building your package, you must pass the --install-layout=deb flag for "setup.py install" in order to install to the proper locations.
 +
- If your application uses "python2.5" as one of its dependencies on the Depends field, you must change it for "python2.6" or, preferably, python (>= 2.5). Also, this would be a good time for your package to use dependencies that follow the new Debian Python Policy, if that's the case - the Policy states that Python packages must not have a fixed version number on its name (e.g. prefer python-xml instead of python2.6-xml).

Revision as of 20:49, 18 June 2009

Python 2.6 Porting Guide

Important: this document is still a draft. There are currently no planned dates for migration to 2.6, but it will be informed in advance on the maemo-developers and pymaemo-developers mailing lists, so that developers have some time to fix their packages.

This documents contains some general guidelines about how to port your Python application currently being used with Python 2.5 for working without problems with Python 2.6.

Introduction

Currently, Maemo 4.x (Diablo) has Python 2.5. Maemo 5 Beta (Fremantle) also has 2.5, but we are evaluating upgrading Fremantle to 2.6, so that developers can use the latest features, while keeping compatibility with Python 2.5. See the What’s New in Python 2.6 page for details.

This also means that we have no plans to migrate to Python 3.x in Fremantle. Using Python 2.6 is the best option because developers can use most 3.x features without breaking compatibility with Python 2.5.

One question might arise: why not have both 2.6 and 3.x, or even 2.5, 2.6 and 3.x? We have thought about this, the problem is, in the current mechanism used in Debian and Ubuntu (that we also use), the packages that install Python extensions need to be compiled for all supported versions, and all these versions are installed in a single package. This means that some packages will simply double or triple their size even if only one version is installed.

Besides, if we have two or three versions available in the repository, there is a possibility that some packages depend on e.g. 2.5 while others depend 3.x. So the user would need to have both versions installed in some cases.

For small devices as the Internet Tablets, saving space is also a high priority, so we decided to support a single version during the life cycle of the distribution.

FINISH ME

- Any paths that have "python2.5" or "site-packages" will have to be changed to "python2.6" and "dist-packages", as these are the ones used on Python 2.6. An alternative is to make these paths more generic.

- If you use distutils for building your package, you must pass the --install-layout=deb flag for "setup.py install" in order to install to the proper locations.
- If your application uses "python2.5" as one of its dependencies on the Depends field, you must change it for "python2.6" or, preferably, python (>= 2.5). Also, this would be a good time for your package to use dependencies that follow the new Debian Python Policy, if that's the case - the Policy states that Python packages must not have a fixed version number on its name (e.g. prefer python-xml instead of python2.6-xml).