<p dir="ltr"><br>
On 28 Dec 2014 17:12, "Donald Stufft" <<a href="mailto:donald@stufft.io">donald@stufft.io</a>> wrote:<br>
><br>
><br>
>> On Dec 27, 2014, at 9:26 PM, Donald Stufft <<a href="mailto:donald@stufft.io">donald@stufft.io</a>> wrote:<br>
>><br>
>><br>
>>> On Dec 27, 2014, at 9:10 PM, Marcus Smith <<a href="mailto:qwcode@gmail.com">qwcode@gmail.com</a>> wrote:<br>
>>><br>
>>>> In gives me a minor bit of pause. However any alternative that I can come up<br>
>>>> with bothers me more, especially since I don't believe many people actually<br>
>>>> even *use* a bare > and any alternative I can come up with has worse behavior<br>
>>>> for operators which get much more use.<br>
>>><br>
>>><br>
>>> what about making >=,<= also use the series concept? where does that go wrong?<br>
>>><br>
>><br>
>> To be clear, you’re talking about doing something like:<br>
>><br>
>> >1.7 is >1.7 AND !=1.7.* which would correlate to >1.7 OR ==1.7.*?<br>
>><br>
>> Honestly, the thing that I dislike about that is it takes a behavior which is<br>
>> less intuitive (I do agree that the behavior of > is less intuitive) and<br>
>> applies to globally. I don't think people would expect >=1.7 to match 1.7.dev0<br>
>> and given that I don't think people would expect >=1.7.0 to _not_match<br>
>> 1.7.dev0.<br>
>><br>
>> I totally agree that the behavior of > isn't the greatest, I don't think the<br>
>> solution to that problem is to globally apply that particular wart. The only<br>
>> *reasonable* solutions I can think of are:<br>
>><br>
>> 1. Make < and > both act as simple comparison operators, and have >1.7 and<br>
>>    >1.7.0 both allow 1.7.1. This would include also allowing 1.7.dev0 to be<br>
>>    <1.7 and <1.7.0.<br>
>><br>
>> 2. Make < and > both act as "exclusive comparison operators", and which is<br>
>>    the current behavior.<br>
>><br>
>> 3. Make < and > both act as simple comparison operators, but include a special<br>
>>    case that < does not ever match pre-releases of the version mentioned in<br>
>>    the specifier. So <3 would not match a pre-released like 3.dev0, and <3.1<br>
>>    would not match a pre-release like 3.1.dev0 but would match a pre-release<br>
>>    like 3.0.dev0.<br>
>><br>
>> It may be that the correct solution is to just treat pre-releases as special<br>
>> and just switch to 3.<br>
>><br>
><br>
> After thinking about this some more, I made a PR that adjusts the packaging<br>
> library so that is has semantics which might be better overall than what is<br>
> currently in PEP 440. This PR is at <a href="https://github.com/pypa/packaging/pull/25">https://github.com/pypa/packaging/pull/25</a><br>
> if someone wants to play with it at all, but the highlights are:<br>
><br>
> * 1.7.1 matches >1.7 (previously it did not)</p>
<p dir="ltr">This sounds like a straight up bug fix in the packaging module to me - the PEP 440 zero padding should apply to *all* checks, not just to equality checks, as you can't sensibly compare release segments with different numbers of elements.</p>
<p dir="ltr">Hence this sentence in the description of the release segment under the "Final releases" heading: "When comparing release segments with different numbers of components, the shorter segment is padded out with additional zeros as necessary."</p>
<p dir="ltr">The zero padding does get called out again explicitly in the section on version matching, but that's in the context of explaining why "== 1.7" will match "1.7.0" and vice-versa, even though version matching is otherwise strict.</p>
<p dir="ltr">> * 1.7.post1 does not match >1.7 (previously it did not)<br>
> * 1.7.post1 matches >1.7.post0 (previously it did)<br>
> * 3.dev0 does not match <3.0 (previously it did)</p>
<p dir="ltr">This is another bug fix - avoiding that match is one of the key reasons for the wildcard exclusion in the definition of the exclusive comparison operators.</p>
<p dir="ltr">Given the next bullet point, it sounds like this may have been another symptom of incorrectly limiting the release segment zero padding to version matching operations.</p>
<p dir="ltr">> * 3.0.dev0 does not match <3.0 (previously it did not)<br>
> * 3.0.dev0 matches <3.0rc1 (previously it did)<br>
><br>
> Instead of having >V and <V impliy !=V.*, this means that:<br>
><br>
> 1. A <V does not match a pre-release of V unless V is itself a pre-release.<br>
> 2. A >V does not match a post-release of V unless V is itself a post-release.<br>
> 3. A >V does not match a V+local.version.</p>
<p dir="ltr">Please don't make the change more complicated than it needs to be - there's just a bug in the packaging implementation of the PEP semantics. Zero padding of the release segment should be applied to all operations, and that currently isn't happening.</p>
<p dir="ltr">Regards,<br>
Nick.</p>