Buildout: Recipes with extras

Automatic installation of eggs required by an egg extra doesn't seem to work for a recipe used with zc.buildout as documented for eggs in general:
Suppose myrecipe has two entry points, the "fancy" one employing yourrecipe. Now if I declare yourrecipe as an extra requirement only to be installed if the "fancy" entry point is used to install any buildout part:
myrecipe/setup.py:
...
setup(... entry_points={"zc.buildout": [ "default = myrecipe.foo:Recipe", "fancy = myrecipe.bar:Recipe [bar_extra]", ]}, extras_require={"bar_extra": ["yourrecipe"]}, ... )
and use myrecipe I get a pkg_resources.DistributionNotFound error concerning yourrecipe. It sort of works if I manually copy the yourrecipe egg to the eggs directory beforehand, though.
Is this a real bug, or are recipes supposed to be so simple as to not need extras?

At 09:19 PM 2/15/2007 +0100, Thomas Lotze wrote:
Automatic installation of eggs required by an egg extra doesn't seem to work for a recipe used with zc.buildout as documented for eggs in general:
Suppose myrecipe has two entry points, the "fancy" one employing yourrecipe. Now if I declare yourrecipe as an extra requirement only to be installed if the "fancy" entry point is used to install any buildout part:
myrecipe/setup.py:
...
setup(... entry_points={"zc.buildout": [ "default = myrecipe.foo:Recipe", "fancy = myrecipe.bar:Recipe [bar_extra]", ]}, extras_require={"bar_extra": ["yourrecipe"]}, ... )
and use myrecipe I get a pkg_resources.DistributionNotFound error concerning yourrecipe. It sort of works if I manually copy the yourrecipe egg to the eggs directory beforehand, though.
Is this a real bug, or are recipes supposed to be so simple as to not need extras?
Distributions required by entry points aren't automatically installed; the code loading the entry point has to pass an 'installer' function to the loading API in order to support installation-on-demand. Presumably zc.buildout doesn't do this. An example from setuptools' own code:
for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'): value = getattr(self,ep.name,None) if value is not None: ep.require(installer=self.fetch_build_egg) ep.load()(self, ep.name, value)
This code loads entry points for any setup() keywords that match the entry point name, and in the process it will install any extras required by the entry point.
In setuptools 0.7, I plan to add a feature to make it easier to do this, at least for pure-Python built eggs found on the CheeseShop. pkg_resources will have some class or function you'll be able to pass as the 'installer', and it will use CheesesShop XML-RPC to find and download the eggs to the PYTHON_EGG_CACHE directory. That way, people who want to support an easy and (relatively) safe install-on-demand feature can do so without having to write their own installer package. It won't offer all the bells-and-whistles of easy_install, but that's actually an advantage for this use case, methinks.

On Feb 15, 2007, at 3:40 PM, Phillip J. Eby wrote:
At 09:19 PM 2/15/2007 +0100, Thomas Lotze wrote:
Automatic installation of eggs required by an egg extra doesn't seem to work for a recipe used with zc.buildout as documented for eggs in general:
Suppose myrecipe has two entry points, the "fancy" one employing yourrecipe. Now if I declare yourrecipe as an extra requirement only to be installed if the "fancy" entry point is used to install any buildout part:
myrecipe/setup.py:
...
setup(... entry_points={"zc.buildout": [ "default = myrecipe.foo:Recipe", "fancy = myrecipe.bar:Recipe [bar_extra]", ]}, extras_require={"bar_extra": ["yourrecipe"]}, ... )
and use myrecipe I get a pkg_resources.DistributionNotFound error concerning yourrecipe. It sort of works if I manually copy the yourrecipe egg to the eggs directory beforehand, though.
Is this a real bug, or are recipes supposed to be so simple as to not need extras?
Distributions required by entry points aren't automatically installed; the code loading the entry point has to pass an 'installer' function to the loading API in order to support installation-on-demand. Presumably zc.buildout doesn't do this.
Thomas, I suggest you report this as a buildout bug at:
https://bugs.launchpad.net/zc.buildout/+bugs
Jim
-- Jim Fulton mailto:jim@zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org

Am Thu, 15 Feb 2007 15:56:31 -0500 schrieb Jim Fulton:
Thomas, I suggest you report this as a buildout bug at:
Done.

Am Thu, 15 Feb 2007 15:40:36 -0500 schrieb Phillip J. Eby:
Distributions required by entry points aren't automatically installed;
I see.
the code loading the entry point has to pass an 'installer' function to the loading API in order to support installation-on-demand. Presumably zc.buildout doesn't do this.
But neither does easy_install if I got this right: It's possible to install a distribution without its extra dependencies so that this distribution's scripts which need an extra fail when run. Why does easy_install install these scripts at all when it is to install the distribution without the respective necessary extras?
It won't offer all the bells-and-whistles of easy_install, but that's actually an advantage for this use case, methinks.
I wonder why all of the easy_install functionality isn't formulated as a package that others, including zc.buildout and your setuptools 0.7 installer function, can use. I wouldn't be surprised if the answer is that I should read some more of the sources, though ;o)

At 01:01 AM 2/17/2007 +0100, Thomas Lotze wrote:
It's possible to install a distribution without its extra dependencies so that this distribution's scripts which need an extra fail when run. Why does easy_install install these scripts at all when it is to install the distribution without the respective necessary extras?
Because if it were to install the extras, this would mean they're not "extra" any more, so they should be in the project's main dependencies. It's not a perfect solution, but it seemed the least-damaging default.
I wonder why all of the easy_install functionality isn't formulated as a package that others, including zc.buildout and your setuptools 0.7 installer function, can use.
Because it started out as an extremely short and relatively simple script and only gradually evolved into the gigantic mess it is today. 0.7 is when the refactoring back into reusable pieces will happen.

Am Fri, 16 Feb 2007 19:14:31 -0500 schrieb Phillip J. Eby:
Because if it were to install the extras, this would mean they're not "extra" any more, so they should be in the project's main dependencies. It's not a perfect solution, but it seemed the least-damaging default.
No, my suggestion was not to install extras by default (which of course would lead them ad absurdum) but to not install those scripts that depend on extras not being installed.
Because it started out as an extremely short and relatively simple script and only gradually evolved into the gigantic mess it is today. 0.7 is when the refactoring back into reusable pieces will happen.
Good thing :o)
participants (3)
-
Jim Fulton
-
Phillip J. Eby
-
Thomas Lotze