mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
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:
parent
d9a5f5ca1c
commit
35d6274c31
21 changed files with 591 additions and 88 deletions
|
@ -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)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue