Warn when project-specific settings are passed to non-project uv run commands#5977
Warn when project-specific settings are passed to non-project uv run commands#5977charliermarsh merged 1 commit intomainfrom
uv run commands#5977Conversation
| } | ||
| if frozen { | ||
| warn_user_once!("`--frozen` has no effect alongside `--no-project`"); | ||
| } |
There was a problem hiding this comment.
We could enforce these specific warnings via Clap, and make them errors. But the others must be done at runtime, because we don't know if we'll discover a project when we first parse the arguments. So I just did them all as warnings for consistency.
| let base_interpreter = if let Some(script_interpreter) = script_interpreter { | ||
| // If we found a PEP 723 script and the user provided a project-only setting, warn. | ||
| if !extras.is_empty() { | ||
| warn_user_once!("Extras are not supported for Python scripts"); |
There was a problem hiding this comment.
I will change this to show specific CLI arguments when I do #5855 (I'll need access to the args to fix that).
crates/uv/tests/run.rs
Outdated
|
|
||
| ----- stderr ----- | ||
| Reading inline script metadata from: main.py | ||
| warning: `--no-project` is a no-op for Python scripts, which always run in isolation |
There was a problem hiding this comment.
Python scripts with inline metadata — not all Python scripts.
crates/uv/tests/run.rs
Outdated
|
|
||
| ----- stderr ----- | ||
| warning: `uv run` is experimental and may change without warning | ||
| warning: `--locked` has no effect alongside `--no-project` |
There was a problem hiding this comment.
Minor preference for "when used with" instead of "alongside".
| // If we can't find a project and the user provided a project-only setting, warn. | ||
| if project.is_none() { | ||
| if !extras.is_empty() { | ||
| warn_user_once!("Extras were provided, but no project was found"); |
|
Is this the only interface this applies to? Thank you! |
|
Arguably also |
d9b35fb to
a43e8a3
Compare
Summary
Closes #5856.