On 11 May 2015 at 17:14, Robert Collins <[email protected]> wrote:
> https://www.python.org/dev/peps/pep-0426/#extras-optional-dependencies
>
> Gives an example of:
>
> "name": "ComfyChair",
> "extras": ["warmup", "c-accelerators"]
> "run_requires": [
>   {
>     "requires": ["SoftCushions"],
>     "extra": "warmup"
>   }
> ]
> "build_requires": [
>   {
>     "requires": ["cython"],
>     "extra": "c-accelerators"
>   }
> ]
>
>
> But I am not sure how to map the current setuptools example below to PEP-426:
>
> extras_require={
>     'warmup': ['softcushions', 'barheater'],
>     'c-accelerators': ['cython', 'barheater'],
>     }
>
> Would we expect multiple build_requires that list barheater, with
> separate extra lines, in PEP-426?
>
> Like so (adjusted to be all run-requires as extra setup-requires
> aren't a thing in setuptools today):
> "name": "ComfyChair",
> "extras": ["warmup", "c-accelerators"]
> "build_requires": [
>   {
>     "requires": ["SoftCushions","barheater"],
>     "extra": "warmup"
>   }
> ]
> "build_requires": [
>   {
>     "requires": ["cython", "barheater"],
>     "extra": "c-accelerators"
>   }
> ]
>
> Since build_requires is a key, I'm more than a little confused here.
> Seems like the extra has to be part of the key, or we're going to be
> uhm, stuck.

You're close, you just need to rely on the fact that build_requires is
a sequence rather than a single mapping:

"build_requires": [
  {
    "requires": ["SoftCushions","barheater"],
    "extra": "warmup"
  },
  {
    "requires": ["cython", "barheater"],
    "extra": "c-accelerators"
  }
]

That's also how you mix unconditional dependencies with conditional
ones, as well as apply environmental constraints to dependencies
included in an extra. I don't currently have any examples of mixing
and matching in the PEP, but it's *already* a monster document :(

Cheers,
Nick.

-- 
Nick Coghlan   |   [email protected]   |   Brisbane, Australia
_______________________________________________
Distutils-SIG maillist  -  [email protected]
https://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to