IronPython 2.7.3 is now available, and this is a quick look at some of the new features.

New Modules

Three new modules have been added: bz2, winsound, and _bisect.

The bz2 modules implements compression and decompression using the bzip2 algorithm; in particular, it allows (in conjunction with the already supported tarfile module) reading .tar.bz2 files. It is implemented in pure C# using code from the DotNetZip Library.

The winsound module gives access to the standard Windows sound functions, such as winsound.MessageBeep().

The _bisect is an accelerator module for the pure-Python bisect module that was already supported.

The _ast module was given a major upgrade to make it compatible with CPython 2.7. Finally, many other modules saw bugfixes small and large.

Loading zip packages from resources

IronPython 2.7.2 added the ability to load Python code from zip files; in 2.7.3 this has been extended to support zip files stored as resources. Because this only makes sense when hosting IronPython, it is not directly accessible from Python code. Instead, the hosting application has to add the resources, like so:

class Program
{
static void Main(string[] args)
{
var assembly = typeof (Program).Assembly;
const string resourceName = "python_27_lib.zip";
var importer = new IronPython.Modules.ResourceMetaPathImporter(assembly, resourceName);

var engine = IronPython.Hosting.Python.CreateEngine();
dynamic sys = IronPython.Hosting.Python.GetSysModule(engine);
sys.meta_path.append(importer);

var script = "import os" + Environment.NewLine + "os.name";
var result = engine.Execute(script);

Console.WriteLine("os.name: {0}", result);
Console.ReadKey();
}
}

Mobile Support


The support for Android has been improved slightly; IronPython apps can now be run on actual hardware. Writing them is a bit tricky because of limitations in Mono for Android, but hopefully that will be improved for IronPython 2.7.4


Windows Phone support has been dropped because there were serious issues with the current version, and WP7’s days are numbered. Instead focus will shift to WinRT (“Metro”) which will work in Windows 8 and Window Phone 8.


Other Improvements


The pyc.py compiler (in Tools\Scripts) gained the ability to use response files for large command lines. The syntax is the same as most other Microsoft tools, like csc.exe: pyc.py @response.txt.


Many other bugs have been fixed, improving the overall quality of the release in many different areas.


Thanks


Special thanks goes to Alex Earl, Keith Rome, and Pavel Jasinski for their contributions, and the countless people who submitted bug reports, and of course, all of the IronPython users.