Sunday, September 13, 2009

IronPython Tools and IDEs (and important news about PyDev)

A frequent question on the IronPython mailing list is "what IDE should I use with IronPython?". For many .NET developers the question is phrased slightly differently, "how do I use IronPython in Visual Studio?".

Just as with Python this question is not easy to answer, depending to a large extent on what IDEs you have used before and personal taste. It is further complicated in IronPython with the need for features from a .NET IDE and from a Python IDE in order to fully use the language and programming environment.

Popular options include IronPython Studio (either integrated with Visual Studio or standalone), Visual Studio itself, SharpDevelop, Eclipse with the PyDev extensions and the Wing IDE from Wingware.

All of these tools have different levels of support for working with Python, the .NET framework, and IronPython specifically. This article looks at all of these IDEs and their features. It also covers other editors, plus common tools for Python development (code quality, refactoring, debugging, profiling, complexity and so on).
One of the IDEs that comes out very well is Eclipse with PyDev - yes, the major Java IDE has better support for IronPython development than the major .NET IDE!

When I first wrote the article, a whole two or three weeks ago, the PyDev extensions that add IronPython support to Eclipse were a commercial product (costing all of $42.50, but still commercial).

Since then PyDev 1.5.0 has been released and Aptana, the company that owns them, have made them fully open source:
Today, Aptana is proud to announce that Pydev and Pydev Extensions have become a single plugin, with all the available contents open source (and freely available for anyone) in the 1.5.0 release (it's the same as 1.4.8 but with all the code open source).
Here are the summaries from the major IDEs reviewed:

IronPython Studio and Visual Studio

Visual Studio is the 400 pound gorilla in the world of Windows IDEs. It is a great shame that its IronPython support is so poor. IronPython Studio is not a production quality IDE and is awkward to use even when integrated into Visual Studio. For anything other than small Python projects using Visual Studio as your main Python IDE will be a painful experience. The IronPython team are aware of this and are working on changing the situation!

It isn't all bad news however. Debugging IronPython code in Visual Studio is possible, and IronPython Studio helps with this if you are able to use it. Using C# in IronPython projects is so simple that there is no need to have designers that directly generate IronPython code. In addition, although not suitable for large projects, if all you are doing is including small amounts of Python in a mainly C# project then you will probably find using IronPython Studio bearable.

SharpDevelop

Overall excellent support for IronPython, especially when compared to Visual Studio. SharpDevelop does however fall down when compared to more specific Python IDEs; lacking features like intellisense, calltips and even Python oriented auto-indent. These features are ones that I consider essential for general development but I will be keeping a careful eye on how SharpDevelop progresses.

Even though I don't use it as my main IDE I am keeping it installed so I can use the debugger when I need it.

Wing IDE

Unlike the IDEs we've been looking at so far, Wing is a great Python IDE. Wing has the advantage of being cross-platform and can be used for working with IronPython and Mono on Mac OS X or Linux. Wing is also useful for both CPython and IronPython.

The scripting API is one of the killer features of Wing, it is very easy to extend (in Python of course) and integrate new tools. The intellisense and source assistant are its other killer feature and I find the Subversion integration, code browser and project browsers invaluable too. Unlike Visual Studio Wing isn't opinionated about how your project should be laid out, which makes it less of a pain to use with existing code.

By being a Python IDE rather than a .NET IDE there are features missing, especially designer and debugger support, and although the intellisense is very good it requires running an external tool on libraries you are using with IronPython. As few of the other IDEs have this feature at all, and there are other ways of getting a designer (I use Visual Studio Express generating C# for this) and debugger, Wing is my preferred IDE for IronPython development.

Eclipse and PyDev

In many ways Eclipse and PyDev has the most powerful IronPython integration of all the IDEs we have looked at. It is a capable Python editor and the added features for IronPython are built very naturally on top of this. If I wasn't so familiar with Wing I might be tempted to switch. Scripting Eclipse is more complex than Wing, and it is more opinionated about things like project layout, but having an IronPython shell built-in is a nice feature.

It is at least slightly ironic that the largest Java IDE has better support for developing in a .NET language than Visual Studio.

1 comment:

  1. Just wanted to note that Pydev can be scripted (on the fly) in Jython too. See: http://pydev.org/manual_articles_scripting.html

    Cheers,

    Fabio

    ReplyDelete

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