[Distutils] Need for ability to limit dependencies similar to 'extras'

Jason R. Coombs jaraco at jaraco.com
Wed Sep 1 13:53:29 CEST 2010

We're using setuptools for packaging our Python projects. Several of our 
projects have a server/client aspect to them, where the server is a 
full-fledged service with a lot of dependencies and the client is just an API 
for accessing the server, probably with just a few dependencies.  We want a 
way to install the package with or without these dependencies. With the 
current implementation of setuptools, I believe we have two choices.

1) Refactor the package into three packages: project_server, project_client, 
and project_common. Project_server would then contain the additional 
2) Use the extras_require for the server facet of the project. So 
"easy_install project" installs the common dependencies and "easy_install 
project[server]" installs the additional dependencies.

The second option is what we're using, but the [server] facet is the most 
common usage. We would prefer instead to have a way to "easy_install 
project[client]" which would _limit_ the dependencies needed, and 
"easy_install project" would install the full set of dependencies.

Has anyone heard of a plugin which does this? Is it even possible that a 
plugin could trim out dependencies?

I can see how there are at least three approaches to this plugin:

1) Continue to define the additional requirements as extras, and then have 
another parameter that selects the extras implicitly unless 'client' is 
specified. I'm thinking of something like a "requires_extras_unless = 
{'client': 'server'}"
2) Have another parameter which re-lists those requirements which are not 
required when project[client] is used.
3) Extend extras_require to allow keys such as '-client' or '!client', whose 
values are only required if client is not specified.

I can forsee how any of these approaches could get messy and break lots of 
assumptions about how extras and project dependencies are used. Any thoughts?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6448 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20100901/d98a2f2a/attachment.bin>

More information about the Distutils-SIG mailing list