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

Ivan Pozdeev vano at mail.mipt.ru
Wed Dec 13 21:11:32 EST 2017



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.

With semantic versioning (which is Python's recommended best practice), 
this is actually a very reasonable thing to do:
specify supported major versions, and for each one (it's more likely to 
be the edge ones), optionally limit minor versions.

If only we could think of a good syntax...

Folks, how problematic would it be to make this the default/enabled with 
a switch?
With only two major versions, I don't expect much breakage, except 
packages like setuptools that don't use semantic versioning.

-- 
Regards,
Ivan



More information about the Distutils-SIG mailing list