I've posted the third version of my experimental packaging program
Squisher. Squisher can take a directory representing a Python package
(i.e. a directory with __init__.py) and "squish" it into a single .pyc
file that you can import, or run on the command line, just like any
other .py/.pyc file.
The hook is that it can be thus imported *without* necessarily having
Squisher itself installed. All you do is run Squisher on a directory
(or an existing zip file if you wish), and you get a single file you
can import with any normal Python installation.
It is complementary to Eggs in a way. They're good for having packages
globally installed and keeping them up-to-date, but very often you may
want the simple convenience of dropping a .pyc in a directory and
importing it. Furthermore, since Squished packages are just zip files
with a special Python bytecode header (and Eggs are just zipfiles with
internal metadata added), you can actually run it on an Egg and get a
file that can be used as an Egg *or* a Squished package just by
Try it out... I've found it useful so far. It is still pretty
experimental, so I wouldn't advise using it as a serious packaging
mechanism yet, but I hope that with time it will become very stable
and complete. Bug reports/patches welcome.
Changelog for anyone who tried the previous releases:
- Added a couple of patches courtesy of Gary Duzan -- a Python 2.3
compatibility fix, and a fix for importing compiled modules when
running a .pyc from the command line.
- Changed from GPL to BSD license. Also clarified that the generated
bytecode is considered public domain.
- It now detects if you pass it an already-squished module -- if so,
it will simply update the bytecode header if necessary.