[Distutils] conditional external packages dependancies with setuptools

Phillip J. Eby pje at telecommunity.com
Sat Jun 24 21:59:50 CEST 2006


At 01:29 PM 6/24/2006 -0400, Jorge Vargas wrote:
>On 6/24/06, Phillip J. Eby 
><<mailto:pje at telecommunity.com>pje at telecommunity.com> wrote:
>>At 03:04 AM 6/24/2006 -0400, Jorge Vargas wrote:
>> >but What I want to accomplish is having dependancies on some packages. for
>> >example my project will have diferent database backends so I want to
>> >depend on pysqlite or mysql-python depending on which the user wants as
>> >his/her backend. I'm going to have lots of diferent backends, even some
>> >that are not databases, so this will be a crutial thing for me or I'll end
>> >up with very big dist files per release, which will mostly be waste if the
>> >user never uses them.
>> >
>> >is something like this possible with setuptools now?
>>
>>Yes:
>>
>><http://peak.telecommunity.com/DevCenter/setuptools#declaring-extras>http://peak.telecommunity.com/DevCenter/setuptools#declaring-extras 
>>
>
>there it says that I can set  them and then project depending on mine will 
>be able to add them to their install_required, but what I want is my 
>project to have it optional
>
>there is a reference that they can be pass as commands to easy_install but 
>can't find the switch at 
><http://peak.telecommunity.com/DevCenter/EasyInstall#command-line-options>http://peak.telecommunity.com/DevCenter/EasyInstall#command-line-options

If you have an optional feature called "bar" for your package named "foo", 
you would use:

     easy_install foo[bar]

if there's also a "baz" feature and the user wants to install that too, 
they can use:

     easy_install foo[bar,baz]


>I'm looking at something like the gentoo's USE flags system. where I can 
>have a script or config file that each install will use with the optional 
>packages they want, and distribute that with a sane number of defaults.

I'm not familiar with this, although it sounds like something that might be 
useful to add in future.  Presumably this could be done by standardizing 
names of "extras" and then having an option for easy_install (which then 
would be configurable via the normal distutils config files).  I'll keep 
that in mind for 0.7.



More information about the Distutils-SIG mailing list