[Distutils] setuptools: zip_safe as command line option ?

P.J. Eby pje at telecommunity.com
Wed Dec 8 21:43:55 CET 2010

At 08:54 PM 12/8/2010 +0100, Martin Raspaud wrote:
>Hash: SHA1
>2010-12-08 17:34, Marius Gedminas skrev:
> > On Wed, Dec 08, 2010 at 09:52:15AM +0100, Martin Raspaud wrote:
> >> Is it possible to tell setuptools to not zip the egg when 
> installing ? I can't
> >> seem to find any option regarding this in the command line help...
> >
> > Setuptools has no command-line.
> >
> > If you mean easy_install, it's -Z (--always-unzip).
>Ok, I meant on the
>"python setup.py install"

If you're using "python setup.py install" and want it to install in 
the old-style (distutils) way, you can use "setup.py install 
--single-version-externally-managed".  This will install it in a way 
similar to pip, but without the uninstall capability.  (You should 
not use this unless that's *really* what you want, and it probably isn't!)

However, if you want to do the equivalent of "easy_install -Z" from a 
setup.py, use:

    python setup.py easy_install -Z .

Which is roughly like "python setup.py install", but with .egg 
directory installation in place of a zipped .egg file.

Also, as Benji pointed out, you can put this:

zip_ok = 0

in your project's setup.cfg or your user or global distutils.cfg file 
to force this to happen automatically, even if you use "python 
setup.py install".

For that matter, you can put 'zip_safe=False' in your setup() call in 
your setup.py to make that one specific project always install 
unzipped, even when somebody else installs it from an .egg file.

There are many ways to do it -- so use whichever is most convenient 
for what you are trying to accomplish.

(All of the above answers are valid for setuptools-based projects.)

More information about the Distutils-SIG mailing list