-
Notifications
You must be signed in to change notification settings - Fork 762
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
Add a universal resolution mode to pip compile
#4505
Conversation
pip compile
48f0840
to
7a1c526
Compare
a651af0
to
82c6ea1
Compare
7a1c526
to
b2d4852
Compare
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.
Hyped for supporting this
/// Perform a universal resolution, attempting to generate a single `requirements.txt` output | ||
/// file that is compatible with all Python platforms. | ||
#[arg(long, overrides_with("no_universal"))] | ||
pub universal: bool, |
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.
🎉
crates/uv-cli/src/lib.rs
Outdated
@@ -568,6 +568,14 @@ pub struct PipCompileArgs { | |||
#[arg(long)] | |||
pub python_platform: Option<TargetTriple>, | |||
|
|||
/// Perform a universal resolution, attempting to generate a single `requirements.txt` output | |||
/// file that is compatible with all Python platforms. |
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.
"Python platforms" is likely unclear to the users, we likely need something along the lines of "all operating systems, architectures and supported Python versions, as supported by your dependencies"
9fd6651
to
2c3173d
Compare
}; | ||
let expr_python_full_version = MarkerExpression::Version { | ||
key: MarkerValueVersion::PythonFullVersion, | ||
specifier: VersionSpecifier::from_version(Operator::Equal, version).unwrap(), |
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 a bit unsure of this. It still locks against the target Python version rather than "the target version at minimum." It's easy to change but not sure what the right semantics are.
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.
My feeling is:
requires-python
if the input is apyproject.toml
(the conjunction of allrequires-python
values if there are multiplepyproject.toml
).- An explicit
--requires-python
argument. >={{current python}}
and inform the user that the should consider passing--requires-python
if they want an interpreter independent resolution.
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.
.requires_python() | ||
.map(RequiresPython::to_marker_tree) | ||
.unwrap_or_else(|| MarkerTree::And(vec![])), | ||
) |
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.
Nice. You got rid of the MarkerTree::And(vec![])
! I think the change is for the better right? My understanding is that now it will always have some non-empty marker expression in universal mode. So that when Requires-Python
isn't provided, it will be based on the installed version of Python? Where as previously, there would be no filtering at all.
63c943b
to
d41022e
Compare
2c3173d
to
359f76c
Compare
7e3b618
to
a09c19e
Compare
a09c19e
to
2c74b08
Compare
Summary
This needs more tests and a few more changes, but checkpointing it for now.