mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-02 01:52:22 +00:00
Add support for managed installs of free-threaded Python (#8100)
Closes https://github.com/astral-sh/uv/issues/7193 ``` ❯ cargo run -q -- python uninstall 3.13t Searching for Python versions matching: Python 3.13t Uninstalled Python 3.13.0 in 231ms - cpython-3.13.0+freethreaded-macos-aarch64-none ❯ cargo run -q -- python install 3.13t Searching for Python versions matching: Python 3.13t Installed Python 3.13.0 in 3.54s + cpython-3.13.0+freethreaded-macos-aarch64-none ❯ cargo run -q -- python install 3.12t Searching for Python versions matching: Python 3.12t error: No download found for request: cpython-3.12t-macos-aarch64-none ❯ cargo run -q -- python install 3.13rc3t Searching for Python versions matching: Python 3.13rc3t Found existing installation for Python 3.13rc3t: cpython-3.13.0+freethreaded-macos-aarch64-none ❯ cargo run -q -- run -p 3.13t python -c "import sys; print(sys.base_prefix)" /Users/zb/.local/share/uv/python/cpython-3.13.0+freethreaded-macos-aarch64-none ```
This commit is contained in:
parent
db0f0aec09
commit
5f33915e03
12 changed files with 6319 additions and 4211 deletions
|
@ -132,7 +132,7 @@ pub enum EnvironmentPreference {
|
|||
Any,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||
pub enum PythonVariant {
|
||||
#[default]
|
||||
Default,
|
||||
|
@ -1975,6 +1975,19 @@ impl VersionRequest {
|
|||
Self::Range(specifiers, _) => Self::Range(specifiers, PythonVariant::Default),
|
||||
}
|
||||
}
|
||||
|
||||
/// Return the required [`PythonVariant`] of the request.
|
||||
pub(crate) fn variant(&self) -> Option<PythonVariant> {
|
||||
match self {
|
||||
Self::Any => None,
|
||||
Self::Default => Some(PythonVariant::Default),
|
||||
Self::Major(_, variant)
|
||||
| Self::MajorMinor(_, _, variant)
|
||||
| Self::MajorMinorPatch(_, _, _, variant)
|
||||
| Self::MajorMinorPrerelease(_, _, _, variant)
|
||||
| Self::Range(_, variant) => Some(*variant),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for VersionRequest {
|
||||
|
@ -2049,6 +2062,27 @@ impl FromStr for VersionRequest {
|
|||
}
|
||||
}
|
||||
|
||||
impl FromStr for PythonVariant {
|
||||
type Err = ();
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s {
|
||||
"t" | "freethreaded" => Ok(Self::Freethreaded),
|
||||
"" => Ok(Self::Default),
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for PythonVariant {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::Default => f.write_str("default"),
|
||||
Self::Freethreaded => f.write_str("freethreaded"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_version_specifiers_request(
|
||||
s: &str,
|
||||
variant: PythonVariant,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue