Add a --project argument to run a command from a project (#7603)
## Summary `uv run --project ./path/to/project` now uses the provided directory as the starting point for any file discovery. However, relative paths are still resolved relative to the current working directory. Closes https://github.com/astral-sh/uv/issues/5613.
This commit is contained in:
@@ -235,6 +235,19 @@ pub struct GlobalArgs {
|
||||
/// Change to the given directory prior to running the command.
|
||||
#[arg(global = true, long, hide = true)]
|
||||
pub directory: Option<PathBuf>,
|
||||
|
||||
/// Run the command within the given project directory.
|
||||
///
|
||||
/// All `pyproject.toml`, `uv.toml`, and `.python-version` files will be discovered by walking
|
||||
/// up the directory tree from the project root, as will the project's virtual environment
|
||||
/// (`.venv`).
|
||||
///
|
||||
/// Other command-line arguments (such as relative paths) will be resolved relative
|
||||
/// to the current working directory.
|
||||
///
|
||||
/// This setting has no effect when used in the `uv pip` interface.
|
||||
#[arg(global = true, long)]
|
||||
pub project: Option<PathBuf>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, clap::ValueEnum)]
|
||||
|
||||
Reference in New Issue
Block a user