-
Notifications
You must be signed in to change notification settings - Fork 959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include version constraints in derivation chains #9112
Conversation
@@ -327,3 +342,88 @@ pub(crate) fn no_solution_hint(err: uv_resolver::NoSolutionError, help: String) | |||
let report = miette::Report::new(Error { header, err, help }); | |||
anstream::eprint!("{report:?}"); | |||
} | |||
|
|||
/// Remove local versions sentinels (`+[max]`) from the interval. | |||
fn strip_sentinel( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to DRY this up with the error reporting in the resolver.
/// The version of the package. | ||
version: Version, | ||
pub version: Version, | ||
/// The constraints applied to the subsequent package in the chain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is somewhat confusing but it is the most normalized representation...
f990682
to
f6dbdaf
Compare
4561df7
to
9629f13
Compare
f6dbdaf
to
b3bbb50
Compare
debb749
to
cf667fc
Compare
b3bbb50
to
735635b
Compare
crates/uv/tests/it/lock.rs
Outdated
@@ -19279,7 +19279,7 @@ fn lock_derivation_chain() -> Result<()> { | |||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |||
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)? | |||
|
|||
help: `wsgiref` was included because `project==0.1.0` depends on `wsgiref` | |||
help: `wsgiref` was included because `project==0.1.0` depends on `wsgiref (==0.1.2)` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if the parenthesis are helpful for readability here. Is there a particular reason you went with that approach instead of wsgiref==0.1.2
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In prior entries, I want to show both the selected version and the version range -- like django==1.4.0 (>=1.0.0)
. So it seemed nice to be consistent with the use of parentheses here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it should be like: django v1.4.0 (>=1.0.0)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are like three different cases to consider in the chain:
- The first dependency (
project==0.1.0
, which doesn't have a set of constraints, because it's just attached to the root). - Intermediary dependencies (not visible here), which have both a pinned version and a set of constraints, so we want to show both (like,
django==1.4.0 (>=1.0.0)
). - The final dependency (
wsgiref (==0.1.2)
), which we don't show the version for just to be succinct, but could.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, thanks for explaining. I'm happy with whatever you do here. django v1.4.0 (>=1.0.0)
seems easier to understand.
Regarding the root package, we might want to do something more consistent with the resolver reporter
uv/crates/uv-resolver/src/pubgrub/report.rs
Lines 341 to 355 in 744a909
fn format_root_requires(&self, package: &PubGrubPackage) -> Option<String> { | |
if self.is_workspace() { | |
if matches!(&**package, PubGrubPackageInner::Root(_)) { | |
if self.is_single_project_workspace() { | |
return Some("your project requires".to_string()); | |
} | |
return Some("your workspace requires".to_string()); | |
} | |
} | |
match &**package { | |
PubGrubPackageInner::Root(Some(name)) => Some(format!("{name} depends on")), | |
PubGrubPackageInner::Root(None) => Some("you require".to_string()), | |
_ => None, | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd omit the *
throughout, I don't think we usually show that to users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm kind of into wsgiref was included because project v0.1.0 depends on child>=0.1.0 and child v0.1.4 depends on wsgiref
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the last one you gave isn't bad either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whatever you're more into — we can iterate later if we need to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I went with:
help: `wsgiref` (v0.1.2) was included because `project` (v0.1.0) depends on `child` (v0.1.0) which depends on `wsgiref>=0.1.2`
cf667fc
to
3e30713
Compare
735635b
to
2a6e904
Compare
3e30713
to
7bb60fa
Compare
3d37271
to
6b06633
Compare
} | ||
(lower, upper) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just moved and restructured to make it public.
af267d0
to
87c15db
Compare
87c15db
to
734ccdb
Compare
Summary
Derivation chains can now include the versions at which a package was requested.