ITADN

`fork-strategy` has no effect on the forks that come from `[tool.uv] environments`

#20999Opennotatallshaw 创建于 15 天前
bug
N
notatallshawcommented
### Summary I found this bug in uv's `fork-strategy` when trying to compare the output of nab and uv for a benchmark suite. `fork-strategy` has no effect on the forks that come from `[tool.uv] environments`. They are solved in the order they are written, and since each finished fork seeds preferences for the next, the list order decides the resolution instead of the setting. ```toml [project] name = "example" version = "0.1.0" requires-python = ">=3.11,<3.13" dependencies = ["numpy"] [tool.uv] exclude-newer = "2026-08-01T00:00:00Z" environments = ["python_version == '3.11'", "python_version == '3.12'"] ``` The default `requires-python` strategy should take the newest numpy for each Python, but `uv lock` pins `2.4.6` for both: ```console $ uv lock -v Solving split (markers: python_full_version == '3.11.*') Selecting: numpy==2.4.6 [compatible] Solving split (markers: python_full_version == '3.12.*') Selecting: numpy==2.4.6 [preference] ``` Swapping the two `environments` lines gives `2.5.1` on 3.12 and `2.4.6` on 3.11, as does dropping `environments` entirely. `fork-strategy = "fewest"` fails in the mirror image: listing 3.12 first pins both versions where one covers both environments. PR incoming. ### Platform Linux ### Version uv 0.11.23 (x86_64-unknown-linux-gnu) ### Python version Python 3.12.3
0 条评论