mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-13 22:16:20 +00:00
Respect the user's upper-bound in requires-python
(#6824)
## Summary We now respect the user-provided upper-bound in for `requires-python`. So, if the user has `requires-python = "==3.11.*"`, we won't explore forks that have `python_version >= '3.12'`, for example. However, we continue to _only_ compare the lower bounds when assessing whether a dependency is compatible with a given Python range. Closes https://github.com/astral-sh/uv/issues/6150.
This commit is contained in:
parent
a17c1e8e40
commit
34d74501ac
10 changed files with 308 additions and 77 deletions
|
@ -1,7 +1,7 @@
|
|||
use pep440_rs::{Version, VersionSpecifiers};
|
||||
use uv_python::{Interpreter, PythonVersion};
|
||||
|
||||
use crate::{RequiresPython, RequiresPythonBound};
|
||||
use crate::{RequiresPython, RequiresPythonRange};
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct PythonRequirement {
|
||||
|
@ -49,7 +49,7 @@ impl PythonRequirement {
|
|||
|
||||
/// Narrow the [`PythonRequirement`] to the given version, if it's stricter (i.e., greater)
|
||||
/// than the current `Requires-Python` minimum.
|
||||
pub fn narrow(&self, target: &RequiresPythonBound) -> Option<Self> {
|
||||
pub fn narrow(&self, target: &RequiresPythonRange) -> Option<Self> {
|
||||
let Some(PythonTarget::RequiresPython(requires_python)) = self.target.as_ref() else {
|
||||
return None;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue