[Distutils] extras in PEP-426
Daniel Holth
dholth at gmail.com
Mon May 11 16:04:07 CEST 2015
bdist_wheel tries to convert setuptools' own requirements into PEP 426
(draft) json metadata and writes it to .dist-info/. However because
the document is draft the JSON metadata is not used for anything. The
runtime requirements read:
"run_requires": [
{
"extra": "certs",
"requires": [
"certifi (==1.0.1)"
]
},
{
"environment": "sys_platform=='win32'",
"extra": "ssl",
"requires": [
"wincertstore (==0.2)"
]
}
],
On Mon, May 11, 2015 at 6:39 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On 11 May 2015 at 17:14, Robert Collins <robertc at robertcollins.net> 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 | ncoghlan at gmail.com | Brisbane, Australia
> _______________________________________________
> Distutils-SIG maillist - Distutils-SIG at python.org
> https://mail.python.org/mailman/listinfo/distutils-sig
More information about the Distutils-SIG
mailing list