[Distutils] setup.cfg new format proposal

Sridhar Ratnakumar sridharr at activestate.com
Fri Sep 18 00:46:06 CEST 2009


On Thu, 17 Sep 2009 07:05:46 -0700, Tarek Ziadé <ziade.tarek at gmail.com>  
wrote:

> On Thu, Sep 17, 2009 at 3:53 PM, P.J. Eby <pje at telecommunity.com> wrote:
>> At 12:41 PM 9/17/2009 +0200, Tarek Ziadé wrote:
>>>
>>> Also, if I understand clearly the idea, I find it rather cryptic to
>>> add conditions to each dependency
>>> like what Sridhar has shown.
>>
>> That's actually not how it would work; you simply put section headings
>> inside the extras_require field, rather than having multiple sections in
>> setup.cfg.  Then, the "static metadata" is just the existing PKG-INFO
>> format.
>>
>
> could you provide a full example, taking back theses thread examples ?

I think PJE was referring to something like this:

$ cat foo.egg-info/requires.txt
argparse
lxml

[tests]
nose

[python-lt-26]
multiprocessing

[platform-eq-win32]
pywin32

which is defined in setup.py like this:

$ cat setup.py
[...]
setup(
   [...]
   install_requires['argparse', 'lxml'],
   extras_require={'tests': ['nose'],
                   'python-lt-26': ['multiprocessing'],
                   'platform-eq-win32': ['pywin32']}
   [...]
)

Currently you have to manually specify, say, "easy_install  
foo[platform-eq-win32,python-lt-26]" if you are installing on Windows  
Python 2.5. But with a little modification, this can be made automatic.  
Zope packages makes use of this kind of 'extras' feature a lot .. eg:  
"easy_install foo[tests]" would also install nose.

Setuptools already has this feature. I suggest we make this a standard of  
doing things and extend the extras syntax to implement conditional  
dependencies.


-srid


More information about the Distutils-SIG mailing list