I wrote this little program called Squisher that takes a ZIP file containing Python modules and generates a totally self-contained .pyc file that imports a specified module therein. (Conveniently, Python's bytecode parser ignores anything after an end marker, and the zipimport mechanism skips any non-ZIP data at the beginning of a file!) For example, say you have a directory called 'foo', which contains an __init__.py, which contains "print 'hello'; x = 123", and a thing.py, which contains "y = 456". If you make a ZIP archive of this and run it through Squisher, you'll get a single .pyc file which can be imported by any Python installation anywhere just like any other module, without requiring users to install any supporting mechanisms (like setuptools), and giving all the flexibility and stability of zipimport. In other words, you can do this simply by dropping the foo.pyc file into a directory:
>>> import foo hello >>> foo.x 123 >>> from foo.thing import y >>> y 456 Of course, this is a stupid and useless example, but you can do it with any package you could use as an egg, yet without requiring people to install setuptools (or any other external glue) to use it. I've tested it with several large packages, including SQLAlchemy. Right now I'm just testing and polishing up the code... in the meantime, any comments? -- http://mail.python.org/mailman/listinfo/python-list