Python Programming, news on the Voidspace Python Projects and all things techie.

Mozilla and IronPython: IronMonkey

Mozilla have finally announced their new project that I blogged cryptically about a few months ago.

The new project is called IronMonkey and has just been announced by Brendan Eich (Chief Architect of the Mozilla project) along with two other equally wonderfully named projects:

Action Monkey

Screaming Monkey

All three projects are based around integrating the Tamarin Virtual Machine into Mozilla (principally Firefox). Tamarin will become the heart of SpiderMonkey which is the JavaScript engine embedded in Firefox. ActionMonkey is the integration project and headed by Jason Orendorff who is a noted Pythonista (particularly for his excellent path module which nearly made it into the Python standard library).

ScreamingMonkey has another famous Pythonista at the helm, Mark Hammond. The project aims to 'to add script-engine integration glue' to Tamarin. It will bring a JS2 implementation to IE .

Seo Sanghyeon has taken the job of lead developer on IronMonkey. The goal of this project is to get the DLR (Microsoft's Dynamic Language Runtime) and its target languages (IronPython and IronRuby) running on Tamarin. This will be a lot of work - including changes to Tamarin (perhaps implementing DynamicMethod in C++).

I believe the approach they are taking is to convert .NET bytecode to Tamarin byte-code rather than cross-compiling C#. You will have to ask Seo though, this is all lower level than I usually go.

The end result is that Firefox should be 'natively' scriptable with IronPython and IronRuby, and possibly that you will be able to create applications on the Mozilla platform with these languages instead ofJavaScript.

This is great news, but it still vapourware - this is just the announcement of the project start. If anyone can do it though, Seo can!

It is also interesting to note that Mozilla have enough faith in Microsoft's Open Source license to attempt this.

Oh and on a vaguely related note, there is a new 'community' site dedicated to IronRuby: RubyDoes.NET.

TDD at PyCon UK

Jonathan has been announced!

My esteemed colleague will be giving a talk at PyCon UK. From the announcement:

Jonathan Hartley of Resolver is giving a talk on Test Driven Development, an illustration of how to perform test-driven development for those who have not done it before. Jonathan thinks that TDD could be the closest thing to Brooks' silver bullet that software engineering will ever find. The presentation will focus on how to start a new project using TDD, and specifically on what techniques and libraries are available to Python programmers.

It should be good.

Welcome to Kamil

Welcome to the second of our interns for the summer, Kamil Dworakowski.

He is a student from Poland, and has almost completed his masters in computer science with the University of Wroclav. He is also a contributor to the Nemerle programming language.

From the Nemerle website:

Nemerle is a high-level statically-typed programming language for the .NET platform. It offers functional, object-oriented and imperative features. It has a simple C#-like syntax and a powerful meta-programming system.

Nemerle has a great macro system, so we are hoping that he will teach it to us over the summer.

Dynamically Compiling C# from IronPython

IronPython is a great way to use the .NET framework. It comes packed full of Python dynamic goodness. Unfortunately it isn't perfect. One noteworthy hole in the IronPython .NET integration is attributes. You can't use attributes in IronPython, which can sometime be a problem.

The normal way round this problem is to create stub C# classes with methods that you can override in IronPython. This doesn't always work though; sometimes you want to dynamically specify the arguments to the attributes - which can only be done at compile time with C#.

This article explores a way round the problem, with a solution that potentially has many other uses. It provides a way to dynamically compile C# source code into assemblies. These assemblies can be used in memory or saved to disk.

This means that C# code can be generated and compiled dynamically from IronPython, and the assemblies saved to disk or used directly within the same application.

IronPython to Accept User Contributions

Up until now Microsoft have been unwilling / unable to accept user contributions to the IronPython project. This has been a source of frustration for the IronPython community because the FePy Project has often fixed bugs - fixes that have not been able to make their way back upstream.

Since John Lam announced that IronRuby would be accepting user contributions the obvious question was - would the same apply to the IronPython project?

Jim Hugunin has just answered this question on the IronPython mailing list with an enthusiastic yes.

There are caveats, but the long term prognosis is good.

In the longer term, we will establish a more official structure so that the community can contribute to more of the IronPython project and so that our "official" releases will include these contributions. Right now, our fairly small team is still focused on working out the details for our new IronRuby release. While we're doing this, we don't want to make any changes to disrupt the IronPython project that has been running successfully for over two years. After the IronRuby sources do in fact go up on Rubyforge, we'll be able to devote the time to talk with folks both within MS and within the Python community to work out the best next step for IronPython to increase our support for community contributors. I'm sorry this is going to take a little more time and thank you for your patience.

Microsoft are gradually dipping their toes into the Open Source world, and suspicions of sinister motives apart (although realistically they have little choice but to be involved), they do seem to be making a genuine effort.

Oh, and by the way, David Peterson has created a Facebook group: .NET Dynamic Languages. Looks like the march of facebook proceeds inexorably...

IronRuby Released

John Lam has announced that a 'Pre-Alpha' version of IronRuby is now available. It comes as a source distribution that can be built even (allegedly) only with the .NET Framework 2 redistributable installed. I've had a play, not knowing any Ruby I can't do much with it.

I can't easily see how to convert the project into Silverlight assemblies. It would be fun to use it with the DLRConsole sample.

Interestingly though, John says of the IronRuby project:

We're also happy to announce that we will be accepting source code contributions into the IronRuby libraries. [...] once the DLR matures and reaches 1.0 status with fully supported public interfaces, we will fully open up all parts of the IronRuby project for external contributions.

This is very different to the situation with IronPython, where no external contributions are accepted. This is a positive step forward, and hopefully heralds change for IronPython at some point...

The project will also be hosted at RubyForge rather than Codeplex which is another first for Microsoft.

Scott Guthrie has posted a long introduction and examples of using IronRuby: First Look at IronRuby.

Succumbed at Last: MacBook Ordered

My gadget fund has been building up recently and I've been uhming and ahing about whether to buy a Macbook. Over the weekend I was browsing the Apple store and saw a refurbished MacBook Pro at a price I couldn't resist. So I've finally succumbed and buying a machine without a Micro$oft OS.

The spec of the machine (which I should have in my grubby hands by Wednesday) is:

Refurbished MacBook Pro, 15-inch, 2.33GHz Intel Core 2 Duo 15.4-inch widescreen display (1440x900 resolution) 2GB (two SODIMMs) 667MHz DDR2 SDRAM 120GB 5400-rpm Serial ATA hard drive Slot-load 6x SuperDrive (DVD±RW/CD-RW) ATI Mobility Radeon X1600 with 256MB GDDR3 memory

I use my laptop for at least two hours a day whilst commuting, but will continue to use my desktop with Windows XP at home. I wonder how annoying it will be to use two different operating systems like this? If I like Mac OS then when I change my desktop next year I will switch to a Mac. I've been seriously tempted by the Apple Mac Pro with Twin Quad Core processors. (Not that I need this, but it would be nice). With two 3.0GHz Quad Core Xeon processors, it costs £2700 in the UK (but would need some extra memory). I looked at alternative suppliers for similar specced hardware and couldn't find anyone cheaper. Unusual for Apple to be cheapest for a hardware spec! Allegedly Intel are about to announce additions to their Core 2 Duo and Quad core processor ranges, with a big price drop - so it will be interesting to see what the situation is next year.

For writing (the dreaded book) I still need Microsoft Word, and as I have a license for the PC version I think I will run it under virtualisation rather than buy a license for the Mac version. I look forward to using IronPython with Mono, but I will also need Windows for running Resolver and using the parts of .NET that aren't fully implemented in Mono.

Parallels has a very good reputation for Windows virtualisation on the Mac and costs $80.

VMWare, who have a good reputation for virtualization on other platforms, have announced a beta of VMWare Fusion for the Mac. This will cost the same as Parallels but is available as a pre-order for $40 so I'm not sure which to go with.

To decide which version of Windows to run under virtualisation on the Mac I've installed Vista Ultimate into a Virtual PC . It's been fun to use it as an isolated development machine - and all the software I rely on seems to work.

Archives