From eaf517efd85f3fcaafe290ffc36615f4be8e04f9 Mon Sep 17 00:00:00 2001 From: Tim de Jager Date: Fri, 4 Jul 2025 20:08:23 +0200 Subject: [PATCH 1/2] Add method to get packages involved in a `NoSolutionError` (#14457) ## Summary In pixi we overlay the PyPI packages over the conda packages and we sometimes need to figure out what PyPI packages are involved in the no-solution error. We could parse the error message, but this is pretty error-prone, so it would be good to get access to more information. A lot of information in this module is private and should probably stay this way, but package names are easy enough to expose. This would help us a lot! I collect into a HashSet to remove duplication, and did not want to expose a rustc_hash datastructure directly, thats's why I've chosen to expose as an iterator :) Let me know if any changes need to be done, and thanks! --------- Co-authored-by: Zanie Blue --- crates/uv-resolver/src/error.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/uv-resolver/src/error.rs b/crates/uv-resolver/src/error.rs index 72f9217e3..0916f54ac 100644 --- a/crates/uv-resolver/src/error.rs +++ b/crates/uv-resolver/src/error.rs @@ -3,6 +3,7 @@ use std::fmt::Formatter; use std::sync::Arc; use indexmap::IndexSet; +use itertools::Itertools; use owo_colors::OwoColorize; use pubgrub::{ DefaultStringReporter, DerivationTree, Derived, External, Range, Ranges, Reporter, Term, @@ -409,6 +410,15 @@ impl NoSolutionError { } Ok(()) } + + /// Get the packages that are involved in this error. + pub fn packages(&self) -> impl Iterator { + self.error + .packages() + .into_iter() + .filter_map(|p| p.name()) + .unique() + } } impl std::fmt::Debug for NoSolutionError { From f609e1ddaf0b9468cc362fcbf4a091bf8b46c7e3 Mon Sep 17 00:00:00 2001 From: John Mumm Date: Fri, 4 Jul 2025 22:42:56 +0200 Subject: [PATCH 2/2] Document that `VerbatimUrl` does not preserve original string after serialization (#14456) This came up in [discussion](https://github.com/astral-sh/uv/pull/14387#issuecomment-3032223670) on #14387. --- crates/uv-pep508/src/verbatim_url.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/uv-pep508/src/verbatim_url.rs b/crates/uv-pep508/src/verbatim_url.rs index 8b914eb74..c800ba10c 100644 --- a/crates/uv-pep508/src/verbatim_url.rs +++ b/crates/uv-pep508/src/verbatim_url.rs @@ -18,11 +18,16 @@ use uv_redacted::DisplaySafeUrl; use crate::Pep508Url; /// A wrapper around [`Url`] that preserves the original string. +/// +/// The original string is not preserved after serialization/deserialization. #[derive(Debug, Clone, Eq)] pub struct VerbatimUrl { /// The parsed URL. url: DisplaySafeUrl, /// The URL as it was provided by the user. + /// + /// Even if originally set, this will be [`None`] after + /// serialization/deserialization. given: Option, }