[Distutils] What is the syntax for passing conditional non-extra dependencies in setuptools?

Daniel Holth dholth at gmail.com
Mon Apr 7 22:03:01 CEST 2014


OK, it does in fact work that way; empty-string-before-colon specifies
a default requirement with a marker.

Parses out to the following _dep_map with 'None' representing 'not an
extra dependency':

{None: [Requirement.parse('coding'), Requirement.parse('stuff')],
 'quux': [Requirement.parse('more-stuff')]}

requirements.txt:

coding

[:sys_platform=='linux2']
stuff

[quux:sys_platform=='linux2']
more_stuff


On Mon, Apr 7, 2014 at 3:09 PM, Daniel Holth <dholth at gmail.com> wrote:
> I think setuptools' :-separated environment markers mechanism is
> great, and shouldn't need to be ratified anywhere. I also think the
> actual environment markers specification is stable, although I noticed
> the IPython wheel for example is using the deprecated .-separated
> rather than _-separated identifiers.
>
> These kinds of conditionals are obviously an important feature for
> wheel and replace a common if/else statement inside setup.py, but can
> only be specified in wheels by placing a copy of the requirements in
> setup.cfg. It would be better if bdist_wheel could also just translate
> the setuptools requirements.txt to its own format.
>
> I assume extras_require = { ":sys_platform='win32'" :
> "wincertstore==0.2" } would be likely to specify a non-extra (the
> extra named '' or None?) dependency?
>
>
> On Thu, Mar 27, 2014 at 2:39 PM, PJ Eby <pje at telecommunity.com> wrote:
>> On Wed, Mar 26, 2014 at 11:29 PM, Daniel Holth <dholth at gmail.com> wrote:
>>>
>>> How do I specify a conditional (marker-guarded) non-extra dependency
>>> in setuptools? The syntax for a conditional extra dependency is
>>> currently:
>>>
>>>     extras_require = {
>>>         "ssl:sys_platform=='win32'": "wincertstore==0.2",
>>>         "certs": "certifi==1.0.1",
>>>     },
>>
>>
>> I only implemented support via extras, and the feature wasn't officially
>> supported (still isn't, I don't think) because the PEP specifying the syntax
>> wasn't fully baked yet.  I figured that if *only* setuptools itself used it,
>> then if the syntax changed only setuptools would break...  but fix itself at
>> the same time.
>>
>> The same cannot be said for any other package, so use at your own risk.  Or
>> better yet, don't use it.  ;-)
>>
>> (At least, not until it's a documented feature w/a PEP-approved syntax.)
>>
>>
>>> _______________________________________________
>>> Distutils-SIG maillist  -  Distutils-SIG at python.org
>>> https://mail.python.org/mailman/listinfo/distutils-sig
>>
>>


More information about the Distutils-SIG mailing list