[Distutils] .py vs .pyc (was: Newbie questions about setuptools)

Phillip J. Eby pje at telecommunity.com
Sat Jul 7 19:04:47 CEST 2007


At 10:12 AM 7/7/2007 -0600, Zooko O'Whielacronx wrote:
>On Jun 19, 2007, at 10:33 AM, Phillip J. Eby wrote:
>
> >> 2.  The resulting egg file is much larger than the .zip file
> >> created by
> >> 'python setup.py sdist' in spite of exclude_package_data = { '':
> >> ['*.pyc','*.pyo']},
> >>
> >> Is there any way to exclude .pyc and .pyo files?
> >
> > No; you can exclude the source if you like, though, with
> > --exclude-source-files.  Eggs are a binary distribution format,
> > originally developed to support user-installed plugins for systems
> > like Chandler, Zope, etc.  They aren't a source distribution format;
> > sdist works well enough for that and for easy_install if you have a
> > pure-Python package (or your users have C compilers).
>
>I would prefer to ship compiled C modules and source .py files.  For
>one thing, compressed source .py files are usually around 25% smaller
>than compressed .pyc files.  For another thing, I value making source
>available to the end-user, and I am loathe to ship non-source unless
>I really have to (which I pretty much do for C extension modules).
>
>So, please accept this as a feature request to make the above-
>mentioned behavior configurable for users such as me.

For the reasons I already explained above, this is a no-go.  If you 
want to ship binaries plus source, ship eggs.  If you want to ship 
without .pyc/.pyo files, ship an sdist.

This distinction is not about your preferences as a distributor, but 
about your users.  As a user, I don't want to pay for .py-compilation 
every time I import your modules, just to save you a few extra bytes 
of bandwidth.

If the option existed to ship without compiled modules, people would 
use it.  Following which, other people would begin claiming that 
"eggs are slow".  And all this, for what actual benefit?  Absolutely 
zip!  ...no pun intended.



More information about the Distutils-SIG mailing list