BlogDocs

small refactoring in pursuit of fixing conflicting extras/groups(#9386)

Merged
Comparing
ag/moar-refactoring
(
d8e8a18
) with
main
(
35ff802
)
+1%
IMPROVEMENTS
0
REGRESSIONS
0
UNTOUCHED
14
NEW
0
DROPPED
0
IGNORED
0

Benchmarks

Passed

wheelname_tag_compatibility[flyte-short-incompatible]
crates/uv-bench/benches/distribution_filename.rs::uv_distribution_filename::benchmark_wheelname_tag_compatibility::wheelname_tag_compatibility[flyte-short-incompatible]
+3%
1,017.5 ns
988.3 ns
wheelname_tag_compatibility[flyte-long-incompatible]
crates/uv-bench/benches/distribution_filename.rs::uv_distribution_filename::benchmark_wheelname_tag_compatibility::wheelname_tag_compatibility[flyte-long-incompatible]
+2%
1.5 µs
1.4 µs
wheelname_tag_compatibility[flyte-short-compatible]
crates/uv-bench/benches/distribution_filename.rs::uv_distribution_filename::benchmark_wheelname_tag_compatibility::wheelname_tag_compatibility[flyte-short-compatible]
+1%
2.1 µs
2 µs
wheelname_tag_compatibility[flyte-long-compatible]
crates/uv-bench/benches/distribution_filename.rs::uv_distribution_filename::benchmark_wheelname_tag_compatibility::wheelname_tag_compatibility[flyte-long-compatible]
+1%
2.1 µs
2.1 µs
wheelname_parsing[flyte-short-compatible]
crates/uv-bench/benches/distribution_filename.rs::uv_distribution_filename::benchmark_wheelname_parsing::wheelname_parsing[flyte-short-compatible]
0%
6.3 µs
6.3 µs
wheelname_parsing[flyte-short-incompatible]
crates/uv-bench/benches/distribution_filename.rs::uv_distribution_filename::benchmark_wheelname_parsing::wheelname_parsing[flyte-short-incompatible]
0%
6.4 µs
6.4 µs
wheelname_parsing[flyte-long-compatible]
crates/uv-bench/benches/distribution_filename.rs::uv_distribution_filename::benchmark_wheelname_parsing::wheelname_parsing[flyte-long-compatible]
0%
10.1 µs
10 µs
wheelname_parsing[flyte-long-incompatible]
crates/uv-bench/benches/distribution_filename.rs::uv_distribution_filename::benchmark_wheelname_parsing::wheelname_parsing[flyte-long-incompatible]
0%
13.8 µs
13.8 µs
resolve_warm_airflow
crates/uv-bench/benches/uv.rs::uv::resolve_warm_airflow::resolve_warm_airflow
0%
2 s
2 s
wheelname_parsing_failure[flyte-long-extension]
crates/uv-bench/benches/distribution_filename.rs::uv_distribution_filename::benchmark_wheelname_parsing_failure::wheelname_parsing_failure[flyte-long-extension]
0%
1.8 µs
1.8 µs
wheelname_parsing_failure[flyte-short-extension]
crates/uv-bench/benches/distribution_filename.rs::uv_distribution_filename::benchmark_wheelname_parsing_failure::wheelname_parsing_failure[flyte-short-extension]
0%
1.8 µs
1.8 µs
build_platform_tags[burntsushi-archlinux]
crates/uv-bench/benches/distribution_filename.rs::uv_distribution_filename::benchmark_build_platform_tags::build_platform_tags[burntsushi-archlinux]
0%
1.3 ms
1.3 ms
resolve_warm_jupyter
crates/uv-bench/benches/uv.rs::uv::resolve_warm_jupyter::resolve_warm_jupyter
0%
92.3 ms
92.5 ms
resolve_warm_jupyter_universal
crates/uv-bench/benches/uv.rs::uv::resolve_warm_jupyter_universal::resolve_warm_jupyter_universal
0%
343.5 ms
344.7 ms

Commits

Click on a commit to change the comparison range
base
main
35ff802
0%
uv-resolver: add "include" rules to `ResolverEnvironment` When we generate conflict markers for each resolution after the resolver runs, it turns out that generating them just from exclusion rules is not sufficient. For example, if `foo` and `bar` are declared as conflicting extras, then we end up with the following forks: A: extra != 'foo' B: extra != 'bar' C: extra != 'foo' and extra != 'bar' Now let's take an example where these forks don't share the same version for all packages. Consider a case where `idna==3.9` is in forks A and C, but where `idna==3.10` is in fork B. If we combine the markers in forks A and C through disjunction, we get the following: idna==3.9: extra != 'foo' or (extra != 'foo' and extra != 'bar') idna==3.10: extra != 'bar' Which simplifies to: idna==3.9: extra != 'foo' idna==3.10: extra != 'bar' But these are clearly not disjoint. Both dependencies could be selected, for example, when neither `foo` nor `bar` are active. We can remedy this by keeping around the inclusion rules for each fork: A: extra != 'foo' and extra == 'bar' B: extra != 'bar' and extra == 'foo' C: extra != 'foo' and extra != 'bar' And so for `idna`, we have: idna==3.9: (extra != 'foo' and extra == 'bar') or (extra != 'foo' and extra != 'bar') idna==3.10: extra != 'bar' and extra == 'foo' Which simplifies to: idna==3.9: extra != 'foo' idna==3.10: extra != 'bar' and extra == 'foo' And these *are* properly disjoint. There is no way for them both to be active. This also correctly accounts for fork C where neither `foo` nor `bar` are active, and yet, `idna==3.9` is still enabled but `idna==3.10` is not. (In the [motivating example], this comes from `baz` being enabled.) That is, this captures the idea that for `idna==3.10` to be installed, there must actually be a specific extra that is enabled. That's what makes it disjoint from `idna==3.9`. We aren't quite done yet, because this does add *too many* conflict markers to dependency edges that don't need it. In the next commit, we'll add in our world knowledge to simplify these conflict markers. [motivating example]: https://github.com/astral-sh/uv/issues/9289
2b04c7c
2 days ago
by BurntSushi
+1%
uv/tests: update resolution-markers in conflict test This change is correct because disjointness checks now incorporate conflicts. In this case, there are actually four forks. Two of them correspond to `sys_platform == 'darwin'` and `sys_platform != 'darwin'`, but neither of those contain `jinja2==3.1.3`. Instead, they contain other versions of `jinja2` linked to other extras. If we ever add conflicts to our `resolution-markers` in the lock file, then those forks should show up here again. (Because, of course, some forks do contain `jinja2==3.1.3` here.)
d8e8a18
2 days ago
by BurntSushi
ResourcesHomePricingDocsBlogGitHubChangelog
Copyright © 2024 CodSpeed Technology SAS. All rights reserved.