Wednesday, August 27, 2008

Ironclad 0.5 Released - Use numpy from IronPython

Ironclad is an Open Source project created by Resolver Systems to allow you to use Python C extensions from IronPython. It is basically a reimplementation of the Python C API in C#.

William Reade, the main developer of Ironclad, has just announced the release of version 0.5.
The exciting thing is that with the latest release (and commenting out a single line in numpy) you can now import numpy from Ironpython and create and use integer arrays!

There is still a lot of work to do, but this is great progress.

From the announcement:

Our original goal for 0.5 was to import numpy, from IronPython, and do something with it. With one monstrous caveat, we have reached that goal; the problem is that you need to comment out line 532 of before it'll import. That line reads "_unicodesize = array('u','U1').itemsize", and fails trying to construct a unicode array; however, since _unicodesize appears to be unreferenced, we feel reasonably comfortable ignoring it for now.

Once numpy is imported, you can create integer arrays and do a few things with them; of course, the number of things you can do is still dwarfed by the number of things you can't do. You can add, subtract and multiply integer arrays, and raise them to integer powers... and that's about it.

We will continue to work on numpy; immediate goals include getting floating-point arrays to print out as numbers instead of NaNs, hooking up the many missing PyTypeObject fields, and implementing more API functions as we encounter them. I don't have a very clear goal in mind for v0.6 as yet; making floating-point arrays work properly is obviously critical, but further steps are not yet clear. If anyone is particularly keen to start using numpy with IronPython, please get in touch; I'm keen to know what you want to do with it, so I can focus on features I know are valuable :).

Ironclad targets IronPython 2 and although the underlying techniques should be cross-platform it currently only builds on Windows. Mono / Linux hackers welcomed!

UPDATE: It turns out that _unicodesize is no longer used, and in response to us asking what it is for it has now been removed...

No comments:

Post a Comment

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