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

Nathaniel Smith njs at pobox.com
Wed Dec 13 21:25:32 EST 2017


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 :-).

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Distutils-SIG mailing list