Thursday, September 2, 2010

Creating an egg? Clean first!

I ran into an error on a production site which turned out to be due to an egg containing extra files. How did these old files get included in the egg? I'd been running python setup.py bdist_egg to create the egg, and then i uploaded them to a www server. (Not a "real" egg server.)

Before creating a new egg, the build/ directory is not cleaned by default. Therefore, files that were present in an earlier build but have now been removed from the package will still be included in the egg.

Running python setup.py clean remedies this.

1 comment:

tom said...

If talking about cleaning before releasing: Doing some basic style and plausibility checks is also a good idea. flake8 does a good job here.