Add --install-dir arg to uv python install and uninstall (#7920)
## Summary This PR adds `--install-dir` argument for the following commands: - `uv python install` - `uv python uninstall` The `UV_PYTHON_INSTALL_DIR` env variable can be used to set it (previously it was also used internally). Any more commands we would want to add this to? ## Test Plan For now just manual test (works on my machine hehe) ``` ❯ ./target/debug/uv python install --install-dir /tmp/pythons 3.8.12 Searching for Python versions matching: Python 3.8.12 Installed Python 3.8.12 in 4.31s + cpython-3.8.12-linux-x86_64-gnu ❯ /tmp/pythons/cpython-3.8.12-linux-x86_64-gnu/bin/python --help usage: /tmp/pythons/cpython-3.8.12-linux-x86_64-gnu/bin/python [option] ... [-c cmd | -m mod | file | -] [arg] ... ``` Open to add some tests after the initial feedback. --------- Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
@@ -4250,6 +4250,16 @@ pub struct PythonDirArgs {
|
||||
#[derive(Args)]
|
||||
#[allow(clippy::struct_excessive_bools)]
|
||||
pub struct PythonInstallArgs {
|
||||
/// The directory to store the Python installation in.
|
||||
///
|
||||
/// If provided, `UV_PYTHON_INSTALL_DIR` will need to be set for subsequent operations for
|
||||
/// uv to discover the Python installation.
|
||||
///
|
||||
/// See `uv python dir` to view the current Python installation directory. Defaults to
|
||||
/// `~/.local/share/uv/python`.
|
||||
#[arg(long, short, env = "UV_PYTHON_INSTALL_DIR")]
|
||||
pub install_dir: Option<PathBuf>,
|
||||
|
||||
/// The Python version(s) to install.
|
||||
///
|
||||
/// If not provided, the requested Python version(s) will be read from the
|
||||
@@ -4310,6 +4320,10 @@ pub struct PythonInstallArgs {
|
||||
#[derive(Args)]
|
||||
#[allow(clippy::struct_excessive_bools)]
|
||||
pub struct PythonUninstallArgs {
|
||||
/// The directory where the Python was installed.
|
||||
#[arg(long, short, env = "UV_PYTHON_INSTALL_DIR")]
|
||||
pub install_dir: Option<PathBuf>,
|
||||
|
||||
/// The Python version(s) to uninstall.
|
||||
///
|
||||
/// See `uv help python` to view supported request formats.
|
||||
|
||||
Reference in New Issue
Block a user