-
Notifications
You must be signed in to change notification settings - Fork 605
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 support for requirements files in uv run
#4973
Conversation
caecbd4
to
7a8b84f
Compare
Terrifyingly easy to add. I want to add some more test coverage and I'm sure there are some niche behaviors I need to explore. |
crates/uv-cli/src/lib.rs
Outdated
/// | ||
/// If `-` is provided, then requirements will be read from stdin. | ||
#[arg(long, short, group = "sources", value_parser = parse_file_path)] | ||
pub requirement: Vec<PathBuf>, |
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.
Should we say -r
/ --with-requirements
instead?
7a8b84f
to
4d81e5c
Compare
// These cases seem quite complex because it changes the current package — let's just | ||
// ban it entirely for now |
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.
Alternatively, uv run -r
could imply --isolated
(which might make sense but is more limiting?)
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.
Am I correct that the code would work, and here, you just mean that semantically -r foo/bar/pyproject.toml
should use foo/bar
as the project?
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.
Yeah the code should work as-is, it's just weird since it may imply a change of project.
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.
Like.. you should use --with ./foo/bar
instead, right?
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.
Seems fine (it's good that it was easy!). Let's also add to uv tool run
? What about uv tool install
...?
Also closes #4824. |
Yeah I think we need it everywhere. What do you think about names?
I think the Per #4824 (comment) I think we want to support
Do we want:
Here I think it's reasonable to drop the |
We don't accept |
Or, at least, we definitely don't need to support that to start IMO. And if we want to support it, we should probably support it in the pip API too. |
Yeah I don't think that's in scope for this pull request, just want to nail down the plan so we can make sure it's coherent. |
I think I'd be ok with |
@zanieb - I'm happy to finish this PR if we can get consensus on the names, no trouble. |
@charliermarsh I am comfortable finishing it up this week |
4d81e5c
to
d1107be
Compare
d1107be
to
b589387
Compare
b589387
to
2a9e0e0
Compare
2a9e0e0
to
4f59135
Compare
@@ -281,6 +310,7 @@ pub(crate) async fn run( | |||
// any `--with` requirements, and we already have a base environment, then there's no need to | |||
// create an additional environment. | |||
let skip_ephemeral = base_interpreter.as_ref().is_some_and(|base_interpreter| { | |||
// No additional requrements |
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.
Typo :D
printer, | ||
match spec { | ||
None => Some(venv), | ||
Some(spec) if spec.is_empty() => Some(venv), |
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.
You might be able to simplify this with a spec.filter(|spec| !spec.is_empty())
somewhere.
As discussed I'll take this over and try to get it merged today. |
Note that we're using plural |
uv run
uv run
We decided to narrow the scope to requirements files for now. Constraints and overrides require that we resolve alongside the base environment, diff the result, and install any changes into the ephemeral environment. Which is doable, but a lot more complex. |
a3601eb
to
81ce36c
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.
"Approved"
Thanks for taking this over! |
Closes #4824.