When Python *Eggs* better than Python *distutils*?? What's Eggs?
Phillip J. Eby
pje at telecommunity.com
Fri Dec 30 18:42:23 CET 2005
seberino at spawar.navy.mil wrote:
> I have been using distuils for a while and was wondering when
> Python Eggs (new project) is better?
If you have a relatively simple setup script, don't need to upload your
package to PyPI, and don't include any files other than .py files and C
extensions in your distribution, you won't benefit much from switching
If you have a lot of non-code files, setuptools will let you get rid of
MANIFEST hassles and data file installation issues. A fairly complete
list of setuptools features can be found here:
Most of these are just conveniences for the developer, that get rid of
a lot of the repetitious code you have to put in setup.py, especially
if you are doing anything that the distutils doesn't handle
However, the "killer app" feature of setuptools is that it lets you
distribute a project that depends on other software available via PyPI.
Instead of having to bundle the other project inside yours, or tell
users to manually download and install the dependencies. If you use
setuptools, then you can take advantage of automatic dependency
download and installation, making it easier for you as a developer to
reuse existing open source Python code. This is the real reason
setuptools and eggs and easy_install exist: to allow Python developers
to reuse code without bundling or manual dependency management --
regardless of platform. (i.e., without them having to support rpm,
deb, msi, dpkg, pkgsrc, and all the other nine jillion packaging
systems out there).
> So basically Python Eggs precompiles and compresses
> binaries for you so you just have to load it to run
> your app?
Python eggs are a way of bundling additional information with a Python
project, that allows its dependencies to be checked and satisfied at
runtime, as well as allowing projects to provide plugins for other
projects. There are several formats for this, but the '.egg' zipfile
format is a convenient one for *distributing* projects. Whether you
keep them compressed or not when you install them is partly a matter of
whether the project is able to be used in compressed form, and whether
you want to be able to use certain documentation or debugging tools
that don't always work with zip files.
This .egg format is created by the "bdist_egg" command, which is
basically similar to bdist_wininst or bdist_rpm, in that it creates a
file you can then upload to PyPI or otherwise distribute. The main
difference between .egg and win32.exe or .rpm is that .egg files can be
put directly on sys.path and used, while the other formats cannot.
More information about the Python-list