Saturday, June 28, 2008

Python and .NET Playing Together

Another programmer, this time Richard Sumilang, discovers the power of IronPython for using the .NET framework.

"And walla! You have to admit, that is pretty awesome! We've got the power of simplicity from Python along with the power of .NET at our finger tips!"

In this blog entry he writes two examples in both C# and IronPython, comparing the code in both cases. The first is a simple example to write to stdout (with 'System.Console.WriteLine'), and the second uses the MySQL .NET connector to query a MySQL database.

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.

Silverlight to Support Ruby and Python Developers

A site called 'talkibie' has an article for 'managers' on dynamic languages in Silverlight. Light on technical details, but it references several other articles on the subject.
It mentions the latest buzzword 'ARAX' - Asynchronous Ruby and XML. Silverlight allows you to do background network requests and access the HTML DOM. Web applications can use AJAX techniques, but with Python or Ruby instead of Javascript on the clientside.

How to write a simple DLR host in C# using Hosting API

A blog entry showing a step-by-step guide to creating a DLR host in C# applications (from Visual Studio). This example executes a Python file created as part of the VS project.

IronPython and Silverlight 2 - Part 1

A blog entry on writing Silverlight 2 applications with IronPython. The text is all in French, but code is the universal language of geeks, and these examples are more than readable.

Exploring Test Application - IronPython (2)

A new entry on the GUI Automated Testing blog. This furthers the exploration of how to functionally test Windows Forms applications with IronPython - using some clever (but simple) reflection techniques.

Sunday, June 22, 2008

Exploring Test Application

The GUI Automated Testing blog explores testing .NET applications with reflection, via IronPython.

IronTextBox 2

IronTextBox is a project that puts an interactive IronPython interpreter into a Windows Forms textbox, for providing an interactive environment in .NET applications. IronTextBox 2 is an updated version that works with IronPython 2:

Thursday, June 19, 2008

IronPython and IronPython Studio

A two part article on IronPython and the IronPython Studio, including some COM interop with Excel.

IronPython and PyFit PYTHONPATH Ordering

Peter Ryan uses PyFit and FitNesse with IronPython for testing, but has some import issues resolved by changing the order of paths in the import path:

Concerns with the Dynamic Language Runtime

A blogger called Incanus (or mithrandir?) blogs his concerns about the Dynamic Language Runtime. Specifically he is concerned about the hardcoding of references to the three current DLR languages (IronPython, IronRuby and Managed JScript) in the sources, and the many '#ifdef SILVERLIGHT' references that allow the same sources to compile the DLR for Silverlight.

Wednesday, June 18, 2008

Chapter 14: Extending IronPython with C# / VB.NET

The penultimate chapter of IronPython in Action is finished, and its on writing class libraries in C# / VB.NET for use from IronPython:

My First IronPython Program

Brandon Furtwangler writes a web spider for downloading mp3s:

Saturday, June 14, 2008

So why is it called IronPython?

Brian Schroer gives the game away and explains how IronPython got its name:

IronPython 2.0 Beta 3

Hot on the heels of the release of an updated IronPython for Silverlight is a new release of IronPython. The new version is IronPython 2.0 Beta 3.
Headline changes in this release include improved performance and the addition of the '_winreg' and 'cmath' built in modules. About 34 issues were closed in this release.

This release can only be compiled with Visual Studio 2008, support for Visual Studio 2005 has been dropped. IronPython still only requires .NET 2 though, and does not require .NET 3 to run.

If you have Visual Studio Professional and VS Tools for Silverlight you can compile this release for Silverlight. This release includes binaries compatible with Silverlight 2 Beta 2.

The DLR will Continue to be Licensed under the Ms-Pl

Jimmy Schementi, responsible for dynamic languages on Silverlight, has responded to the article in the Register on the licensing of the Dynamic Language Runtime. Despite its sensationalist headline, the article basically says that the DLR will remain Open Source but won't accept contributions, whilst IronPython and IronRuby will accept contributions. Jimmy confirms this, and includes the timetable for the expected release of the DLR 1.0:

Friday, June 13, 2008

exchange2ical Available on Codeplex

Jon Udell has written an IronPython script that takes calendars from an Exchange server and publishes them in iCalendar format. The project is available from codeplex:

Microsoft: keep your sticky mitts off our language runtime

An article by The Register on which parts of the new dynamic languages Microsoft is creating will accept contributions from the community. Since the Dynamic Language Runtime will eventually distributed as part of the .NET framework (and used by Visual Basic.NET), they will not accept contributions to the DLR (although it is likely to remain Open Source). IronRuby already accepts community contributions into its libraries, something not yet possible with IronPython. In the future hopefully both IronPython and IronRuby will accept contributions into both the libraries and the core language.

