[Distutils] setuptools extras_require

Jorge Vargas jorge.vargas at gmail.com
Tue Dec 12 16:21:45 CET 2006

On 12/10/06, Phillip J. Eby <pje at telecommunity.com> wrote:
> At 08:28 PM 12/10/2006 +0100, Elvelind Grandin wrote:
> >Is there any way to exclude packages in extras_require as opposed to
> >just include them. In Turbogears we have Sqlobject in by default. but
> >if the extra "future" is used it should drop SO and install sqlalchemy
> >instead.
I'm not sure if extras is the correct way to do this, since the
current TG setup is I want sqlobject OR sqlalchemy, extras is more
like addons. maybe it will need a bigger structure to handle it.

> Not currently, no.  Do you have any suggestions as to how this might be
> spelled in the requirements API?
I like the way gentoo handles it on portage. there is this thing call
"use flags" which are just a label everyone agrees on it's meaning.

so the tg package will have something like IUSE="sqlobject sqlalchemy"

so in setup() under install_requires
it will do a check like
sqlobject? ("SQLObject >= 0.7.1,<=0.7.99")
sqlalchemy? ("SQLAlchemy >= 0.3")

then (and setuptools doesn't has this) on the pre_install() function
you will have something like.
if not sqlalchemy in params:
set sqlobject as default.

and of course sqlobject or sqlalchemy needs to be pass in to determine
what you need.

now portage is a bigger system since it's supposed to handle
compilation of any languaje and USE flags where an abstraction to
c/makefile variables to provide the --with,--with-out,etc. I'm not
sure if this is a feature python/setuptools needs right now but in the
future we'll see many more packages depending on optional backends. or
interchangable components.

just my 2cents
> _______________________________________________
> Distutils-SIG maillist  -  Distutils-SIG at python.org
> http://mail.python.org/mailman/listinfo/distutils-sig

More information about the Distutils-SIG mailing list