Skip to content

Conversation

konstin
Copy link
Member

@konstin konstin commented May 9, 2025

In uv, we don't use the DependencyConstraints map, but pass in the dependencies through an iterator. This means there can be duplicate dependencies in the input. This would previously make merge_dependents panic if a package dependent on itself twice with the same range:

[package]
name = "foo"
version = "0.1.0"
dependencies = ["foo", "foo"]

The fix is to ignore self-dependencies when merging dependents, given that they are always trivially true or trivially false.

In uv, we don't use the `DependencyConstraints` map, but pass in the dependencies through an iterator. This means there can be duplicate dependencies in the input. This would previously make `merge_dependents` panic if a package dependent on itself twice with the same range:

```toml
[package]
name = "foo"
version = "0.1.0"
dependencies = ["foo", "foo"]
```

The fix is to ignore self-dependencies when merging dependents, given that they are always trivially true or trivially false.
Copy link

codspeed-hq bot commented May 9, 2025

CodSpeed Performance Report

Congrats! CodSpeed is installed 🎉

🆕 6 new benchmarks were detected.

You will start to see performance impacts in the reports once the benchmarks are run from your default branch.

Detected benchmarks

  • backtracking_disjoint_versions (2.3 s)
  • backtracking_ranges (2 s)
  • backtracking_singletons (4.3 s)
  • large_case_u16_NumberVersion.ron (26 ms)
  • sudoku-easy (3.9 ms)
  • sudoku-hard (4.3 ms)

@konstin konstin merged commit 73d6ecf into main May 9, 2025
7 checks passed
konstin added a commit to astral-sh/uv that referenced this pull request May 9, 2025
The fix itself and its documentation live in pubgrub: astral-sh/pubgrub#44

Fixes #13344
// meaning it can't hit this branch, which requires two self-dependencies.
if p1 == p2 {
return None;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So like, elsewhere, we'll be able to immediately convert each of these dependencies to True or False, since they're trivial -- no merging required?

Copy link
Member Author

@konstin konstin May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, each partial solution immediately knows their value (while not filtering self-dependencies out earlier keeps error reporting etc. consistent)

charliermarsh added a commit to astral-sh/uv that referenced this pull request May 13, 2025
The fix itself and its documentation live in pubgrub:
astral-sh/pubgrub#44

Fixes #13344

---------

Co-authored-by: Charlie Marsh <[email protected]>
konstin added a commit that referenced this pull request May 23, 2025
In uv, we don't use the `DependencyConstraints` map, but pass in the
dependencies through an iterator. This means there can be duplicate
dependencies in the input. This would previously make `merge_dependents`
panic if a package dependent on itself twice with the same range:

```toml
[package]
name = "foo"
version = "0.1.0"
dependencies = ["foo", "foo"]
```

The fix is to ignore self-dependencies when merging dependents, given
that they are always trivially true or trivially false.
konstin added a commit that referenced this pull request Aug 27, 2025
In uv, we don't use the `DependencyConstraints` map, but pass in the
dependencies through an iterator. This means there can be duplicate
dependencies in the input. This would previously make `merge_dependents`
panic if a package dependent on itself twice with the same range:

```toml
[package]
name = "foo"
version = "0.1.0"
dependencies = ["foo", "foo"]
```

The fix is to ignore self-dependencies when merging dependents, given
that they are always trivially true or trivially false.
konstin added a commit that referenced this pull request Oct 1, 2025
In uv, we don't use the `DependencyConstraints` map, but pass in the
dependencies through an iterator. This means there can be duplicate
dependencies in the input. This would previously make `merge_dependents`
panic if a package dependent on itself twice with the same range:

```toml
[package]
name = "foo"
version = "0.1.0"
dependencies = ["foo", "foo"]
```

The fix is to ignore self-dependencies when merging dependents, given
that they are always trivially true or trivially false.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants