Respect release-only semantics of python_full_version when constructing markers (#6171)

## Summary

In the resolver, we use release-only semantics to normalize
`python_full_version`. So, if we see `python_full_version < '3.13'`, we
treat that as `(Unbounded, Exclude(3.13))`. `3.13b0` evaluates as `true`
to that range, so we were accepting pre-releases for these markers.

Instead, we need to exclude pre-release segments when performing these
evaluations.

Closes https://github.com/astral-sh/uv/issues/6169.

## Test Plan

Hard to write a test for this because you need a pre-release Python
locally... so:

`echo "sqlalchemy==2.0.32" | cargo run pip compile - --python 3.13 -n`
This commit is contained in:
Charlie Marsh 2024-08-17 15:29:57 -04:00 committed by GitHub
parent ad8e3a2c32
commit 5ac0b98e00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 61 additions and 8 deletions

View file

@ -155,7 +155,7 @@ impl<'a> BuildContext for BuildDispatch<'a> {
.index_strategy(self.index_strategy)
.build(),
&python_requirement,
ResolverMarkers::SpecificEnvironment(markers.clone()),
ResolverMarkers::specific_environment(markers.clone()),
Some(tags),
self.flat_index,
self.index,