[Distutils] setuptools: 'console_scripts' does not respect 'extras' requested by easy_install?

P.J. Eby pje at telecommunity.com
Thu Aug 5 20:51:46 CEST 2010


At 11:25 AM 8/5/2010 -0700, Sridhar Ratnakumar wrote:
> From setup.py:
>
>     [...]
>     name='hello'
>     [...]
>     entry_points = {
>       'console_scripts': [
>         'hello=hello:main',
>         'internal=hello.internal:main [secret]',
>     [...]
>
>If I run "easy_install hello" both bin/hello and bin/internal are 
>installed. I expected bin/internal to be installed *only* when 
>"easy_install hello[secret]" is run.
>
>Is this anomaly a bug, or by design?

I don't really consider it a bug; more of the absence of a 
feature.  ;-)  I will consider adding it to 0.7.  (Though it will 
more likely be that I will simply issue a warning if the extra(s) 
aren't specified and the requirements aren't already met; in part it 
depends on whether I refactor to add a more transactional installation system.)


>I have a real-world use case for this, which is to install 'backend' 
>scripts only when the 'backend' extras is requested. This is to 
>prevent users from installing backend/server related commands when 
>they only need the client commands. When creating sdist, I 
>explicitly exclude src/hello/internal (internal packages), but there 
>is no way to prevent the script creation other than hacking setup.py.

As a way to implement this in the short run, you could place the 
backend scripts in a separate distribution, and list that in the 
extras.  The other distribution could consist of nothing more than 
the list of entry points, and a requirement that points back to the 
original distribution.



More information about the Distutils-SIG mailing list