Respect .python-version files and fetch manged toolchains in uv project commands (#4361)

As in #4360, updates the uv project CLI to respect `.python-version`
files as default Python version requests. Additionally, updates project
interpreter discovery to fetch managed toolchains as in `uv venv
--preview`.
This commit is contained in:
Zanie Blue 2024-06-18 10:43:52 -04:00 committed by GitHub
parent 903dfc2f1f
commit 1ce21475a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 120 additions and 51 deletions

View file

@ -32,7 +32,7 @@ pub struct BaseClientBuilder<'a> {
keyring: KeyringProviderType,
native_tls: bool,
retries: u32,
connectivity: Connectivity,
pub connectivity: Connectivity,
client: Option<Client>,
markers: Option<&'a MarkerEnvironment>,
platform: Option<&'a Platform>,

View file

@ -929,6 +929,16 @@ pub enum Connectivity {
Offline,
}
impl Connectivity {
pub fn is_online(&self) -> bool {
matches!(self, Self::Online)
}
pub fn is_offline(&self) -> bool {
matches!(self, Self::Offline)
}
}
#[cfg(test)]
mod tests {
use std::str::FromStr;