Skip to content

Commit

Permalink
Refer to the user instead of "root" when mentioning direct dependencies
Browse files Browse the repository at this point in the history
Closes #857
  • Loading branch information
zanieb committed Jan 19, 2024
1 parent 6cad0f6 commit b2e2cf3
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 40 deletions.
10 changes: 5 additions & 5 deletions crates/puffin-cli/tests/pip_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"###);
});
Expand Down Expand Up @@ -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.
"###);
});
Expand Down Expand Up @@ -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.
"###);
});
Expand Down Expand Up @@ -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.
"###);
});
Expand Down
4 changes: 2 additions & 2 deletions crates/puffin-cli/tests/pip_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
44 changes: 22 additions & 22 deletions crates/puffin-cli/tests/pip_install_scenarios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"###);
});

Expand Down Expand Up @@ -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.
"###);
});

Expand Down Expand Up @@ -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.
"###);
});

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
"###);
});

Expand Down Expand Up @@ -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.
"###);
});

Expand Down Expand Up @@ -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.
"###);
});

Expand Down Expand Up @@ -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.
"###);
});

Expand Down Expand Up @@ -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.
"###);
});

Expand Down Expand Up @@ -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.
"###);
});

Expand Down Expand Up @@ -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.
"###);
});

Expand Down Expand Up @@ -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`)
"###);
Expand Down Expand Up @@ -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`)
"###);
Expand Down Expand Up @@ -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`)
"###);
Expand Down Expand Up @@ -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`)
"###);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
"###);
});

Expand Down Expand Up @@ -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.
"###);
});

Expand Down Expand Up @@ -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.
"###);
});

Expand Down Expand Up @@ -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.
"###);
});

Expand Down Expand Up @@ -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.
"###);
});

Expand Down
18 changes: 10 additions & 8 deletions crates/puffin-resolver/src/pubgrub/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,20 @@ impl ReportFormatter<PubGrubPackage, Range<Version>> 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)
)
),
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions crates/puffin-resolver/tests/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
"###);
Expand All @@ -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`)
"###);
Expand Down Expand Up @@ -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`)
"###);
Expand Down

0 comments on commit b2e2cf3

Please sign in to comment.