Wednesday, June 11, 2008

IronPython History

Todd Ogasawara blogs about a new document (a five page PDF called IronPython: Engaging the Python Community in its Own Language) from Microsoft explaining the history of the IronPython project. It covers how Jim Hugunin started the project, Microsoft taking it on and the community involvement (including a mention of the "powerful, dynamic spreadsheets that are inherently programmable" created by Resolver Systems!):

Dynamic Script Control Update

XAML is an XML markup for describing user interfaces, used in both Windows Presentation Foundation and Silverlight. XAML elements correspond to classes in the UI libraries with element attributes corresponding to properties - meaning there is a direct relationship between XAML describing a UI and the object tree it generates when loaded (and code you could write to create the same UI).

When using a .NET language like C# and VB.NET you can declare new assemblies to be used as namespaces to locate classes used in the XAML - you can define new controls and use their names as XAML elements. Because dynamic languages don't have static assemblies for the XAML Loader to pull classes out of, you can't currently define new controls in IronPython or IronRuby and then use them in XAML.

Ivan Porto Carrero (who is also the author of IronRuby in Action) has created a new project called Dynamic Script Control. It has a static target, so it can be used in XAML, but lets you dynamically initialise the control from a Ruby hash or Python dictionary in the XAML!
This latest release of Dynamic Script Control is fully functional, but is only really tested with IronRuby at the moment. I aim to get it working with IronPython as soon as I have some spare time...

The latest Dynamic Silverlight SDK release is the first release of the DLR in a long time that works with current versions of both IronPython and IronRuby - which is what makes this release possible.

Now that Silverlight 2 Beta 2 is out of the door, future releases of IronPython and IronRuby will include a version compiled for Silverlight - so this is the last release for a while where IronPython and IronRuby both work with a common version of the Dynamic Language Runtime (at least until IronPython and the DLR are out of beta, which will hopefully happen by the end of the summer)...

Dynamic Languages in Silverlight 2 Beta 2

A new version of Silverlight 2 has recently been released: Silverlight 2 Beta 2. Silverlight 2 is a Rich Internet Application framework for the Safari, Firefox and IE browsers on Windows and Mac OS X. Silverlight 2 has a cut down, sandboxed, version of the .NET runtime at its heart - called the 'Core-CLR'. This means that it can be programmed with DLR languages like IronPython and IronRuby. At last the browser can be scripted with Python!

To go along with this release, there has been an updated release of the 'Dynamic Languages SDK' that includes the IronPython and IronRuby for Silverlight distribution, development tools (Chiron) and samples.

In this blog entry, Jimmy Schementi (the Microsoft employee responsible for dynamic languages on Silverlight) introduces the updated SDK and samples:

NUnit and IronPython

NUnit is one of the better known .NET Unit Testing libraries. A while ago Bitter Coder blogged about how to use NUnit with IronPython. Now Darrell Hawley has revisited the subject and updated the instructions for more recent versions of IronPython and NUnit.

Tuesday, June 10, 2008

New Releases: Resolver One & Ironclad

Both Resolver One and the Ironclad project have had new releases in the last week.
  • Resolver One 1.1 Released - performance & memory use improvements, new features and bugfixes for the IronPython spreadsheet development environment
  • Ironclad 0.4 Released - Ironclad allows you to use C extensions for CPython within IronPython. This release includes an import hook that allows you to seamlessly import C extensions. The next step is to get Numpy to import!

Monday, June 09, 2008

Products in IronPython

A recent thread on the IronPython Mailing List discussed products implemented with IronPython. The major ones are:
  • Resolver One - of course! Programmable spreadsheet on steroids
  • LeeBeLLuL - An RIA style application that uses IronPython in the browser and InfoPath in the form design
  • Symyx - IronPython is used for scripting of form editor widgets in their "universal ELN product" (whatever that may be, but evidently it is used by the scientific community)
UPDATE: More from the comments and the mailing list.
  • Final Builder - a Windows graphical build automation tool
  • www.itstructures.com - a large part is written in IronPython (the rest is C# and CPython)
  • www.handelit.com - IronPython is used for user scripting in their 'RiteTrack' product
  • The Havana CMS runs on IronPython 1.1 (and C# 3.). Work is underway to update it to IronPython 2.

Making VMWare API Friendlier

Ronnie Maor blogs about wrapping the VMWare API from IronPython to make it easier to use:
He has also added his wrapper to the IronPython Cookbook:

Saturday, June 07, 2008

RadControls for ASP.NET Ajax and IronPython

The DotNetSlackers have confirmed that the Telerik RadControls for ASP.NET AJAX do work with IronPython, and they provide some screenshots and example code: