Bump MSRV to 1.85 and Edition 2024 (#13516)

## Summary

Builds on https://github.com/astral-sh/uv/pull/11724.

Closes https://github.com/astral-sh/uv/issues/13476.
This commit is contained in:
Charlie Marsh
2025-05-18 19:38:43 -04:00
committed by GitHub
parent cc6e766232
commit c5032aee80
240 changed files with 726 additions and 737 deletions
+10 -10
View File
@@ -11,11 +11,11 @@ use tracing::{debug, instrument, trace};
use which::{which, which_all};
use uv_cache::Cache;
use uv_fs::which::is_executable;
use uv_fs::Simplified;
use uv_fs::which::is_executable;
use uv_pep440::{
release_specifiers_to_ranges, LowerBound, Prerelease, UpperBound, Version, VersionSpecifier,
VersionSpecifiers,
LowerBound, Prerelease, UpperBound, Version, VersionSpecifier, VersionSpecifiers,
release_specifiers_to_ranges,
};
use uv_static::EnvVars;
use uv_warnings::warn_user_once;
@@ -30,11 +30,11 @@ use crate::managed::ManagedPythonInstallations;
use crate::microsoft_store::find_microsoft_store_pythons;
use crate::virtualenv::Error as VirtualEnvError;
use crate::virtualenv::{
conda_environment_from_env, virtualenv_from_env, virtualenv_from_working_dir,
virtualenv_python_executable, CondaEnvironmentKind,
CondaEnvironmentKind, conda_environment_from_env, virtualenv_from_env,
virtualenv_from_working_dir, virtualenv_python_executable,
};
#[cfg(windows)]
use crate::windows_registry::{registry_pythons, WindowsPython};
use crate::windows_registry::{WindowsPython, registry_pythons};
use crate::{BrokenSymlink, Interpreter, PythonVersion};
/// A request to find a Python installation.
@@ -251,8 +251,8 @@ pub enum Error {
/// - Discovered virtual environment (e.g. `.venv` in a parent directory)
///
/// Notably, "system" environments are excluded. See [`python_executables_from_installed`].
fn python_executables_from_virtual_environments<'a>(
) -> impl Iterator<Item = Result<(PythonSource, PathBuf), Error>> + 'a {
fn python_executables_from_virtual_environments<'a>()
-> impl Iterator<Item = Result<(PythonSource, PathBuf), Error>> + 'a {
let from_active_environment = iter::once_with(|| {
virtualenv_from_env()
.into_iter()
@@ -1252,8 +1252,8 @@ pub(crate) fn is_windows_store_shim(path: &Path) -> bool {
CreateFileW, FILE_ATTRIBUTE_REPARSE_POINT, FILE_FLAG_BACKUP_SEMANTICS,
FILE_FLAG_OPEN_REPARSE_POINT, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, OPEN_EXISTING,
};
use windows_sys::Win32::System::Ioctl::FSCTL_GET_REPARSE_POINT;
use windows_sys::Win32::System::IO::DeviceIoControl;
use windows_sys::Win32::System::Ioctl::FSCTL_GET_REPARSE_POINT;
// The path must be absolute.
if !path.is_absolute() {
@@ -2715,7 +2715,7 @@ fn split_wheel_tag_release_version(version: Version) -> Version {
mod tests {
use std::{path::PathBuf, str::FromStr};
use assert_fs::{prelude::*, TempDir};
use assert_fs::{TempDir, prelude::*};
use target_lexicon::{Aarch64Architecture, Architecture};
use test_log::test;
use uv_pep440::{Prerelease, PrereleaseKind, VersionSpecifiers};
+5 -7
View File
@@ -21,13 +21,14 @@ use tokio_util::either::Either;
use tracing::{debug, instrument};
use url::Url;
use uv_client::{is_extended_transient_error, BaseClient, WrappedReqwestError};
use uv_client::{BaseClient, WrappedReqwestError, is_extended_transient_error};
use uv_distribution_filename::{ExtensionError, SourceDistExtension};
use uv_extract::hash::Hasher;
use uv_fs::{rename_with_retry, Simplified};
use uv_fs::{Simplified, rename_with_retry};
use uv_pypi_types::{HashAlgorithm, HashDigest};
use uv_static::EnvVars;
use crate::PythonVariant;
use crate::implementation::{
Error as ImplementationError, ImplementationName, LenientImplementationName,
};
@@ -35,7 +36,6 @@ use crate::installation::PythonInstallationKey;
use crate::libc::LibcDetectionError;
use crate::managed::ManagedPythonInstallation;
use crate::platform::{self, Arch, Libc, Os};
use crate::PythonVariant;
use crate::{Interpreter, PythonRequest, PythonVersion, VersionRequest};
#[derive(Error, Debug)]
@@ -88,9 +88,7 @@ pub enum Error {
InvalidRequestPlatform(#[from] platform::Error),
#[error("No download found for request: {}", _0.green())]
NoDownloadFound(PythonDownloadRequest),
#[error(
"A mirror was provided via `{0}`, but the URL does not match the expected format: {0}"
)]
#[error("A mirror was provided via `{0}`, but the URL does not match the expected format: {0}")]
Mirror(&'static str, &'static str),
#[error(transparent)]
LibcDetection(#[from] LibcDetectionError),
@@ -1183,7 +1181,7 @@ async fn read_url(
let size = response.content_length();
let stream = response
.bytes_stream()
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))
.map_err(io::Error::other)
.into_async_read();
Ok((Either::Right(stream.compat()), size))
+1 -1
View File
@@ -14,7 +14,7 @@ use uv_pep440::Version;
use crate::discovery::find_python_installation;
use crate::installation::PythonInstallation;
use crate::virtualenv::{virtualenv_python_executable, PyVenvConfiguration};
use crate::virtualenv::{PyVenvConfiguration, virtualenv_python_executable};
use crate::{
EnvironmentPreference, Error, Interpreter, Prefix, PythonNotFound, PythonPreference,
PythonRequest, Target,
+3 -3
View File
@@ -8,15 +8,15 @@ use uv_client::BaseClientBuilder;
use uv_pep440::{Prerelease, Version};
use crate::discovery::{
find_best_python_installation, find_python_installation, EnvironmentPreference, PythonRequest,
EnvironmentPreference, PythonRequest, find_best_python_installation, find_python_installation,
};
use crate::downloads::{DownloadResult, ManagedPythonDownload, PythonDownloadRequest, Reporter};
use crate::implementation::LenientImplementationName;
use crate::managed::{ManagedPythonInstallation, ManagedPythonInstallations};
use crate::platform::{Arch, Libc, Os};
use crate::{
downloads, Error, ImplementationName, Interpreter, PythonDownloads, PythonPreference,
PythonSource, PythonVariant, PythonVersion,
Error, ImplementationName, Interpreter, PythonDownloads, PythonPreference, PythonSource,
PythonVariant, PythonVersion, downloads,
};
/// A Python interpreter and accompanying tools.
+2 -5
View File
@@ -17,7 +17,7 @@ use tracing::{debug, trace, warn};
use uv_cache::{Cache, CacheBucket, CachedByTimestamp, Freshness};
use uv_cache_info::Timestamp;
use uv_cache_key::cache_digest;
use uv_fs::{write_atomic_sync, PythonExt, Simplified};
use uv_fs::{PythonExt, Simplified, write_atomic_sync};
use uv_install_wheel::Layout;
use uv_pep440::Version;
use uv_pep508::{MarkerEnvironment, StringVersion};
@@ -1066,10 +1066,7 @@ fn find_base_python(
if let Some(parent) = executable.parent() {
parent.join(resolved)
} else {
return Err(io::Error::new(
io::ErrorKind::Other,
"Symlink has no parent directory",
));
return Err(io::Error::other("Symlink has no parent directory"));
}
} else {
resolved
+12 -11
View File
@@ -5,8 +5,9 @@ use thiserror::Error;
use uv_static::EnvVars;
pub use crate::discovery::{
find_python_installations, EnvironmentPreference, Error as DiscoveryError, PythonDownloads,
PythonNotFound, PythonPreference, PythonRequest, PythonSource, PythonVariant, VersionRequest,
EnvironmentPreference, Error as DiscoveryError, PythonDownloads, PythonNotFound,
PythonPreference, PythonRequest, PythonSource, PythonVariant, VersionRequest,
find_python_installations,
};
pub use crate::environment::{InvalidEnvironmentKind, PythonEnvironment};
pub use crate::implementation::ImplementationName;
@@ -18,7 +19,7 @@ pub use crate::python_version::PythonVersion;
pub use crate::target::Target;
pub use crate::version_files::{
DiscoveryOptions as VersionFileDiscoveryOptions, FilePreference as VersionFilePreference,
PythonVersionFile, PYTHON_VERSIONS_FILENAME, PYTHON_VERSION_FILENAME,
PYTHON_VERSION_FILENAME, PYTHON_VERSIONS_FILENAME, PythonVersionFile,
};
pub use crate::virtualenv::{Error as VirtualEnvError, PyVenvConfiguration, VirtualEnvironment};
@@ -109,7 +110,7 @@ mod tests {
};
use anyhow::Result;
use assert_fs::{fixture::ChildPath, prelude::*, TempDir};
use assert_fs::{TempDir, fixture::ChildPath, prelude::*};
use indoc::{formatdoc, indoc};
use temp_env::with_vars;
use test_log::test;
@@ -118,15 +119,15 @@ mod tests {
use uv_cache::Cache;
use crate::{
discovery::{
self, find_best_python_installation, find_python_installation, EnvironmentPreference,
},
PythonPreference,
};
use crate::{
PythonNotFound, PythonRequest, PythonSource, PythonVersion,
implementation::ImplementationName, installation::PythonInstallation,
managed::ManagedPythonInstallations, virtualenv::virtualenv_python_executable,
PythonNotFound, PythonRequest, PythonSource, PythonVersion,
};
use crate::{
PythonPreference,
discovery::{
self, EnvironmentPreference, find_best_python_installation, find_python_installation,
},
};
struct TestContext {
+3 -3
View File
@@ -11,10 +11,10 @@ use same_file::is_same_file;
use thiserror::Error;
use tracing::{debug, warn};
use uv_fs::{symlink_or_copy_file, LockedFile, Simplified};
use uv_fs::{LockedFile, Simplified, symlink_or_copy_file};
use uv_state::{StateBucket, StateStore};
use uv_static::EnvVars;
use uv_trampoline_builder::{windows_python_launcher, Launcher};
use uv_trampoline_builder::{Launcher, windows_python_launcher};
use crate::downloads::{Error as DownloadError, ManagedPythonDownload};
use crate::implementation::{
@@ -25,7 +25,7 @@ use crate::libc::LibcDetectionError;
use crate::platform::Error as PlatformError;
use crate::platform::{Arch, Libc, Os};
use crate::python_version::PythonVersion;
use crate::{macos_dylib, sysconfig, PythonRequest, PythonVariant};
use crate::{PythonRequest, PythonVariant, macos_dylib, sysconfig};
#[derive(Error, Debug)]
pub enum Error {
+1 -1
View File
@@ -3,8 +3,8 @@
//!
//! Effectively a port of <https://github.com/python/cpython/blob/58ce131037ecb34d506a613f21993cde2056f628/PC/launcher2.c#L1744>
use crate::windows_registry::WindowsPython;
use crate::PythonVersion;
use crate::windows_registry::WindowsPython;
use itertools::Either;
use std::env;
use std::path::PathBuf;
+1 -1
View File
@@ -1,5 +1,5 @@
use crate::cpuinfo::detect_hardware_floating_point_support;
use crate::libc::{detect_linux_libc, LibcDetectionError, LibcVersion};
use crate::libc::{LibcDetectionError, LibcVersion, detect_linux_libc};
use std::fmt::Display;
use std::ops::Deref;
use std::{fmt, str::FromStr};
+1 -5
View File
@@ -374,11 +374,7 @@ fn patch_pkgconfig(contents: &str) -> Option<String> {
Cow::Owned(format!("{prefix}=${{pcfiledir}}/../.."))
})
.join("\n");
if changed {
Some(new_contents)
} else {
None
}
if changed { Some(new_contents) } else { None }
}
#[derive(thiserror::Error, Debug)]
+2 -2
View File
@@ -2,7 +2,7 @@
use crate::managed::ManagedPythonInstallation;
use crate::platform::Arch;
use crate::{PythonInstallationKey, PythonVersion, COMPANY_DISPLAY_NAME, COMPANY_KEY};
use crate::{COMPANY_DISPLAY_NAME, COMPANY_KEY, PythonInstallationKey, PythonVersion};
use std::cmp::Ordering;
use std::collections::HashSet;
use std::path::PathBuf;
@@ -11,7 +11,7 @@ use target_lexicon::PointerWidth;
use thiserror::Error;
use tracing::debug;
use uv_warnings::{warn_user, warn_user_once};
use windows_registry::{Key, Value, CURRENT_USER, HSTRING, LOCAL_MACHINE};
use windows_registry::{CURRENT_USER, HSTRING, Key, LOCAL_MACHINE, Value};
use windows_result::HRESULT;
use windows_sys::Win32::Foundation::ERROR_FILE_NOT_FOUND;
use windows_sys::Win32::System::Registry::{KEY_WOW64_32KEY, KEY_WOW64_64KEY};