Narrow <V.postN pre-release exclusion to match spec#1140
Narrow <V.postN pre-release exclusion to match spec#1140notatallshaw merged 1 commit intopypa:mainfrom
Conversation
|
@henryiii I'm trying to assess the impact of this, do you have any way to query dependencies on PyPI? rather than just versions. You would only be impacted in if you wrote
Even after using the GitHub option to remove duplicates (you have to click on it), several of these are just forks, and some of them are under I found no requirement that would in practice produce a different result, e.g. So while I think this change isn't very intuitive, it does match the spec, it makes interval representation significantly simpler, and it appears to have practically no impact on real world scenarios. |
|
Yes, I can, I can try to check this either later today or tomorrow. |
325 Hypothesis tests that verify algebraic invariants from the version specifiers specification. Each test class quotes the spec paragraph it validates. Tests are excluded from coverage and run as a separate CI job via `nox -s property_tests`. Two tests are expected to fail until pypa#1140 and pypa#1141 are merged (exclusive comparison exclusion rules).
325 Hypothesis tests that verify algebraic invariants from the version specifiers specification. Each test class quotes the spec paragraph it validates. Tests are excluded from coverage and run as a separate CI job via `nox -s property_tests`. Two tests are expected to fail until pypa#1140 and pypa#1141 are merged (exclusive comparison exclusion rules).
325 Hypothesis tests that verify algebraic invariants from the version specifiers specification. Each test class quotes the spec paragraph it validates. Tests are excluded from coverage and run as a separate CI job via `nox -s property_tests`. Two tests are expected to fail until pypa#1140 and pypa#1141 are merged (exclusive comparison exclusion rules).
325 Hypothesis tests that verify algebraic invariants from the version specifiers specification. Each test class quotes the spec paragraph it validates. Tests are excluded from coverage and run as a separate CI job via `nox -s property_tests`. Two tests are expected to fail until pypa#1140 and pypa#1141 are merged (exclusive comparison exclusion rules).
325 Hypothesis tests that verify algebraic invariants from the version specifiers specification. Each test class quotes the spec paragraph it validates. Tests are excluded from coverage and run as a separate CI job via `nox -s property_tests`. Two tests are expected to fail until pypa#1140 and pypa#1141 are merged (exclusive comparison exclusion rules).
325 Hypothesis tests that verify algebraic invariants from the version specifiers specification. Each test class quotes the spec paragraph it validates. Tests are excluded from coverage and run as a separate CI job via `nox -s property_tests`. Two tests are expected to fail until pypa#1140 and pypa#1141 are merged (exclusive comparison exclusion rules).
|
The tests I'm proposing in #1144 show that this fixes an edge case where the current behavior breaks the monotonic invariant, that given versions |
|
I'm having to use an older file, as the place I was getting them from is gone. I used copilot CLI and gpt-5-mini to scan through the sqlite file and produce the output below the line. There were about 10K comparisons with a post release (that's every version of every package, only a fraction of that number is unique packages). Looking at just upper bound caps, this is 100 rows, which is 24 unique packages. Summary of steps performed:
Table of packages (package, version, comparisons):
|
|
Thanks for the analysis!
This PR doesn't affect Looking at gdptools their requirement is The more I've thought about this change the more confident I am that it's absolutely correct, spec wise and mathematically, and that it will have almost no practical impact. |
Discovered while looking for edge cases for #1119.
The spec says:
For
<1.0.post1the specified version is1.0.post1, so only1.0.post1.devNshould be excluded. The current code uses_base_versionwhich also excludes1.0.dev0,1.0a1, etc. For exampleSpecifier("<1.0.post1").contains(Version("1.0.dev0"))returnsFalsebut should returnTrue.The fix replaces the
_base_versioncheck with a comparison against_earliest_prerelease(spec)(i.e.spec.__replace__(dev=0)). For<2.0this changes nothing. For<1.0.post1it stops excluding pre-releases of1.0.I don't love this change. The current behavior feels intuitive, but the spec as written means
<2.0excludes2.0b1while<2.0.post1does not. The current behavior also creates problems for interval-based specifier representations (#1119, #1120), where<V.postNrequires N+2 intervals to model the_base_versionexclusion correctly.Subsumes #1139.