Friday, June 27, 2008

Try Python: Python in the Browser with IronPython & Silverlight

A while ago I experimented with an interactive Python interpreter that ran in the browser using Silverlight. Unfortunately a couple of bugs with the version of IronPython for Silverlight prevented it from working properly.

Now that Silverlight 2 Beta 2 is out, along with an updated version of IronPython for Silverlight, those bugs have been fixed.

"Python in the Browser" is an interactive Python interpreter that runs in the browser, using Silverlight 2 and IronPython. The project is hosted on google code, and although there is no packaged release you can download all the code and docs on customizing it from:
As well as being ideal for providing live examples in documentation, my goal is to (eventually) provide an online tutorial for learning Python that runs entirely in the browser. Currently all that is on the site is a live example of "Python in the Browser":
It requires Silverlight 2 Beta 2, and the Python version is 2.5. It doesn't require either .NET or Python to be installed to use it. Builtin modules are available, but I haven't made much of the standard library available (they simply need to be added to the 'xap' file containing the Silverlight application.)

All the basic functionality of "Python in the Browser" works fine. There are a few limitations and improvements that could all be solved by a more sophisticated implementation.

The ones I am aware of are all listed in the Issues Section of the Project Home. If you find bugs or have any feature requests then preferably submit a patch, otherwise add it to the issues page.

The interpreter runs in an HTML textarea, with Javascript that communicates with Silverlight and prevents you deleting text from the console except after the interactive prompt.

Silverlight 2 is currently only available for Windows and Mac OS X, with the Firefox, Safari or IE browsers. Linux support is in the works via the Moonlight project from Mono.

No comments:

Post a Comment

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