Skip to content

Commit

Permalink
Display dependency versions in pip-like format during solve failure (#…
Browse files Browse the repository at this point in the history
…346)

- Display `==` for exact version ranges
- Remove space between dependency and version range
  • Loading branch information
zanieb authored Nov 6, 2023
1 parent a5e535f commit 1748cfb
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ info:
- pip-compile
- pyproject.toml
- "--cache-dir"
- /var/folders/bc/qlsk3t6x7c9fhhbvvcg68k9c0000gp/T/.tmpmN6eIS
- /var/folders/bc/qlsk3t6x7c9fhhbvvcg68k9c0000gp/T/.tmpN531dN
env:
VIRTUAL_ENV: /var/folders/bc/qlsk3t6x7c9fhhbvvcg68k9c0000gp/T/.tmpaj2K70/.venv
VIRTUAL_ENV: /var/folders/bc/qlsk3t6x7c9fhhbvvcg68k9c0000gp/T/.tmp99w9dK/.venv
---
success: false
exit_code: 1
----- stdout -----

----- stderr -----
× No solution found when resolving dependencies:
╰─▶ my-project depends on django
╰─▶ my-project depends on django

Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ info:
- pip-compile
- requirements.in
- "--cache-dir"
- /var/folders/nt/6gf2v7_s3k13zq_t3944rwz40000gn/T/.tmpVyrxMG
- /var/folders/bc/qlsk3t6x7c9fhhbvvcg68k9c0000gp/T/.tmpleIayX
env:
VIRTUAL_ENV: /var/folders/nt/6gf2v7_s3k13zq_t3944rwz40000gn/T/.tmpF8a4y3/.venv
VIRTUAL_ENV: /var/folders/bc/qlsk3t6x7c9fhhbvvcg68k9c0000gp/T/.tmp24qRXe/.venv
---
success: false
exit_code: 1
----- stdout -----

----- stderr -----
× No solution found when resolving dependencies:
╰─▶ root depends on werkzeug 3.0.0
╰─▶ root depends on werkzeug==3.0.0

Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ info:
- pip-compile
- requirements.in
- "--cache-dir"
- /var/folders/nt/6gf2v7_s3k13zq_t3944rwz40000gn/T/.tmpb7ldgy
- /var/folders/bc/qlsk3t6x7c9fhhbvvcg68k9c0000gp/T/.tmpfXoEZG
env:
VIRTUAL_ENV: /var/folders/nt/6gf2v7_s3k13zq_t3944rwz40000gn/T/.tmp6FMPGr/.venv
VIRTUAL_ENV: /var/folders/bc/qlsk3t6x7c9fhhbvvcg68k9c0000gp/T/.tmpJkukgJ/.venv
---
success: false
exit_code: 1
----- stdout -----

----- stderr -----
× No solution found when resolving dependencies:
╰─▶ Because flask 3.0.0 depends on werkzeug >=3.0.0 and root 0a0.dev0
depends on flask 3.0.0, root 0a0.dev0 is forbidden.
╰─▶ Because flask ==3.0.0 depends on werkzeug >=3.0.0 and root ==0a0.dev0
depends on flask ==3.0.0, root ==0a0.dev0 is forbidden.

8 changes: 4 additions & 4 deletions crates/puffin-resolver/src/pubgrub/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,22 +383,22 @@ impl fmt::Display for PuffinExternal {
if package_set == &Range::full() && dependency_set == &Range::full() {
write!(f, "{package} depends on {dependency}")
} else if package_set == &Range::full() {
write!(f, "{package} depends on {dependency} {dependency_set}")
write!(f, "{package} depends on {dependency}{dependency_set}")
} else if dependency_set == &Range::full() {
if matches!(package, PubGrubPackage::Root(_)) {
// Exclude the dummy version for root packages
write!(f, "{package} depends on {dependency}")
} else {
write!(f, "{package} {package_set} depends on {dependency}")
write!(f, "{package}{package_set} depends on {dependency}")
}
} else {
if matches!(package, PubGrubPackage::Root(_)) {
// Exclude the dummy version for root packages
write!(f, "{package} depends on {dependency} {dependency_set}")
write!(f, "{package} depends on {dependency}{dependency_set}")
} else {
write!(
f,
"{package} {package_set} depends on {dependency} {dependency_set}"
"{package}{package_set} depends on {dependency}{dependency_set}"
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion vendor/pubgrub/src/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ impl<V: Display + Eq> Display for Range<V> {
(Included(v), Unbounded) => write!(f, ">={v}")?,
(Included(v), Included(b)) => {
if v == b {
write!(f, "{v}")?
write!(f, "=={v}")?
} else {
write!(f, ">={v},<={b}")?
}
Expand Down

0 comments on commit 1748cfb

Please sign in to comment.