diff --git a/crates/puffin-cli/tests/pip_compile.rs b/crates/puffin-cli/tests/pip_compile.rs index 980a19bf9429..469c54a464d4 100644 --- a/crates/puffin-cli/tests/pip_compile.rs +++ b/crates/puffin-cli/tests/pip_compile.rs @@ -690,7 +690,7 @@ fn compile_python_37() -> Result<()> { ╰─▶ Because there are no versions of Python that satisfy Python>=3.8 and black==23.10.1 depends on Python>=3.8, we can conclude that black==23.10.1 cannot be used. - And because root depends on black==23.10.1 we can conclude that the + And because you require black==23.10.1 we can conclude that the requirements are unsatisfiable. "###); }); @@ -1442,8 +1442,8 @@ fn conflicting_direct_url_dependency() -> Result<()> { ----- stderr ----- × No solution found when resolving dependencies: - ╰─▶ Because there is no version of werkzeug==3.0.0 and root depends - on werkzeug==3.0.0, we can conclude that the requirements are + ╰─▶ Because there is no version of werkzeug==3.0.0 and you require + werkzeug==3.0.0, we can conclude that the requirements are unsatisfiable. "###); }); @@ -1600,7 +1600,7 @@ fn conflicting_transitive_url_dependency() -> Result<()> { ╰─▶ Because flask==3.0.0 depends on werkzeug>=3.0.0 and there are no versions of werkzeug that satisfy werkzeug>=3.0.0, we can conclude that flask==3.0.0 cannot be used. - And because root depends on flask==3.0.0 we can conclude that the + And because you require flask==3.0.0 we can conclude that the requirements are unsatisfiable. "###); }); @@ -2286,7 +2286,7 @@ fn compile_yanked_version_indirect() -> Result<()> { ----- stderr ----- × No solution found when resolving dependencies: ╰─▶ Because there are no versions of attrs that satisfy attrs>20.3.0,<21.2.0 - and root depends on attrs>20.3.0,<21.2.0, we can conclude that the + and you require attrs>20.3.0,<21.2.0, we can conclude that the requirements are unsatisfiable. "###); }); diff --git a/crates/puffin-cli/tests/pip_install.rs b/crates/puffin-cli/tests/pip_install.rs index 1ef1dac96164..093501a11fe2 100644 --- a/crates/puffin-cli/tests/pip_install.rs +++ b/crates/puffin-cli/tests/pip_install.rs @@ -83,8 +83,8 @@ fn no_solution() -> Result<()> { ╰─▶ Because there are no versions of flask that satisfy flask>3.0.0 and flask==3.0.0 depends on werkzeug>=3.0.0, we can conclude that flask>=3.0.0 depends on werkzeug>=3.0.0. - And because root depends on flask>=3.0.0 and root depends on - werkzeug<1.0.0, we can conclude that the requirements are unsatisfiable. + And because you require flask>=3.0.0 and you require werkzeug<1.0.0, we + can conclude that the requirements are unsatisfiable. "###); Ok(()) diff --git a/crates/puffin-cli/tests/pip_install_scenarios.rs b/crates/puffin-cli/tests/pip_install_scenarios.rs index c6d91243f9ce..58bca5503b2d 100644 --- a/crates/puffin-cli/tests/pip_install_scenarios.rs +++ b/crates/puffin-cli/tests/pip_install_scenarios.rs @@ -134,7 +134,7 @@ fn requires_exact_version_does_not_exist() -> Result<()> { ----- stderr ----- × No solution found when resolving dependencies: - ╰─▶ Because there is no version of a==2.0.0 and root depends on a==2.0.0, we can conclude that the requirements are unsatisfiable. + ╰─▶ Because there is no version of a==2.0.0 and you require a==2.0.0, we can conclude that the requirements are unsatisfiable. "###); }); @@ -189,7 +189,7 @@ fn requires_greater_version_does_not_exist() -> Result<()> { ----- stderr ----- × No solution found when resolving dependencies: - ╰─▶ Because there are no versions of a that satisfy a>1.0.0 and root depends on a>1.0.0, we can conclude that the requirements are unsatisfiable. + ╰─▶ Because there are no versions of a that satisfy a>1.0.0 and you require a>1.0.0, we can conclude that the requirements are unsatisfiable. "###); }); @@ -245,7 +245,7 @@ fn requires_less_version_does_not_exist() -> Result<()> { ----- stderr ----- × No solution found when resolving dependencies: - ╰─▶ Because there are no versions of a that satisfy a<2.0.0 and root depends on a<2.0.0, we can conclude that the requirements are unsatisfiable. + ╰─▶ Because there are no versions of a that satisfy a<2.0.0 and you require a<2.0.0, we can conclude that the requirements are unsatisfiable. "###); }); @@ -356,7 +356,7 @@ fn excluded_only_version() -> Result<()> { ╰─▶ Because there are no versions of a that satisfy any of: a<1.0.0 a>1.0.0 - and root depends on one of: + and you require one of: a<1.0.0 a>1.0.0 we can conclude that the requirements are unsatisfiable. @@ -443,10 +443,10 @@ fn excluded_only_compatible_version() -> Result<()> { b<=1.0.0 b>=3.0.0 - And because root depends on one of: + And because you require one of: a<2.0.0 a>2.0.0 - and root depends on b>=2.0.0,<3.0.0, we can conclude that the requirements are unsatisfiable. + and you require b>=2.0.0,<3.0.0, we can conclude that the requirements are unsatisfiable. "###); }); @@ -564,7 +564,7 @@ fn dependency_excludes_range_of_compatible_versions() -> Result<()> { b<=1.0.0 b>=3.0.0 - And because root depends on b>=2.0.0,<3.0.0 and root depends on c, we can conclude that the requirements are unsatisfiable. + And because you require b>=2.0.0,<3.0.0 and you require c, we can conclude that the requirements are unsatisfiable. "###); }); @@ -692,7 +692,7 @@ fn dependency_excludes_non_contiguous_range_of_compatible_versions() -> Result<( b<=1.0.0 b>=3.0.0 - And because root depends on c and root depends on b>=2.0.0,<3.0.0, we can conclude that the requirements are unsatisfiable. + And because you require c and you require b>=2.0.0,<3.0.0, we can conclude that the requirements are unsatisfiable. "###); }); @@ -961,7 +961,7 @@ fn extra_incompatible_with_extra() -> Result<()> { a[extra-b]<1.0.0 a[extra-b]>1.0.0 we can conclude that all versions of a[extra-b] and all versions of a[extra-c] are incompatible. - And because root depends on a[extra-c] and root depends on a[extra-b], we can conclude that the requirements are unsatisfiable. + And because you require a[extra-c] and you require a[extra-b], we can conclude that the requirements are unsatisfiable. "###); }); @@ -1101,7 +1101,7 @@ fn extra_incompatible_with_root() -> Result<()> { a[extra]<1.0.0 a[extra]>1.0.0 we can conclude that all versions of a[extra] depends on b==1.0.0. - And because root depends on a[extra] and root depends on b==2.0.0, we can conclude that the requirements are unsatisfiable. + And because you require a[extra] and you require b==2.0.0, we can conclude that the requirements are unsatisfiable. "###); }); @@ -1296,7 +1296,7 @@ fn transitive_incompatible_with_root_version() -> Result<()> { a<1.0.0 a>1.0.0 we can conclude that all versions of a depends on b==2.0.0. - And because root depends on b==1.0.0 and root depends on a, we can conclude that the requirements are unsatisfiable. + And because you require b==1.0.0 and you require a, we can conclude that the requirements are unsatisfiable. "###); }); @@ -1371,7 +1371,7 @@ fn transitive_incompatible_with_transitive() -> Result<()> { a<1.0.0 a>1.0.0 we can conclude that all versions of b and all versions of a are incompatible. - And because root depends on b and root depends on a, we can conclude that the requirements are unsatisfiable. + And because you require b and you require a, we can conclude that the requirements are unsatisfiable. "###); }); @@ -1485,7 +1485,7 @@ fn package_only_prereleases_in_range() -> Result<()> { ----- stderr ----- × No solution found when resolving dependencies: - ╰─▶ Because there are no versions of a that satisfy a>0.1.0 and root depends on a>0.1.0, we can conclude that the requirements are unsatisfiable. + ╰─▶ Because there are no versions of a that satisfy a>0.1.0 and you require a>0.1.0, we can conclude that the requirements are unsatisfiable. hint: Pre-releases are available for a in the requested range (e.g., 1.0.0a1), but pre-releases weren't enabled (try: `--prerelease=allow`) "###); @@ -2041,7 +2041,7 @@ fn transitive_package_only_prereleases_in_range() -> Result<()> { And because there are no versions of a that satisfy any of: a<0.1.0 a>0.1.0 - and root depends on a, we can conclude that the requirements are unsatisfiable. + and you require a, we can conclude that the requirements are unsatisfiable. hint: Pre-releases are available for b in the requested range (e.g., 1.0.0a1), but pre-releases weren't enabled (try: `--prerelease=allow`) "###); @@ -2185,7 +2185,7 @@ fn transitive_prerelease_and_stable_dependency() -> Result<()> { And because there are no versions of a that satisfy any of: a<1.0.0 a>1.0.0 - and root depends on a, we can conclude that the requirements are unsatisfiable. + and you require a, we can conclude that the requirements are unsatisfiable. hint: c was requested with a pre-release marker (e.g., c==2.0.0b1), but pre-releases weren't enabled (try: `--prerelease=allow`) "###); @@ -2367,7 +2367,7 @@ fn transitive_prerelease_and_stable_dependency_many_versions() -> Result<()> { a<1.0.0 a>1.0.0 we can conclude that all versions of b and all versions of a are incompatible. - And because root depends on b and root depends on a, we can conclude that the requirements are unsatisfiable. + And because you require b and you require a, we can conclude that the requirements are unsatisfiable. hint: c was requested with a pre-release marker (e.g., c>=2.0.0b1), but pre-releases weren't enabled (try: `--prerelease=allow`) "###); @@ -2467,7 +2467,7 @@ fn transitive_prerelease_and_stable_dependency_many_versions_holes() -> Result<( And because there are no versions of a that satisfy any of: a<1.0.0 a>1.0.0 - and root depends on a, we can conclude that the requirements are unsatisfiable. + and you require a, we can conclude that the requirements are unsatisfiable. hint: c was requested with a pre-release marker (e.g., any of: c>1.0.0,<2.0.0a5 @@ -2530,7 +2530,7 @@ fn requires_python_version_does_not_exist() -> Result<()> { ----- stderr ----- × No solution found when resolving dependencies: ╰─▶ Because there are no versions of Python that satisfy Python>=4.0 and a==1.0.0 depends on Python>=4.0, we can conclude that a==1.0.0 cannot be used. - And because root depends on a==1.0.0 we can conclude that the requirements are unsatisfiable. + And because you require a==1.0.0 we can conclude that the requirements are unsatisfiable. "###); }); @@ -2586,7 +2586,7 @@ fn requires_python_version_less_than_current() -> Result<()> { ----- stderr ----- × No solution found when resolving dependencies: ╰─▶ Because there are no versions of Python that satisfy Python<=3.8 and a==1.0.0 depends on Python<=3.8, we can conclude that a==1.0.0 cannot be used. - And because root depends on a==1.0.0 we can conclude that the requirements are unsatisfiable. + And because you require a==1.0.0 we can conclude that the requirements are unsatisfiable. "###); }); @@ -2642,7 +2642,7 @@ fn requires_python_version_greater_than_current() -> Result<()> { ----- stderr ----- × No solution found when resolving dependencies: ╰─▶ Because there are no versions of Python that satisfy Python>=3.10 and a==1.0.0 depends on Python>=3.10, we can conclude that a==1.0.0 cannot be used. - And because root depends on a==1.0.0 we can conclude that the requirements are unsatisfiable. + And because you require a==1.0.0 we can conclude that the requirements are unsatisfiable. "###); }); @@ -2719,7 +2719,7 @@ fn requires_python_version_greater_than_current_many() -> Result<()> { ----- stderr ----- × No solution found when resolving dependencies: - ╰─▶ Because there is no version of a==1.0.0 and root depends on a==1.0.0, we can conclude that the requirements are unsatisfiable. + ╰─▶ Because there is no version of a==1.0.0 and you require a==1.0.0, we can conclude that the requirements are unsatisfiable. "###); }); @@ -2863,7 +2863,7 @@ fn requires_python_version_greater_than_current_excluded() -> Result<()> { Because there are no versions of Python that satisfy Python>=3.12 and a==4.0.0 depends on Python>=3.12, we can conclude that a==4.0.0 cannot be used. And because we know from (2) that a>=2.0.0,<4.0.0 cannot be used, we can conclude that a>=2.0.0 cannot be used. - And because root depends on a>=2.0.0 we can conclude that the requirements are unsatisfiable. + And because you require a>=2.0.0 we can conclude that the requirements are unsatisfiable. "###); }); diff --git a/crates/puffin-resolver/src/pubgrub/report.rs b/crates/puffin-resolver/src/pubgrub/report.rs index e428b2dfdf59..07eaf1c16760 100644 --- a/crates/puffin-resolver/src/pubgrub/report.rs +++ b/crates/puffin-resolver/src/pubgrub/report.rs @@ -73,18 +73,20 @@ impl ReportFormatter> for PubGrubReportFormatter< External::FromDependencyOf(package, package_set, dependency, dependency_set) => { let package_set = self.simplify_set(package_set, package); let dependency_set = self.simplify_set(dependency_set, dependency); - if matches!(package, PubGrubPackage::Root(_)) { - // Exclude the dummy version for root packages - format!( - "{package} depends on {}", + match package { + PubGrubPackage::Root(Some(name)) => format!( + "{name} depends on {}", PackageRange::dependency(dependency, &dependency_set) - ) - } else { - format!( + ), + PubGrubPackage::Root(None) => format!( + "you require {}", + PackageRange::dependency(dependency, &dependency_set) + ), + _ => format!( "{}depends on {}", Padded::new("", &PackageRange::compatibility(package, &package_set), " "), PackageRange::dependency(dependency, &dependency_set) - ) + ), } } } diff --git a/crates/puffin-resolver/tests/resolver.rs b/crates/puffin-resolver/tests/resolver.rs index 74c28fb3d5ac..4796162e1377 100644 --- a/crates/puffin-resolver/tests/resolver.rs +++ b/crates/puffin-resolver/tests/resolver.rs @@ -507,7 +507,7 @@ async fn black_disallow_prerelease() -> Result<()> { .unwrap_err(); assert_snapshot!(err, @r###" - Because there are no versions of black that satisfy black<=20.0 and root depends on black<=20.0, we can conclude that the requirements are unsatisfiable. + Because there are no versions of black that satisfy black<=20.0 and you require black<=20.0, we can conclude that the requirements are unsatisfiable. hint: Pre-releases are available for black in the requested range (e.g., 19.10b0), but pre-releases weren't enabled (try: `--prerelease=allow`) "###); @@ -529,7 +529,7 @@ async fn black_allow_prerelease_if_necessary() -> Result<()> { .unwrap_err(); assert_snapshot!(err, @r###" - Because there are no versions of black that satisfy black<=20.0 and root depends on black<=20.0, we can conclude that the requirements are unsatisfiable. + Because there are no versions of black that satisfy black<=20.0 and you require black<=20.0, we can conclude that the requirements are unsatisfiable. hint: Pre-releases are available for black in the requested range (e.g., 19.10b0), but pre-releases weren't enabled (try: `--prerelease=allow`) "###); @@ -656,7 +656,7 @@ async fn msgraph_sdk() -> Result<()> { assert_snapshot!(err, @r###" Because there are no versions of msgraph-core that satisfy msgraph-core>=1.0.0a2 and msgraph-sdk==1.0.0 depends on msgraph-core>=1.0.0a2, we can conclude that msgraph-sdk==1.0.0 cannot be used. - And because root depends on msgraph-sdk==1.0.0 we can conclude that the requirements are unsatisfiable. + And because you require msgraph-sdk==1.0.0 we can conclude that the requirements are unsatisfiable. hint: msgraph-core was requested with a pre-release marker (e.g., msgraph-core>=1.0.0a2), but pre-releases weren't enabled (try: `--prerelease=allow`) "###);