Skip to: site menu | section menu | main content

IronPython in Action News

News on the IronPython in Action book and sources.

Currently viewing: Front Page

Archive for June 2009

Guido van Rossum on IronPython in Action

written by Michael Foord, on 6/30/09 5:43 PM.

Guido van Rossum is the creator of Python and its Benevolent Dictator for Life (BDFL). He is employed by google and not known for his love of the Windows platform. That aside I sent him a copy of IronPython in Action and he has reviewed it. As you can tell from the title of his blog entry it isn't a typical review, but he does say some very nice things about the book:

  • IronPython in Action and the Decline of Windows

    Seeing a book like IronPython in Action, by Michael Foord and Christian Muirhead, is another milestone for IronPython. This is a solid work in every aspect, and something nobody using IronPython on .NET should be without. The book is chock full of useful information, presented along with a series of running examples, and covers almost every aspect of IronPython use imaginable.

    There are some introductory chapters -- some fluff about .NET and the CLR, an introduction to Python, and an introduction to with .NET objects from IronPython. The Python introduction has a slight emphasis on differences between IronPython and CPython, though there aren't enough to fill a chapter. This is a good thing! The chapter does a pretty good job of teaching Python, assuming you already know programming. In general, the book is aimed solidly at professional software developers: unless you are paid to do it, why would anyone want to get intimate with Windows?

Unfortunately reading the early chapters that go through developing a simple Windows Forms example application seems to have given Guido terrible flashbacks to a brief period of C++/Win32 development and the rest of the article becomes somewhat a rant about the Microsoft / Windows programming experience. I think Guido is a little unfair to Windows Forms, it's certainly no worse than other GUI toolkits I've used, and whilst a little verbose in places is generally quite good. Ironically the only examples of pixel positioning in the book (that I can recall anyway...) is to demonstrate how much easier the visual designer can make some aspects of GUI development... Anyway, it's good that Guido liked the book - whatever he may think of Windows development.

IronPython in Action Goes to College

written by Michael Foord, on 6/22/09 12:16 PM.

Thanks to the wonder of Twitter I've heard about two different college courses that will be using IronPython in Action as course material next semester. One is Sargeant Reynolds College in America, with a course taught by Kevin Hazzard, and the other is Northtec in New Zealand with a course taught by Tony Meyer.

IronPython is an ideal language for learning programming, it has the great combination of an easy to learn general purpose programming language (Python) with a programming environment which is widely used in commercial development (the .NET framework). Not only these factors, but it is easy to teach good programming practise with Python; things like well structured code, testing, computer science theory including elements of functional programming and so on.

I exchanged emails with Tony who explained why he is using IronPython in Action:

The course is (unimaginatively) titled "Programming" (not my doing!). It's at NorthTec at the Whangarei campus (a couple of hours north of Auckland). It's the second programming course in their Bachelor of Applied Information Systems degree. We switched the first course from VB to Python a couple of years ago, but left this one as VB (because it's their introduction to Visual Studio and .NET).

Early last year I started work convincing people that IronPython would be a good choice, since they can continue with a language they (somewhat) know, but still get the intro to the Microsoft toolchain (plus, I hate VB, and dislike teaching in a language I never use in practice). I was expecting that I'd have to continue on without a textbook, until I saw that IronPython in Action was coming out.

BTW, while it's not like there is much choice in the way of books, yours is an excellent fit. The first section is a good Python refresher and .NET introduction. I introduce unit testing to them in the course, and the book handily has a chapter on that. They do a lot of sysadmin work later in their degree, so the chapter on using IronPython / PowerShell is great. They do ASP.NET stuff later on as well, so that'll be a good reference at that time (I don't expect I'll have time to cover that myself). I introduce them to databases and (since a couple of years ago) web services, and there's a chapter on that. Silverlight is an interesting example, and something I expect they'll be interested in given the later web development work, and there's an introduction to that.

Basically, you couldn't have done a lot better if I'd commissioned it! Thanks! - it certainly has made redoing the course material much simpler than if I was working completely from scratch.

As I mentioned in my tweet, I'll put my course material online at some point in the next couple of weeks (it's not quite finished) in case anyone else is interested in it.

IronPython in Action Examples on Mono

written by Michael Foord, on 6/9/09 11:45 AM.

Chapters three to six of IronPython in Action take you through building a simple example application called MultiDoc. MultiDoc is a multi-tabbed text editor using Windows Forms for the user interface. It is built with a few common design patterns (Model View Controller, command pattern, observer pattern and so on) to demonstrate structured programming with Python. In the process of building MultiDoc the reader will work with various .NET libraries and explore Python language features.

The source code for all the examples in the book can be downloaded from the Manning website or from the Sources page of this website.

The MultiDoc text editor

The intention is that MultiDoc, along with as many examples from the book as possible, run on both Mono and the .NET framework; IronPython isn't just for Windows but can also be used on Linux and Mac OS X or anywhere that Mono will run.

Some readers have reported that MultiDoc crashes on exit when run with Mono. The root cause of this is the old version of IronPython 2 that ships with Mono. The full Mono distribution includes both IronPython 1 and 2, so after installing the full version of Mono you can run commands like:

ipy MultiDoc.py
ipy2 MultiDoc.py

Note

In the debian and Ubuntu distributions of Linux IronPython is packaged separately from Mono. You can install IronPython 1 with: sudo apt-get install ironpython.

The versions of IronPython included in Mono come from the FePy project; a community distribution of IronPython which can be compiled with Mono. The version of IronPython 2 is 2.0 Alpha 5 which is pretty old. Unfortunately Mono bugs or incompatibilities have stopped more recent versions being compiled with Mono. It isn't all bad news as IronPython 2.6 can be compiled with Mono which means we should have a FePy updated once this comes out. You can read more on the details in the FePy Status Update.

Some bug in either IronPython or Mono means that you will see the following crash on exiting MultiDoc when using IronPython 2a5 from Mono:

**
ERROR:generic-sharing.c:301:move_subclasses_not_in_image_foreach_func:
    assertion failed: (subclass->image == image)
Abort trap

This is reason enough to look at using a more recent version of IronPython 2. Even though IronPython can't be compiled with Mono you can still use the up to date Windows binaries (which is part of the point of Mono - binary compatibility). To use the latest version of IronPython (2.0.1) you'll need Mono 2.4 or more recent. For Mac OS X you can use the Mono Apple installer. For Linux you'll need to build Mono from source. This blog entry by Ali Afashar explains how to get IronPython 2 working with Ubuntu:

iLove Sharepoint Reviews IronPython in Action

written by Michael Foord, on 6/1/09 4:11 PM.

Christian Glessner is head of development at Data One and a Sharepoint expert. Even before IronPython in Action came out he was experimenting with integrating IronPython with Sharepoint and he has now enthusiastically reviewed the book with this in mind:

IronPython In Action covers all you need to get started with IronPython for a .NET or Python developer. It is written coherently without needless ballast, well suited to the philosophy of the language itself. My favorite chapters are “Silverlight: IronPython in the browser”, “Agile testing where dynamic typing shines” and “Embedding the IronPython engine”. The book has inspired me to found the CodePlex project IronSharePoint (coming soon) showing how you can develop SharePoint apps with IronPython. I’m convinced that in the near future dynamic languages will get more attention again, just think of the “dynamic” keyword in C# 4.0. Absolutely worth keeping an eye on it!

Back to top