mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-03 10:33:49 +00:00
Support overlapping local and non-local requirements in forks (#5812)
## Summary This fixes a bug introduced by https://github.com/astral-sh/uv/pull/5232. It turns out that the `universal_disjoint_base_or_local_requirement` test does not actually do what it was meant to because of the incorrect python requirement. With a valid python requirement, it fails on `main`. The problem is that we try to exclude the original base version from the range of allowed versions to try and prefer local versions. However, in the test, there is a branch that depends on the non-local version, with no applicable local in its fork. We should remove this exclusion as prioritization is handled by the candidate resolver.
This commit is contained in:
parent
089f50a845
commit
e651e67f29
2 changed files with 22 additions and 23 deletions
|
@ -2117,11 +2117,6 @@ impl ForkState {
|
|||
if let Some(specifier) = specifier {
|
||||
let locals = locals.get(name, &self.markers);
|
||||
|
||||
// Prioritize local versions over the original version range.
|
||||
if !locals.is_empty() {
|
||||
*version = Range::empty();
|
||||
}
|
||||
|
||||
// It's possible that there are multiple matching local versions requested with
|
||||
// different marker expressions. All of these are potentially compatible until we
|
||||
// narrow to a specific fork.
|
||||
|
|
|
@ -7170,7 +7170,7 @@ fn universal_disjoint_local_requirement() -> Result<()> {
|
|||
/// expressions, we should fork the root requirement.
|
||||
#[test]
|
||||
fn universal_disjoint_base_or_local_requirement() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = TestContext::new("3.10");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(indoc! {r#"
|
||||
|
@ -7178,11 +7178,11 @@ fn universal_disjoint_base_or_local_requirement() -> Result<()> {
|
|||
name = "example"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"torch==2.0.0; python_version < '3.10'",
|
||||
"torch==2.0.0+cu118 ; python_version >= '3.10' and python_version <= '3.12'",
|
||||
"torch==2.0.0; python_version < '3.11'",
|
||||
"torch==2.0.0+cu118 ; python_version >= '3.11' and python_version <= '3.12'",
|
||||
"torch==2.0.0+cpu ; python_version > '3.12'"
|
||||
]
|
||||
requires-python = ">=3.11"
|
||||
requires-python = ">=3.10"
|
||||
"#})?;
|
||||
|
||||
let requirements_in = context.temp_dir.child("requirements.in");
|
||||
|
@ -7203,42 +7203,46 @@ fn universal_disjoint_base_or_local_requirement() -> Result<()> {
|
|||
----- stdout -----
|
||||
# This file was autogenerated by uv via the following command:
|
||||
# uv pip compile --cache-dir [CACHE_DIR] requirements.in --universal
|
||||
cmake==3.28.4 ; python_version <= '3.12' and platform_machine == 'x86_64' and platform_system == 'Linux'
|
||||
cmake==3.28.4 ; python_version <= '3.12' and python_version >= '3.11' and platform_machine == 'x86_64' and platform_system == 'Linux'
|
||||
# via triton
|
||||
.
|
||||
. ; python_version < '3.11' or python_version > '3.12' or (python_version <= '3.12' and python_version >= '3.11')
|
||||
# via -r requirements.in
|
||||
filelock==3.13.1
|
||||
filelock==3.13.1 ; python_version < '3.11' or python_version > '3.12' or (python_version <= '3.12' and python_version >= '3.11') or (python_version <= '3.12' and python_version >= '3.11' and platform_machine == 'x86_64' and platform_system == 'Linux')
|
||||
# via
|
||||
# torch
|
||||
# triton
|
||||
jinja2==3.1.3
|
||||
jinja2==3.1.3 ; python_version < '3.11' or python_version > '3.12' or (python_version <= '3.12' and python_version >= '3.11')
|
||||
# via torch
|
||||
lit==18.1.2 ; python_version <= '3.12' and platform_machine == 'x86_64' and platform_system == 'Linux'
|
||||
lit==18.1.2 ; python_version <= '3.12' and python_version >= '3.11' and platform_machine == 'x86_64' and platform_system == 'Linux'
|
||||
# via triton
|
||||
markupsafe==2.1.5
|
||||
markupsafe==2.1.5 ; (python_version < '3.11' or python_version > '3.12' or (python_version <= '3.12' and python_version >= '3.11')) and (python_version < '3.11' or python_version > '3.12' or (python_version <= '3.12' and python_version >= '3.11'))
|
||||
# via jinja2
|
||||
mpmath==1.3.0
|
||||
mpmath==1.3.0 ; (python_version < '3.11' or python_version > '3.12' or (python_version <= '3.12' and python_version >= '3.11')) and (python_version < '3.11' or python_version > '3.12' or (python_version <= '3.12' and python_version >= '3.11'))
|
||||
# via sympy
|
||||
networkx==3.2.1
|
||||
networkx==3.2.1 ; python_version < '3.11' or python_version > '3.12' or (python_version <= '3.12' and python_version >= '3.11')
|
||||
# via torch
|
||||
sympy==1.12
|
||||
sympy==1.12 ; python_version < '3.11' or python_version > '3.12' or (python_version <= '3.12' and python_version >= '3.11')
|
||||
# via torch
|
||||
torch==2.0.0+cpu
|
||||
torch==2.0.0 ; python_version < '3.11' or (python_version <= '3.12' and python_version > '3.12' and python_version >= '3.11')
|
||||
# via
|
||||
# -r requirements.in
|
||||
# example
|
||||
torch==2.0.0+cu118 ; python_version <= '3.12'
|
||||
torch==2.0.0+cpu ; python_version > '3.12'
|
||||
# via
|
||||
# -r requirements.in
|
||||
# example
|
||||
torch==2.0.0+cu118 ; python_version <= '3.12' and python_version >= '3.11'
|
||||
# via
|
||||
# -r requirements.in
|
||||
# example
|
||||
# triton
|
||||
triton==2.0.0 ; python_version <= '3.12' and platform_machine == 'x86_64' and platform_system == 'Linux'
|
||||
triton==2.0.0 ; python_version <= '3.12' and python_version >= '3.11' and platform_machine == 'x86_64' and platform_system == 'Linux'
|
||||
# via torch
|
||||
typing-extensions==4.10.0
|
||||
typing-extensions==4.10.0 ; python_version < '3.11' or python_version > '3.12' or (python_version <= '3.12' and python_version >= '3.11')
|
||||
# via torch
|
||||
|
||||
----- stderr -----
|
||||
Resolved 13 packages in [TIME]
|
||||
Resolved 14 packages in [TIME]
|
||||
"###
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue