[Distutils] PEP440: >1.7 vs >=1.7
Nick Coghlan
ncoghlan at gmail.com
Mon Dec 29 23:57:07 CET 2014
On 30 December 2014 at 05:09, Chris Jerdonek <chris.jerdonek at gmail.com>
wrote:
> On Mon, Dec 29, 2014 at 12:01 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> > * for those cases (like date-based versions) where excluding releases
> with
> > an additional numeric suffix is the right thing to do, an explicit prefix
> > exclusion will still be possible, and will have the advantage of failing
> > noisily on older versions of pip and easy_install, rather than silently
> > installing an unexpected version (which is what will happen for anyone
> that
> > starts relying on the current explicit exclusion in PEP 440). It's also
> > possible to replace the exclusive bound with an inclusive bound that has
> the
> > last release segment component incremented.
>
> Just to confirm, in each of the below is it true that the two
> comparisons are exactly equivalent (taking into account pre-release
> and post-release rules, etc)?
>
> 1) >V.N.* and >=V.N+1
> 2) <=V.N.* and <V.N+1
>
If you omit the trailing ".*" (which isn't part of PEP 440 in the context
of ordered comparisons), then the following are equivalent in the currently
published version of the PEP:
1) "> V.N" and ">= V.N+1"
2) "<= V.N" and "< V.N+1"
The current behaviour of those exclusive comparisons is the part that's
both incompatible with the previous behaviour of setuptools/pkg_resources,
and somewhat confusing (largely because the interaction between the zero
padding and the negative prefix matching means that the trailing zero in
the release segment effectively isn't implied when comparing against
maintenance releases).
Donald's proposed adjustment at
https://github.com/pypa/interoperability-peps/pull/3 (which I now agree
with) changes them to be different: unlike ">= V.N+1", "> V.N" will once
again allow "V.N.x" maintenance releases, as it did in
setuptools/pkg_resources releases prior to 8.0.
The exclusive ordered comparison behaviour in the originally accepted
version of the PEP can still be requested explicitly as "< V, != V.*" and
"> V, != V.*" (where the latter has the virtue of failing noisily on older
versions of pkg_resources, rather than silently referring to a different
minimum version).
And these two should be even easier:
>
> 3) <V.* and <V
> 4) >=V.* and >=V
>
> With the way the PEP is written, it's not completely obvious to me
> that these are true.
>
In a hypothetical future version of the PEP that allowed the ".*" wildcard
suffix for ordered comparisons, it would likely have the following
semantics:
"< V.*" ==> "< V, != V.*"
"> V.*" ==> "> V, != V.*"
"<= V.*" ==> "<= V"
">= V.*" ==> ">= V"
However, it's not clear that such an addition would be worth it, given the
updated definition of exclusive comparisons, and the availability of the
more explicit spelling.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20141230/3813fdf6/attachment.html>
More information about the Distutils-SIG
mailing list