[Distutils] PEP 345, 566, 508 version specifiers and OR clauses

Ivan Pozdeev vano at mail.mipt.ru
Thu Dec 14 02:51:09 EST 2017



On 14.12.2017 5:25, Nathaniel Smith wrote:
> On Wed, Dec 13, 2017 at 6:11 PM, Ivan Pozdeev via Distutils-SIG
> <distutils-sig at python.org> wrote:
>>
>> On 14.12.2017 3:17, Barry Warsaw wrote:
>>> I'm about to release a new version of importlib_resources, so I want to
>>> get my flit.ini's require-python clause right.  We support Python 2.7,
>>> and 3.4 and beyond.  This makes me sad:
>>>
>>> requires-python = '>=2.7,!=3.0,!=3.1,!=3.2,!=3.3'
>>>
>>> Of course, I'd like to write this like:
>>>
>>> requires-python = '(>=2.7 and <3) or >= 3.4'
>>>
>>> I understand that OR clauses aren't supported under any syntax
>>> currently, but as PEPs 566 and 508 are still open/active, wouldn't it be
>>> reasonable to support something like this explicitly?
>>>
>>> It seems like wanting to support 2.7 and some versions of Python 3 (but
>>> not all) is a fairly common need.
>> What you're actually asking for is for the >= operator to be limited to a
>> specified major version.
> We actually have the ~= operator that's basically that-- not sure if
> it's allowed in requires-python. But that's not sufficient. You also
> need an "or" primitive if you want to express "~= 2.7 or ~= 3.4".
> Right now all you could write is "~= 2.7 and ~= 3.4", which is the
> null set :-).
With the aforementioned semantic versioning, a "natural" version 
specifier would be:

* a disjuction of major versions (probably a range),
* with each one of them possibly accompanied by a conjuction of minor 
versions.

So, yes, for this, an `or' and superposition (arbitrary or otherwise) 
are absolute requirements.

-- 
Regards,
Ivan



More information about the Distutils-SIG mailing list