Creating and using eggs

Sep 13, 2010
When I talked about eggs for the first time at CodeSyntax, everyone looked at me as if I was a mad man. I told them: "eggs are to python, what JARs are to Java". They looked at me even with a stranger face.

Now, I have convinced all of them that the best-practice is to create eggs for their developments. If we live in a python environment (it doesn't matter whether we use Plone, plain Zope, Django or plain Python), and we create small reusable libraries, we have to create them in the same way the community creates. And that way is to create eggs.

OK, we already know how to create eggs, all my colleagues have ZopeSkel installed and almost all of them, even Django developers, use zc.buildout for their projects (well, not all of them, like in 50 B.C. one small village of indomitable Gauls still holds out against the invaders....). But just creating eggs is not enough to be a good citizen. We use zc.buildout to have easily repeateable and predictable working environments, so we need to have a centralized repository (or more than one) to save all those eggs. And as we also use SVN to save our code, we need to create tags with our packages and then upload to somewhere from where our buildouts will download them.

We use a script called release-egg.sh for that. It's a small script. It just sets the version number in setup.py and version.txt (if it exists), commits the changes to the SVN, creates a SVN tag, and then creates a distribution tar with that version. After that, it presents 3 options: upload to a statically served Apache directory, upload to CodeSyntax.com and upload to PyPI. Until now, we only used the first option, from now on, we will be using also the second one for our own developments. We have to open our doors and show the world what we do.

Comment

To comment this article you have to log in using your Facebook, Twitter or Google account.

Mikel Larreategi

Plone developer. Chess International Arbiter #truestory