IronPython

From Wikipedia, the free encyclopedia

IronPython
Developed by Jim Hugunin
Latest release 1.1.1 / January 27, 2008
Preview release 2.0 Beta 3 / June 13, 2008
Platform .NET Framework, Mono
Genre Python Programming Language Interpreter
License Microsoft Public License
Website www.codeplex.com/IronPython

IronPython is an implementation of the Python programming language, targeting the .NET Framework and Mono, created by Jim Hugunin. Version 1.0 was released on September 5, 2006.[1]

IronPython is written entirely in C#, although some of its code is automatically generated by a code generator written in Python.

Contents

[edit] Status and roadmap

The current 1.1 version targets CPython 2.4.4 for compatibility. However, there are some differences between the Python reference implementation and IronPython.[2] As the open source license of IronPython does not apply to parts of its documentation, including the comparison fact sheet, it is not clear of how these differences affect compatibility with the reference implementation of CPython. However, some commercial applications built on top of IronPython are known not to work under CPython.[3][4]

Release 2.0, currently in beta state, targets CPython 2.5. IronPython 2.0 is built on top of the upcoming Dynamic Language Runtime which contains a Dynamic Type System and Dynamic Language Hosting Environment abstracted out of IronPython 1.

The Dynamic Language Runtime is meant to make it easier to write dynamic languages for the CLR. Dynamic languages being developed to run on the DLR include:

The DLR runs on top of the core CLR that will ship with the upcoming Silverlight 2.0. This means that IronPython can be used for client-side browser scripting with Silverlight.

[edit] License

Until version 0.6 IronPython was released under the Common Public License.[5] Following recruitment of the project lead in August 2004, IronPython was made available as part of Microsoft's Shared Source initiative. Authors claim that the license,[6] while not reviewed by the Open Source Initiative, conforms to the OSI's definition of open source. With the 2.0 alpha release, the license was again changed, to the Microsoft Public License.[7]

However, the open-source license of IronPython does not apply to parts of its documentation, including the comparison fact sheet with CPython reference implementation, which is not free to distribute and even reproduce.[2]

[edit] Interface extensibility

One of IronPython's key advantages is in its function as an extensibility layer to application frameworks written in a .NET language. It is relatively simple to integrate an IronPython interpreter into an existing .NET application framework. Once in place, downstream developers can use scripts written in IronPython that interact with .NET objects in the framework, thereby extending the functionality in the framework's interface, without having to change any of the framework's code base.

IronPython makes extensive use of reflection. When passed in a reference to a .NET object, it will automatically import the types and methods available to that object. This results in a highly intuitive experience when working with .NET objects from within an IronPython script.

[edit] Example

Wikibooks
Wikibooks Python Programming has a page on the topic of
Wikibooks
Wikibooks Python Programming has a page on the topic of

The following IronPython script manipulates .NET framework objects. This script can be supplied by a third-party client-side application developer and passed into the server-side framework through an interface. Note that neither the interface, nor the server-side code is modified to support the analytics required by the client application.

from BookService import BookDictionary
 
 booksWrittenByBookerPrizeWinners = [book.Title for book in BookDictionary.GetAllBooks if "Booker Prize" in book.Author.MajorAwards]
 booksWrittenByBookerPrizeWinners

In this case, assume that the .NET Framework implements a class, BookDictionary, in a module called BookService, and publishes an interface into which IronPython scripts can be sent and executed.

This script, when sent to that interface, will iterate over the entire list of books maintained by the framework, and pick out those written by Booker Prize-winning authors.

What's interesting is that the responsibility for writing the actual analytics reside with the client-side developer. The demands on the server-side developer are minimal, essentially just providing access to the data maintained by the server. This design pattern greatly simplifies the deployment and maintenance of complex application frameworks.

[edit] See also

[edit] References

[edit] External links