mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-17 22:07:47 +00:00
Add support for global uv python pin
(#12115)
These changes add support for ``` uv python pin 3.12 --global ``` This adds the specified version to a `.python-version` file in the user-level config directory. uv will now use the user-level version as a fallback if no version is found in the project directory or its ancestors. Closes #4972
This commit is contained in:
parent
b4eabf9a61
commit
797f1fbac0
17 changed files with 366 additions and 16 deletions
|
@ -4676,6 +4676,19 @@ pub struct PythonPinArgs {
|
|||
/// `requires-python` constraint.
|
||||
#[arg(long, alias = "no-workspace")]
|
||||
pub no_project: bool,
|
||||
|
||||
/// Update the global Python version pin.
|
||||
///
|
||||
/// Writes the pinned Python version to a `.python-version` file in the uv user configuration
|
||||
/// directory: `XDG_CONFIG_HOME/uv` on Linux/macOS and `%APPDATA%/uv` on Windows.
|
||||
///
|
||||
/// When a local Python version pin is not found in the working directory or an ancestor
|
||||
/// directory, this version will be used instead.
|
||||
///
|
||||
/// Unlike local version pins, this version is used as the default for commands that mutate
|
||||
/// global state, like `uv tool install`.
|
||||
#[arg(long)]
|
||||
pub global: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue