astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
21.97k stars 641 forks source link

Add "package depth" to prioritization #3149

Open charliermarsh opened 5 months ago

charliermarsh commented 5 months ago

After "directly pinned packages", pip breaks ties based on package depth: https://github.com/pypa/pip/blob/ef78c129b1a966dbbbdb8ebfffc43723e89110d1/src/pip/_internal/resolution/resolvelib/provider.py#L120. We don't have a straightforward measurement for this right now, so it's not included in the heuristics. (Instead, we track "the order in which we visit packages", which isn't the same thing.)

wakamex commented 3 months ago

I'd love to see a slower "bleeding edge" resolution mode whose goal is to install latest versions as much as possible. To do this reliably, you'd need to visit all direct dependencies and pull up the release date of their one-back version, in order to backtrack to the most recent.

It would be helpful for personal projects where my aim is to try out the latest version of everything and help teams with issues as they arise.

It might be useful more generally too, to avoid race-to-the-bottom backtracks. Basically switching from depth-first to breadth-might resolve faster and with a happier outcome of versions that work well together since they were released around the same time.

See #4372 for an example of dependency hell that is happily resolved with a reliable "most recent" trackback.