<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 27, 2014, at 9:26 PM, Donald Stufft <<a href="mailto:donald@stufft.io" class="">donald@stufft.io</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 27, 2014, at 9:10 PM, Marcus Smith <<a href="mailto:qwcode@gmail.com" class="">qwcode@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class=""><span class=""></span><div class=""><div class="">In gives me a minor bit of pause. However any alternative that I can come up</div><div class="">with bothers me more, especially since I don't believe many people actually</div><div class="">even *use* a bare > and any alternative I can come up with has worse behavior</div><div class="">for operators which get much more use.</div></div></div></blockquote><div class=""><br class=""></div><div class="">what about making >=,<= also use the series concept? where does that go wrong?<br class=""></div><br class=""></div>
</div></blockquote></div><div class=""><br class=""></div><div class="">To be clear, you’re talking about doing something like:</div><div class=""><br class=""></div><div class="">>1.7 is >1.7 AND !=1.7.* which would correlate to >1.7 OR ==1.7.*?</div><div class=""><br class=""></div><div class=""><div class="">Honestly, the thing that I dislike about that is it takes a behavior which is</div><div class="">less intuitive (I do agree that the behavior of > is less intuitive) and</div><div class="">applies to globally. I don't think people would expect >=1.7 to match 1.7.dev0</div><div class="">and given that I don't think people would expect >=1.7.0 to _not_match</div><div class="">1.7.dev0.</div><div class=""><br class=""></div><div class="">I totally agree that the behavior of > isn't the greatest, I don't think the</div><div class="">solution to that problem is to globally apply that particular wart. The only</div><div class="">*reasonable* solutions I can think of are:</div><div class=""><br class=""></div><div class="">1. Make < and > both act as simple comparison operators, and have >1.7 and</div><div class=""> >1.7.0 both allow 1.7.1. This would include also allowing 1.7.dev0 to be</div><div class=""> <1.7 and <1.7.0.</div><div class=""><br class=""></div><div class="">2. Make < and > both act as "exclusive comparison operators", and which is</div><div class=""> the current behavior.</div><div class=""><br class=""></div><div class="">3. Make < and > both act as simple comparison operators, but include a special</div><div class=""> case that < does not ever match pre-releases of the version mentioned in</div><div class=""> the specifier. So <3 would not match a pre-released like 3.dev0, and <3.1</div><div class=""> would not match a pre-release like 3.1.dev0 but would match a pre-release</div><div class=""> like 3.0.dev0.</div><div class=""><br class=""></div><div class="">It may be that the correct solution is to just treat pre-releases as special</div><div class="">and just switch to 3.</div></div><br class=""></div></div></blockquote><br class=""></div><div><div>After thinking about this some more, I made a PR that adjusts the packaging</div><div>library so that is has semantics which might be better overall than what is</div><div>currently in PEP 440. This PR is at <a href="https://github.com/pypa/packaging/pull/25" class="">https://github.com/pypa/packaging/pull/25</a></div><div>if someone wants to play with it at all, but the highlights are:</div><div><br class=""></div><div>* 1.7.1 matches >1.7 (previously it did not)</div><div>* 1.7.post1 does not match >1.7 (previously it did not)</div><div>* 1.7.post1 matches >1.7.post0 (previously it did)</div><div>* 3.dev0 does not match <3.0 (previously it did)</div><div>* 3.0.dev0 does not match <3.0 (previously it did not)</div><div>* 3.0.dev0 matches <3.0rc1 (previously it did)</div><div><br class=""></div><div>Instead of having >V and <V impliy !=V.*, this means that:</div><div><br class=""></div><div>1. A <V does not match a pre-release of V unless V is itself a pre-release.</div><div>2. A >V does not match a post-release of V unless V is itself a post-release.</div><div>3. A >V does not match a V+local.version.</div><div><br class=""></div><div>Implicitly these three rules are also true, but they are true because of the</div><div>ordered nature of the versions and the mathemtical meaning of > and < rather</div><div>than any rule mentioned in the PEP:</div><div><br class=""></div><div>4. A <V does not match a post-release of V unless V is itself a post-release.</div><div>5. A >V does not match a pre-release of V unless V is itself a pre-release.</div><div>6. A <V does not match a V+local.version.</div><div><br class=""></div><div>If you check out my branch, you can play around with the specifier rules as</div><div>I've implemented them now by just doing:</div><div><br class=""></div><div> >>> from packaging.specifiers import SpecifierSet</div><div> >>> SpecifierSet(">1.7").contains("1.7.1", prereleases=True)</div><div> True</div><div> >>> SpecifierSet(">1.7").contains("1.7.post1", prereleases=True)</div><div> False</div><div> >>> SpecifierSet(">1.7.post0").contains("1.7.post1", prereleases=True)</div><div> True</div><div> >>> SpecifierSet(">1.7").contains("1.7+thing.1", prereleases=True)</div><div> False</div><div> >>> SpecifierSet("<3.0.0").contains("3.0.dev0", prereleases=True)</div><div> False</div><div> >>> SpecifierSet("<3").contains("3.0.dev0", prereleases=True)</div><div> False</div><div> >>> SpecifierSet("<3rc1").contains("3.0.dev0", prereleases=True)</div><div> True</div><div><br class=""></div><div>Does this better match your expectations? I think I might like these rules</div><div>better as they handle zero padding similarly to ==, !=, >=, and <= (sans when</div><div>== and != have a .*) which means that a rule like <3.0 won't accept 3.dev0</div><div>even though the current PEP means that it does. I think it also follows along</div><div>better with what people expect both for > and for <.</div></div><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">---</div><div class="">Donald Stufft</div><div class="">PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA</div></div></div>
</div>
<br class=""></body></html>