Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support overlapping local and non-local requirements in forks #5812

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions crates/uv-resolver/src/resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
40 changes: 22 additions & 18 deletions crates/uv/tests/pip_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7170,19 +7170,19 @@ 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#"
[project]
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");
Expand All @@ -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+cpu ; python_version > '3.12'
# via
# -r requirements.in
# example
torch==2.0.0+cu118 ; python_version <= '3.12'
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]
"###
);

Expand Down
Loading