[Distutils] cracked eggs

Ryan Tomayko rtomayko at gmail.com
Mon Jun 20 17:31:46 CEST 2005

Gah. Color me a dolt. That all makes a ton of sense. Sorry...


On Jun 20, 2005, at 11:13 AM, Phillip J. Eby wrote:
> At 12:03 AM 6/20/2005 -0400, Ryan Tomayko wrote:
>> I've noticed that many packages that use __file__ and path operations
>> instead of the pkg_resources / PEP 302 APIs to load package data
>> usually work fine if you move the .egg file out of the way and then
>> extract it to a directory with the same name. I have a little shell
>> script ("crack_egg") that does this for me but I was wondering if
>> this might be something that package authors could specify for their
>> packages somehow, or maybe easy_install could take a command line arg
>> or something?
> It does!  The  --zip-ok/-z flag.  By default, EasyInstall unpacks  
> eggs that it builds from source.  However, it assumes that packages  
> being *distributed* as eggs are "egg-ready".
>> I remember reading somewhere that .egg files speed up import times
>> over .egg directories because the zip index is quicker than the file
>> system or something. But is it really that significant?
> The issue is that it gets worse as you add more and more  
> directories to sys.path.  The zip index is quicker than the  
> filesystem because it's loaded at most once, and kept in memory  
> thereafter.  So the disk access for a zipfile is O(1), but for a  
> directory it's O(N).
>>  Considering
>> that a decent number of potential eggs are broken due to the resource
>> API I wonder if it might be nice to have the option to prefer .egg
>> directories for all packages installed by easy_install (e.g. by
>> defaulting some option in ~/pydistutils.cfg).
> It's already the default for eggs built from source; you have to  
> explicitly request installation as a zip file.  Eventually, the  
> option will default the other way, when most everything out there  
> works as eggs anyway.

Ryan Tomayko
                                  rtomayko at gmail.com

More information about the Distutils-SIG mailing list