jueves, febrero 23, 2012

MonoDevelop IronPython binding

While playing with Python, then with IronPython, and finally while preparing a talk about the latter at the Mono Devroom at FOSDEM (last February), I implemented a basic MonoDevelop language binding for IronPython, and now after some minor polishing I'm presenting what would be the 0.1 version.

iron-screenshot

You can think of this addin as a port of the basic-but-working Python binding for MonoDevelop, modified to use the actual IronPython asemblies (coming partially bundled, with the help of them being Apache licensed), and thus use its AST, parser on other routines instead of those ones of the standard Python implementation. And well, some sugar here and there for specific stuff.

That being said, it's not as complete as the C# support in MonoDevelop, but surely it will allow you to play around. Some of the important things to remember while trying it:
  • Disable the MonoDevelop Python addin. It happens that MD tries to detect a handle for a file being opened (something.py) and it will likely give priority to the Python one.
  • Even if the IronPython/DLR assemblies are bundled, we are just doing it partially (to use the required bits). Thus you need to install IronPython yourself.
  • Windows is not supported at the time, since the completion engine (borrowed from the MD Python addin) uses Mono.Data.Sqlite, which happens to not work under Windows (due to a bug). Hopefully this will be fixed with a new completion engine I'm working on.
To try it, just clone github.com/carlosalberto/IronPythonBinding . (I plan to offer it as a Test addin in the MonoDevelop addin repository after I figure out some issues there.)

Before actually playing with it, don't forget to configure the actual runtime/interpreter: Simply go to Edit->Preferences->IronPython (a better and sweeter dialog is coming for this, btw):

iron-interpreter

Of course, there are many items on the TODO (like squeezing the IronPython/DLR assemblies, improve the indentation and completion engines -ongoing-, include decent support for policy sets, etc), so the plan is to incrementally work on them. Of course, any contribution is welcome ;-)