Modular Python with eggs

Posted by Patrice Neff Wed, 15 Apr 2009

I did a presentation at the March swiss.py user group meeting about using Python eggs. I hear a lot of bitching about Python’s packaging. Guido even managed to talk at lengths about the problems with it at his PyCon keynote talk. Here I am boldly saying almost the opposite: Python packaging rocks! It’s very easy to have a great workflow both for development as well as deployment using Python eggs.

Some notes from the presentation which you can download as a PDF.

First, I love how easy it is to get started with Python eggs. You only need to create a setup.py file which at it’s simplest can even be just one line. At Nektoon we try to create as small components as possible and then package them using setuptools. We even split up our Pylons frontend using paste.urlmap (we are already a 10 frontend applications after three months).

We then deploy those eggs into our internal pypi server. Creating such a server is laughingly easy. A web server with directory listings enabled is enough.

The eggs are automatically generated and published to our pypi server by Hudson. Whenever we check in a change, the test suite runs in a clean virtualenv environment. This also makes sure we have declared all the dependencies correctly. If all tests run successfully, then the egg is built and published to our pypi.

As a last step we automatically deploy those eggs to our trunk instance of the Nektoon infrastructure.

All of this was very easy to build thanks to all of the existing work in the Python world. So let me thank all the responsible people for this. And who knows, maybe I’m just in the honeymoon phase as I’ve yet to see something comparably easy and powerful in all the other environments I have experience in.

Deployment

Posted by Patrice Neff Mon, 04 Sep 2006

In the Rails world I’m used to Capistrano for deploying. With “rake deploy” I can always deploy my projects to the production server. For my liking it’s a bit too much coupled to Ruby projects for being used in other projects.

So what do you use for other projects? Is there anything you like? And if not, is there an interest for a tool?