[Distutils] [setuptools] conditionally installing scripts based on extras require

Sridhar Ratnakumar sridharr at activestate.com
Mon Aug 17 22:09:40 CEST 2009

I have a setup.py like this:

    extras_require = {'foo': 'pkginfo'},
    entry_points = {'console_scripts': [
      'foo=myapp.foo:main [foo]',

When I do a 'python setup.py install', the package 'pkginfo' is *not*  
installed as expected. However, the script 'foo' *is* installed. This is  
somewhat ironic .. because `foo' as per the definition depends on the  
'foo' feature; yet installing 'myapp' (without 'foo' feature) installs the  
script 'foo'.

1) What is the rationale behind this behavior? setuptools documentation  
reads: "[...] if Project A includes a "rst2pdf" script, it might declare  
it like this, so that the "PDF" requirements are only resolved if the  
"rst2pdf" script is run". Why install a script if the user installed a  
distribution without a particular feature that this script depends on?

2) Is there a workaround to tell setuptools *not* to install scripts  
depending on features not asked for?


More information about the Distutils-SIG mailing list