Sunday, March 21, 2010

Catching up with Jeff Hardy and Django on IronPython

Jeff Hardy is an IronPython MVP and a Python community member who has invested a lot of time in getting standard Python libraries available for IronPython. Some of his recent work has been with both Django and the zlib module. It's been a while since we've reported on his work, so this post gets us up to date with what Jeff has been working on:

The zlib module is a C extension for Python. Because it is in the Python standard library it is used by many other libraries, like setuptools, making it an important part of the Python infrastructure. Unfortunately not all of the standard library C extensions have been ported to IronPython. The problem of C extensions is one of the major drawbacks of alternative implementations of Python; both Jython and PyPy have the same problem. Even if your code is 'pure-Python' it may not run on alternative implementations if it uses C extensions.

For IronPython one solution is to use Ironclad, an open source project created by Resolver Systems that allows you to use Python C extensions with IronPython. A better solution is for 'someone' to port the C extension to IronPython; and in the case of zlib that someone is Jeff Hardy. The latest version of IronPython.Zlib targets the IronPython 2.6 release.
One of the most popular Python frameworks these days is Django, the Python web framework. Unfortunately this doesn't run out-of-the-box on IronPython, largely because of differences in the way that IronPython handles Unicode (all strings are Unicode by default). There are some important changes in IronPython 2.6.1, due to be released shortly, that should fix a lot of the issues.

Jeff has been working on a 'port' of Django to IronPython; basically getting the tests running and applying patches where necessary. He has also written up some instructions on getting the test suite to run:
This guide will explain how to setup and attempt to run the Django test suite on IronPython. Once the test suite runs, it should be much easier to fill in the parts of Django that don't work properly.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.