Python 2.6 is released, some highlights

by jesse in ,


futurama_bender_sm.jpgWell, it's final boys and girls. Python 2.6 is final and up on the site. A whole lot of people put a ton of work into this release - Python 3.0rc2 will be out shortly, but the dev team made the decision to focus on 2.6 so we could all get it buttoned up and out in the wild.

You should read "What's new in Python" - it highlight what changed, and the sheer amount of work that went into this. Barry Warsaw, Benjamin Peterson and many, many others deserve a lot of credit for helping shepherd this release to finality.

I'm very proud of this release - for a variety of reasons. This is the first python release that I personally had a chance to directly contribute to, however minor that contribution was. Also, this is the first time I've been able - through an allowance of personal, and work-time - to seriously contribute to an open source project I care about.

Some highlights? Context Managers, the Per-user site-packages directory, abstract base classes, class decorators, and a ton of bug fixes.

The inclusion of the multiprocessing library was a bit of a wild ride for me - I had to learn a lot, very quickly. I didn't get to add/fix all the things I wanted to, but that's the way things go.

I like to think that the inclusion of this package will help people solve problems - that's what makes me most excited about it. It's not perfect, and it's not a solution for everyone, but it's darned useful, and I hope people get to use it, a lot.

I just want to point out something about the package - and concurrency in general - Multiprocessing is a very specific implementation of a threading-like API for side-stepping the GIL, it is not the "final" word in concurrency within the stdlib - it is one stepping stone in a path that will hopefully improve the language as a whole.

I can easily see the creation of a concurrent.* package for python, which might include higher level abstractions for pools/message passing/monitors(actors)/etc for both this package, and the threading package. This is going to be a long, interesting project - and I can only hope that we can really improve the language and standard library as a whole. Again - it's all about solving problems.

That all being said - here are some tidbits of what changed within the multiprocessing package:

  • As you can see from the docs, unfortunately, this package does not work on FreeBSD/OpenBSD - it was an unfortunate casualty late in the game.
  • The bouncyCase names have been dropped in favor of PEP8 compliance within the API. The threading module is also dropping the bouncy names to have fully PEP8 compliant names. It was decided that since MP was new, we would cut to the chase and simply fix it's API. In 2.6, the PEP8 compliant names have been added to the threading module, and the old API will be eventually deprecated.
  • While changing the API to remove the bouncy names, we also cut certain things over to be python properties in order to be more pythonic. These include "process.name", "Process.daemon", "Process.pid", "Process.exitcode", "Process.authkey".
  • There are still open bugs against the package - unfortunately, like the other people on python-dev, this is a part-part time job for me, and I couldn't get to everything. Here's a query to see which MP bugs are assigned to me, and their status (this includes closed bugs).
  • The documentation includes some incredibly helpful examples - including the last example, which uses the package and SSH to create a distributed network of workers. I'll be building on this/cleaning it up and switching it over to use paramiko as part of my continuing work.

That's just some of the work/thoughts that are pinging around in my head. I have a long wish list of things to add, including some message-passing examples/etc. Already, people are building recipes/extening it - for example, David Decotigny has uploaded a recipe to add the same mp.Pool semantics to the threading module as well as one to allow remote method calls and an additional mp.Pool variant here.

Feel free to file bugs - I welcome them - I just may not be able to fix them really fast. Including patches is awesome.

As I said in the opener - a lot of people put a lot of effort into this release (and all the previous ones) so a big thank-you goes out to everyone. I encourage you to download it, try it out, break it but most of all use it.