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

use aggressive forking when encountering markers #5733

Closed
wants to merge 11 commits into from
Closed
602 changes: 212 additions & 390 deletions crates/uv-resolver/src/resolver/mod.rs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions crates/uv/tests/branching_urls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn branching_urls_overlapping() -> Result<()> {
----- stdout -----

----- stderr -----
error: Requirements contain conflicting URLs for package `iniconfig`:
error: Requirements contain conflicting URLs for package `iniconfig` in split `python_version >= '3.11' and python_version < '3.12'`:
- https://files.pythonhosted.org/packages/9b/dd/b3c12c6d707058fa947864b67f0c4e0c39ef8610988d7baea9578f3c48f3/iniconfig-1.1.1-py2.py3-none-any.whl
- https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl
"###
Expand Down Expand Up @@ -678,7 +678,7 @@ fn branching_urls_of_different_sources_conflict() -> Result<()> {
----- stdout -----

----- stderr -----
error: Requirements contain conflicting URLs for package `iniconfig`:
error: Requirements contain conflicting URLs for package `iniconfig` in split `python_version >= '3.11' and python_version < '3.12'`:
- git+https://github.com/pytest-dev/iniconfig@93f5930e668c0d1ddf4597e38dd0dea4e2665e7a
- https://files.pythonhosted.org/packages/9b/dd/b3c12c6d707058fa947864b67f0c4e0c39ef8610988d7baea9578f3c48f3/iniconfig-1.1.1-py2.py3-none-any.whl
"###
Expand Down
4 changes: 4 additions & 0 deletions crates/uv/tests/edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1580,6 +1580,10 @@ fn update() -> Result<()> {
lock, @r###"
version = 1
requires-python = ">=3.12"
environment-markers = [
"python_version <= '3.7'",
"python_version > '3.7'",
]

[options]
exclude-newer = "2024-03-25 00:00:00 UTC"
Expand Down
57 changes: 44 additions & 13 deletions crates/uv/tests/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,10 @@ fn lock_dependency_extra() -> Result<()> {
lock, @r###"
version = 1
requires-python = ">=3.12"
environment-markers = [
"platform_system != 'Windows'",
"platform_system == 'Windows'",
]

[options]
exclude-newer = "2024-03-25 00:00:00 UTC"
Expand Down Expand Up @@ -1407,6 +1411,7 @@ fn lock_dependency_extra() -> Result<()> {
version = "0.1.0"
source = { editable = "." }
dependencies = [
{ name = "flask" },
{ name = "flask", extra = ["dotenv"] },
]

Expand Down Expand Up @@ -1437,13 +1442,14 @@ fn lock_dependency_extra() -> Result<()> {

// Re-run with `--locked`.
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
success: true
exit_code: 0
success: false
exit_code: 2
----- stdout -----

----- stderr -----
warning: `uv lock` is experimental and may change without warning
Resolved 10 packages in [TIME]
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
"###);

// Install from the lockfile.
Expand Down Expand Up @@ -1508,6 +1514,10 @@ fn lock_conditional_dependency_extra() -> Result<()> {
lock, @r###"
version = 1
requires-python = ">=3.7"
environment-markers = [
"python_version < '3.10'",
"python_version >= '3.10'",
]

[options]
exclude-newer = "2024-03-25 00:00:00 UTC"
Expand Down Expand Up @@ -1662,7 +1672,7 @@ fn lock_conditional_dependency_extra() -> Result<()> {

[package.optional-dependencies]
socks = [
{ name = "pysocks" },
{ name = "pysocks", marker = "python_version < '3.10'" },
]

[[package]]
Expand All @@ -1680,13 +1690,14 @@ fn lock_conditional_dependency_extra() -> Result<()> {

// Re-run with `--locked`.
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
success: true
exit_code: 0
success: false
exit_code: 2
----- stdout -----

----- stderr -----
warning: `uv lock` is experimental and may change without warning
Resolved 7 packages in [TIME]
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
"###);

// Install from the lockfile.
Expand Down Expand Up @@ -1715,13 +1726,14 @@ fn lock_conditional_dependency_extra() -> Result<()> {

// Re-run with `--locked`.
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
success: true
exit_code: 0
success: false
exit_code: 2
----- stdout -----

----- stderr -----
warning: `uv lock` is experimental and may change without warning
Resolved 7 packages in [TIME]
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
"###);

// Install from the lockfile.
Expand Down Expand Up @@ -1783,6 +1795,10 @@ fn lock_dependency_non_existent_extra() -> Result<()> {
lock, @r###"
version = 1
requires-python = ">=3.12"
environment-markers = [
"platform_system != 'Windows'",
"platform_system == 'Windows'",
]

[options]
exclude-newer = "2024-03-25 00:00:00 UTC"
Expand Down Expand Up @@ -1878,6 +1894,7 @@ fn lock_dependency_non_existent_extra() -> Result<()> {
source = { editable = "." }
dependencies = [
{ name = "flask" },
{ name = "flask" },
]

[[package]]
Expand Down Expand Up @@ -2679,6 +2696,11 @@ fn lock_requires_python() -> Result<()> {
lock, @r###"
version = 1
requires-python = ">=3.7"
environment-markers = [
"python_version >= '3.11'",
"python_version < '3.8'",
"python_version >= '3.8' and python_version < '3.11'",
]

[options]
exclude-newer = "2024-03-25 00:00:00 UTC"
Expand Down Expand Up @@ -2724,7 +2746,7 @@ fn lock_requires_python() -> Result<()> {
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "typing-extensions", marker = "python_version < '3.8'" },
{ name = "zipp" },
{ name = "zipp", marker = "python_version < '3.8'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/a3/82/f6e29c8d5c098b6be61460371c2c5591f4a335923639edec43b3830650a4/importlib_metadata-6.7.0.tar.gz", hash = "sha256:1aaf550d4f73e5d6783e7acb77aec43d49da8017410afae93822cc9cca98c4d4", size = 53569 }
wheels = [
Expand Down Expand Up @@ -2830,6 +2852,11 @@ fn lock_requires_python() -> Result<()> {
lock, @r###"
version = 1
requires-python = ">=3.7.9"
environment-markers = [
"python_version < '3.8'",
"python_version >= '3.11'",
"python_version >= '3.8' and python_version < '3.11'",
]

[options]
exclude-newer = "2024-03-25 00:00:00 UTC"
Expand Down Expand Up @@ -2875,7 +2902,7 @@ fn lock_requires_python() -> Result<()> {
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "typing-extensions", marker = "python_version < '3.8'" },
{ name = "zipp" },
{ name = "zipp", marker = "python_version < '3.8'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/a3/82/f6e29c8d5c098b6be61460371c2c5591f4a335923639edec43b3830650a4/importlib_metadata-6.7.0.tar.gz", hash = "sha256:1aaf550d4f73e5d6783e7acb77aec43d49da8017410afae93822cc9cca98c4d4", size = 53569 }
wheels = [
Expand Down Expand Up @@ -3586,12 +3613,12 @@ fn lock_python_version_marker_complement() -> Result<()> {
version = 1
requires-python = ">=3.8"
environment-markers = [
"python_full_version > '3.10' and python_version > '3.10'",
"python_full_version > '3.10' and python_version == '3.10'",
"python_full_version > '3.10' and python_version < '3.10'",
"python_full_version <= '3.10' and python_version > '3.10'",
"python_full_version <= '3.10' and python_version == '3.10'",
"python_full_version <= '3.10' and python_version < '3.10'",
"python_full_version > '3.10' and python_version == '3.10'",
"python_full_version > '3.10' and python_version > '3.10'",
"python_full_version <= '3.10' and python_version == '3.10'",
"python_full_version <= '3.10' and python_version > '3.10'",
]

[options]
Expand Down Expand Up @@ -3847,6 +3874,10 @@ fn lock_multiple_markers() -> Result<()> {
lock, @r###"
version = 1
requires-python = ">=3.12"
environment-markers = [
"implementation_name != 'cpython'",
"implementation_name == 'cpython'",
]

[options]
exclude-newer = "2024-03-25 00:00:00 UTC"
Expand Down
Loading
Loading