3

When I release a program, I usually just create a setup.py and put it on pypi. It's installable with pip, I can always share it easily with others. It works for me, and apparently for a lot of people.

I see the benefit of making an exe, a deb or a rmp to easy sysadmin.

But I really don't see the point of using eggs. Can you tell me what can I gain from it ?

I also once read that eggs had downsides, but I can't find the article anymore. Could you describe to me what problems using this packaging format can cause ?

Please note that I did saw this question, but the answer is also applicable to a simple directory with setup.py. It doesn't tell me the benefits of eggs over the simpler format.

Community
  • 1
  • 1
Bite code
  • 578,959
  • 113
  • 301
  • 329

2 Answers2

3

Eggs are tied to a specific architecture and python version, and until Python 3.3, if the egg contains C extensions, even the internal Unicode representation size (UCS2 vs. UCS4).

Unfortunately, the latter difference is not captured in the egg metadata; an egg filename contains the architecture and the python version (major.minor, so 2.4 or 3.1) but the unicode byte size is omitted.

Because of this, eggs are not very portable. A .tgz or .zip distribution on the other hand, is (hopefully) platform agnostic. Your installation tool, be it easy_install, pip, buildout or whatever, knows how to compile a python package distribution into an egg for you, so you generally avoid distributing the .egg files altogether.

The only exception is Windows, where most people will be lacking the toolchain to compile C extensions. As Windows distributions of Python default to UCS2, you are usually safe to distribute Windows .egg builds of packages with C extensions, to facilitate installation by automated tools.

If you use the setup.py script to create the distribution, it's trivial to create a source-only package for upload to PyPI. I can recommend the Python Packaging User Guide for more information.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • If you are interested in an example, take [Acquisition](https://pypi.python.org/pypi/Acquisition); the PyPI page includes a source distribution, plus Windows binary eggs. – Martijn Pieters Sep 05 '12 at 09:49
1

*.egg is a pure deployment format that is used after having a package installed through easy_install or pip.

Is does not make sense uploading files as .egg to PyPI. People doing this have no idea what they are doing.

A proper PyPI release is either a .tar.gz archive, or a .zip archive or .exe file (for Windows binaries e.g.) but NEVER EVER a *.egg file.

  • Ok, but why would use use .egg in deployment over fetching the lib with pip, rsync it, git pulling it, scp it or just use it in a pip bundle ? – Bite code Sep 05 '12 at 09:39
  • No, eggs *were* designed as a distribution format too! But they failed at that task, as they did not take wide-unicode builds into account. So, *in practice* we ended up using .eggs as a deployment format only. Python 3.3 will change all that, btw. – Martijn Pieters Sep 05 '12 at 09:45