[MapProxy] Python 3 support for MapProxy

Oliver Tonnhofer olt at omniscale.de
Fri Nov 29 03:10:33 PST 2013

Hi everyone,

last weekend was the German FOSSGIS Hacking Event 2013 at the Linux hotel in Essen, which was sponsored by the local OSGeo chapter (FOSSGIS). I used my time there to start porting MapProxy to Python 3.

Some background:
As you might know, Python 3 is incompatible with with Python 2 (packages where restructured, unicode handling was unified, plus a few cosmetic changes) and all applications and libraries need updates. Python 3.0 was released 5 years ago but the initial adoption was slow. This changed and the last libraries MapProxy depends on where ported to Python 3 in the last month. More and more systems will now/soon come with Python 3 by default. Ubuntu 14.04 for example will default to Python 3.3, 2.7 will still be available as a package though. So the time was ripe for MapProxy to support Python 3.

A few thousand changed lines later: Tada!
MapProxy does now support the latest Python 3 version (3.3) and also Python 2.6 and 2.7, all from the same code base.
Python 2.6 already contained features to make porting to 3 easier, that's why 2.5 support is dropped. 3.3 added a changes that makes supporting 2 and 3 from the same code base easier, that's why 3.0-3.2 were skipped. 

The code is in the py3 branch and all tests pass now:

I bet there are still some small bugs hidden in there, especially with the mapproxy-utils and different system encodings.
Please report any bug you encounter (together with the complete traceback, etc.).

You can download the latest py3-branch as a package from GitHub: https://github.com/mapproxy/mapproxy/archive/py3.zip

Installing with pip or easy_install:
  pip install https://github.com/mapproxy/mapproxy/archive/py3.zip
  easy_install https://github.com/mapproxy/mapproxy/archive/py3.zip

Python 3 support was planned for the MapProxy 2.0 release somewhere in the next year, together with some backwards incompatible changes in the MapProxy configuration and refactoring. But since there is still a long way to MapProxy 2.0, I'm thinking of releasing the Python 3 changes in MapProxy 1.7. This allows to concentrate on the MapProxy changes for 2.0 and removes the burden to deal with porting bug fixes between the old Python 2 and the new Python 2/3 code.
On the downside it means that MapProxy 1.7 will not support Python 2.5 anymore (which was replaced by 2.6 five years ago).   I can live with that, but please speak up if you have valid concerns about this change.


Oliver Tonnhofer    | Omniscale GmbH & Co KG    | http://omniscale.com
http://mapproxy.org | https://github.com/olt    | @oltonn

More information about the MapProxy mailing list