On Sep 19, 2006, at 5:43 AM, Martijn Faassen wrote:

> Hi there,
>
> Normally setuptools is installed system-wide. When you install an egg
> using easy_install, the egg itself can count on setuptools being
> available, and use for instance its resource management API and
> namespace package marking facility. It therefore is unnecessary to  
> users
> to mark setuptools as a dependency to their eggs in setup.py. Since  
> it's
> unnecessary, it'll just not be done.
>
> This works fine in the case of system-wide installation of setuptools,
> but when installing eggs locally, such as in Buildout, this can  
> lead to
> problems. Buildout makes sure that only eggs that are dependencies are
> importable when starting up a script. An egg that is depending on
> setuptools implicitly will therefore not have access to setuptools
> facilities.

Note that the scripts generated by zc.buildout don't use  
pkg_resources to determine the eggs to be loaded at run time.  The  
needed eggs are computed at install time and their locations are  
written into the script.  If a script doesn't need setuptools (as  
determined from egg dependencies), then setuptools is not included in  
the script path.  Unfortunately, many eggs that do import  
pkg_resurces or setuptools don't bother to list setuptools as a  
dependency.

> Telling everybody who makes eggs that use setuptools to please take
> Buildout into account and include setuptools as an explicit dependency
> in setup.py seems like a hopeless exercise, as things will just plain
> work for most egg users and developers, at least until the possible
> eventuality of Buildout reaching critical mass in the community.

I would put this differently.  I would ask people to be accurate  
about their dependencies rather than implicitly assuming that  
setuptools is around.

> What would work for Buildout, and as far as I can see does no harm to
> everybody else, is to make setuptools an implicit dependency of all
> eggs. It won't affect anyone else (but for a hopefully tiny  
> performance
> impact) as setuptools is definitely available on the system when
> installing the egg through easy_install anyway.

setuptools is avaialble to buildout, because buildout uses it.  The  
small downsides of making setuptools an implicit dependency of every  
egg is that:

- setuptools will be included in the path of every script even when  
not needed.  This probably has a tiny performance penalty.

- setuptools will be downloaded an installed in some cases where it  
isn't needed.  zc.buildout can install scripts for versions of Python  
other than that used to run zc.buildout.  For example, you could run  
zc.buildout with Python2.4 and asl it to install a Python 2.3  
script.  We actually do this on occasion when we use buildout to  
install applications that don't support Python 2.4. These  
applications generally don't use setuptools, but I might still have  
to install setuptools just because we consider every egg, implicitly  
to depending on it.

These downsides are, in practice, pretty minor.  My main objection is  
that I don't like encouraging people to be sloppy about  
dependencies.  The counter argument, of course, is that the standard  
library is an implicit dependency and we are behaving as if  
setuptools is part of the standard library.


> So, would this be something that could be added to setuptools?

Nothing would have to change in setuptools.  If we agree that  
setuptools is an implicit requirement of every egg, even if the egg  
never imports anything from the setuptools egg, then I'll modify  
zc.buildout to include setuptools in the path of every script.

Jim

--
Jim Fulton                      mailto:[EMAIL PROTECTED]                Python 
Powered!
CTO                             (540) 361-1714                  
http://www.python.org
Zope Corporation        http://www.zope.com             http://www.zope.org



_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to