mirror of https://github.com/astral-sh/uv
Clarify relationship between specifiers and `requires-python` range (#8688)
This commit is contained in:
parent
dc5e35ee5d
commit
cd408cbc51
|
|
@ -25,10 +25,16 @@ pub struct RequiresPython {
|
||||||
/// The supported Python versions as provides by the user, usually through the `requires-python`
|
/// The supported Python versions as provides by the user, usually through the `requires-python`
|
||||||
/// field in `pyproject.toml`.
|
/// field in `pyproject.toml`.
|
||||||
///
|
///
|
||||||
/// For a workspace, it's the intersection of all `requires-python` values in the workspace. If no
|
/// For a workspace, it's the intersection of all `requires-python` values in the workspace. If
|
||||||
/// bound was provided by the user, it's greater equal the current Python version.
|
/// no bound was provided by the user, it's greater equal the current Python version.
|
||||||
|
///
|
||||||
|
/// The specifiers remain static over the lifetime of the workspace, such that they
|
||||||
|
/// represent the initial Python version constraints.
|
||||||
specifiers: VersionSpecifiers,
|
specifiers: VersionSpecifiers,
|
||||||
/// The lower and upper bounds of the given specifiers.
|
/// The lower and upper bounds of the given specifiers.
|
||||||
|
///
|
||||||
|
/// The range may be narrowed over the course of dependency resolution as the resolver
|
||||||
|
/// investigates environments with stricter Python version constraints.
|
||||||
range: RequiresPythonRange,
|
range: RequiresPythonRange,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -114,6 +120,8 @@ impl RequiresPython {
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
// TODO(charlie): Consider re-computing the specifiers (or removing them entirely in favor
|
||||||
|
// of tracking the range). After narrowing, the specifiers and range may be out of sync.
|
||||||
match (lower, upper) {
|
match (lower, upper) {
|
||||||
(Some(lower), Some(upper)) => Some(Self {
|
(Some(lower), Some(upper)) => Some(Self {
|
||||||
specifiers: self.specifiers.clone(),
|
specifiers: self.specifiers.clone(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue