Tuesday, August 01, 2006

Confessions of a part-time IronPython programmer

On the 27 july 2006 I gave a talk to the the Sydney Python Group (SyPy) about my experiences using IronPython on both .NET and Mono. I promised some people who couldn't attend that I would do a post on my blog that presented the same material. I have decided to present this material as a series of posts, with this post being the index to them.

Index of posts
  1. Agile investigation of the GDATA client with IronPython
  2. A Windows Form GUI for the GDATA reader with IronPython
  3. Deploying the GDATA Reader as an executable
  4. IronPython and ADO.Net Part 1
  5. IronPython and ADO.Net Part 2

The confessions
  • I have been programming in Python since 1997.
  • Python is my favorite programming language.
  • We use it at work as our cross platform scripting language and for most network/web work.
  • I have played with IronPython since Jim Hugunin did the first public release and have experimented with most of the releases that have come from the Microsoft Dynamic Languages IronPython Team.
  • Hope that IronPython will give me the same programming flexibility that the Mark Hammond's CPython win32 extensions gave me. But I want it on all platforms that support .NET and Mono.
The initial experience

Three months ago, I started trying to do "real" things with IronPython and I was disappointed with the results. This is because of my expectation that it would work like CPython and I would have access to the wonderful standard library. This is why people refer to Python as a language with batteries included. At the time dependant on your viewpoint, IronPython had only partially charged batteries and worst case batteries were not included. Yes, you could copy or link the CPython standard library so IronPython could use it, but of course modules that used C extensions will not work. Lot's of my favorite non-standard python modules are very dependant on the Python standard library. You would be surprised how many needed md5.py, and if you want to use Python's high level network libraries like urllib, httplib etc you need socket.py.

But it got better

As I said, this was a few months ago and things have improved, thanks to the IronPython team providing some standard library replacements written in C# and the community providing python wrappers round .NET classes. I also had my eureka moment where I discovered I had a good library at my disposal, the base and extension classes that both .NET and Mono provide.

So lets see what we can do with IronPython.

Requirements
  • IronPython - At the time of writing this it is at RC1. The latest version can be downloaded from here.
  • .NET 2.0 or Mono 1.1.16.1+
  • Your favorite text editor
  • And you may find an IDE like Visual Studio 2005, Visual Express C#, SharpDevelop or MonoDevelop helpful.
The Project

We need something to build, so for the first series of posts we are going to create a quick and dirty GDATA reader. What is GDATA? From Google's website:

"The Google data APIs ("GData" for short) provide a simple standard protocol for reading and writing data on the web. GData combines common XML-based syndication formats (Atom and RSS) with a feed-publishing system based on the Atom publishing protocol, plus some extensions for handling queries."

Also Google provides a GDATA client written in C# as source and an assembly. We will use this client assembly as a helper module in our project. Three posts will document the steps in creating the GDATA reader.

  1. Agile investigation of the GDATA client with IronPython
  2. A Windows.Forms GUI for the GDATA reader using IronPython
  3. Deploying the GDATA reader as an executable
I also intend to do posts on the following:
  1. Embedding IronPython
  2. Database access with IronPython
    1. IronPython and ADO.Net Part 1
    2. IronPython and ADO.Net Part 2
  3. IronPython and the Web.

No comments: