Upgrade to Rust 1.80.0 (#5472)

This commit is contained in:
Charlie Marsh 2024-07-26 21:49:47 -04:00 committed by GitHub
parent 3ea5e16e96
commit 24859bd3ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
38 changed files with 163 additions and 196 deletions

13
Cargo.lock generated
View File

@ -392,7 +392,6 @@ dependencies = [
"distribution-filename",
"distribution-types",
"install-wheel-rs",
"once_cell",
"pep508_rs",
"platform-tags",
"pypi-types",
@ -1097,7 +1096,6 @@ dependencies = [
"distribution-filename",
"fs-err",
"itertools 0.13.0",
"once_cell",
"pep440_rs",
"pep508_rs",
"platform-tags",
@ -1824,7 +1822,6 @@ dependencies = [
"fs-err",
"indoc",
"mailparse",
"once_cell",
"pathdiff",
"pep440_rs",
"platform-info",
@ -2425,7 +2422,6 @@ name = "pep440_rs"
version = "0.6.0"
dependencies = [
"indoc",
"once_cell",
"pyo3",
"rkyv",
"serde",
@ -2441,7 +2437,6 @@ dependencies = [
"derivative",
"insta",
"log",
"once_cell",
"pep440_rs",
"pyo3",
"pyo3-log",
@ -2792,7 +2787,6 @@ dependencies = [
"indexmap",
"itertools 0.13.0",
"mailparse",
"once_cell",
"pep440_rs",
"pep508_rs",
"regex",
@ -4511,7 +4505,6 @@ dependencies = [
"http",
"insta",
"once-map",
"once_cell",
"reqwest",
"reqwest-middleware",
"rust-netrc",
@ -4534,7 +4527,6 @@ dependencies = [
"indoc",
"insta",
"itertools 0.13.0",
"once_cell",
"pep440_rs",
"pep508_rs",
"pypi-types",
@ -4756,7 +4748,6 @@ dependencies = [
"insta",
"install-wheel-rs",
"nanoid",
"once_cell",
"path-absolutize",
"pep440_rs",
"pep508_rs",
@ -4820,7 +4811,6 @@ dependencies = [
"fs-err",
"fs2",
"junction",
"once_cell",
"path-absolutize",
"path-slash",
"tempfile",
@ -4924,7 +4914,6 @@ dependencies = [
"indoc",
"install-wheel-rs",
"itertools 0.13.0",
"once_cell",
"owo-colors",
"pep440_rs",
"pep508_rs",
@ -5053,7 +5042,6 @@ dependencies = [
"fs-err",
"indoc",
"memchr",
"once_cell",
"pep440_rs",
"pep508_rs",
"pypi-types",
@ -5179,7 +5167,6 @@ name = "uv-warnings"
version = "0.0.1"
dependencies = [
"anstream",
"once_cell",
"owo-colors",
"rustc-hash 2.0.0",
]

View File

@ -9,7 +9,7 @@ resolver = "2"
[workspace.package]
edition = "2021"
rust-version = "1.77"
rust-version = "1.80"
homepage = "https://pypi.org/project/uv/"
documentation = "https://pypi.org/project/uv/"
repository = "https://github.com/astral-sh/uv"
@ -102,7 +102,6 @@ md-5 = { version = "0.10.6" }
memchr = { version = "2.7.4" }
miette = { version = "7.2.0" }
nanoid = { version = "0.4.0" }
once_cell = { version = "1.19.0" }
owo-colors = { version = "4.0.0" }
path-absolutize = { version = "3.1.1" }
path-slash = { version = "0.2.1" }

View File

@ -48,7 +48,6 @@ anyhow = { workspace = true }
chrono = { workspace = true }
codspeed-criterion-compat = { version = "2.6.0", default-features = false, optional = true }
criterion = { version = "0.5.1", default-features = false, features = ["async_tokio"] }
once_cell = { workspace = true }
tokio = { workspace = true }
[features]

View File

@ -71,9 +71,10 @@ criterion_group!(uv, resolve_warm_airflow, resolve_warm_jupyter);
criterion_main!(uv);
mod resolver {
use std::sync::LazyLock;
use anyhow::Result;
use chrono::NaiveDate;
use once_cell::sync::Lazy;
use distribution_types::IndexLocations;
use install_wheel_rs::linker::LinkMode;
@ -94,7 +95,7 @@ mod resolver {
};
use uv_types::{BuildIsolation, EmptyInstalledPackages, HashStrategy, InFlight};
static MARKERS: Lazy<MarkerEnvironment> = Lazy::new(|| {
static MARKERS: LazyLock<MarkerEnvironment> = LazyLock::new(|| {
MarkerEnvironment::try_from(MarkerEnvironmentBuilder {
implementation_name: "cpython",
implementation_version: "3.11.5",
@ -118,8 +119,8 @@ mod resolver {
Arch::Aarch64,
);
static TAGS: Lazy<Tags> =
Lazy::new(|| Tags::from_env(&PLATFORM, (3, 11), "cpython", (3, 11), false).unwrap());
static TAGS: LazyLock<Tags> =
LazyLock::new(|| Tags::from_env(&PLATFORM, (3, 11), "cpython", (3, 11), false).unwrap());
pub(crate) async fn resolve(
manifest: Manifest,

View File

@ -2,9 +2,9 @@ pub mod criterion {
//! This module re-exports the criterion API but picks the right backend depending on whether
//! the benchmarks are built to run locally or with codspeed
#[cfg(not(codspeed))]
#[cfg(not(feature = "codspeed"))]
pub use criterion::*;
#[cfg(codspeed)]
#[cfg(feature = "codspeed")]
pub use codspeed_criterion_compat::*;
}

View File

@ -26,7 +26,6 @@ uv-normalize = { workspace = true }
anyhow = { workspace = true }
fs-err = { workspace = true }
itertools = { workspace = true }
once_cell = { workspace = true }
rkyv = { workspace = true }
schemars = { workspace = true, optional = true }
serde = { workspace = true, features = ["derive"] }

View File

@ -1,11 +1,10 @@
use itertools::Either;
use std::borrow::Cow;
use std::fmt::{Display, Formatter};
use std::ops::Deref;
use std::path::Path;
use std::str::FromStr;
use itertools::Either;
use once_cell::sync::Lazy;
use std::sync::LazyLock;
use thiserror::Error;
use url::{ParseError, Url};
@ -13,10 +12,10 @@ use pep508_rs::{VerbatimUrl, VerbatimUrlError};
use crate::Verbatim;
static PYPI_URL: Lazy<Url> = Lazy::new(|| Url::parse("https://pypi.org/simple").unwrap());
static PYPI_URL: LazyLock<Url> = LazyLock::new(|| Url::parse("https://pypi.org/simple").unwrap());
static DEFAULT_INDEX_URL: Lazy<IndexUrl> =
Lazy::new(|| IndexUrl::Pypi(VerbatimUrl::from_url(PYPI_URL.clone())));
static DEFAULT_INDEX_URL: LazyLock<IndexUrl> =
LazyLock::new(|| IndexUrl::Pypi(VerbatimUrl::from_url(PYPI_URL.clone())));
/// The URL of an index to use for fetching packages (e.g., PyPI).
#[derive(Debug, Clone, Hash, Eq, PartialEq)]

View File

@ -34,7 +34,6 @@ csv = { workspace = true }
data-encoding = { workspace = true }
fs-err = { workspace = true }
mailparse = { workspace = true }
once_cell = { workspace = true }
pathdiff = { workspace = true }
platform-info = { workspace = true }
reflink-copy = { workspace = true }

View File

@ -1,8 +1,8 @@
use configparser::ini::Ini;
use once_cell::sync::Lazy;
use regex::Regex;
use rustc_hash::FxHashSet;
use serde::Serialize;
use std::sync::LazyLock;
use crate::{wheel, Error};
@ -30,7 +30,7 @@ impl Script {
// between the object reference and the left square bracket, between the extra names and the square brackets and colons delimiting them,
// and after the right square bracket."
// https://packaging.python.org/en/latest/specifications/entry-points/#file-format
static SCRIPT_REGEX: Lazy<Regex> = Lazy::new(|| {
static SCRIPT_REGEX: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"^(?P<module>[\w\d_\-.]+)\s*:\s*(?P<function>[\w\d_\-.]+)(?:\s*\[\s*(?P<extras>(?:[^,]+,?\s*)+)\])?\s*$").unwrap()
});

View File

@ -2,8 +2,7 @@ use std::collections::BTreeSet;
use std::path::{Component, Path, PathBuf};
use fs_err as fs;
use once_cell::sync::Lazy;
use std::sync::Mutex;
use std::sync::{LazyLock, Mutex};
use tracing::debug;
use uv_fs::write_atomic_sync;
@ -219,7 +218,7 @@ fn normcase(s: &str) -> String {
}
}
static EASY_INSTALL_PTH: Lazy<Mutex<i32>> = Lazy::new(Mutex::default);
static EASY_INSTALL_PTH: LazyLock<Mutex<i32>> = LazyLock::new(Mutex::default);
/// Uninstall the legacy editable represented by the `.egg-link` file.
///

View File

@ -19,7 +19,6 @@ crate-type = ["rlib", "cdylib"]
workspace = true
[dependencies]
once_cell = { workspace = true }
pyo3 = { workspace = true, optional = true, features = ["extension-module", "abi3-py37"] }
serde = { workspace = true, features = ["derive"] }
rkyv = { workspace = true }

View File

@ -1,3 +1,10 @@
#[cfg(feature = "pyo3")]
use pyo3::{
basic::CompareOp, exceptions::PyValueError, pyclass, pymethods, FromPyObject, IntoPy, PyAny,
PyObject, PyResult, Python,
};
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
use std::sync::LazyLock;
use std::{
borrow::Borrow,
cmp::Ordering,
@ -6,13 +13,6 @@ use std::{
sync::Arc,
};
#[cfg(feature = "pyo3")]
use pyo3::{
basic::CompareOp, exceptions::PyValueError, pyclass, pymethods, FromPyObject, IntoPy, PyAny,
PyObject, PyResult, Python,
};
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
/// One of `~=` `==` `!=` `<=` `>=` `<` `>` `===`
#[derive(
Eq,
@ -856,7 +856,7 @@ impl FromStr for Version {
/// or local releases.
/// * The low 5 bits combined with the bits in bytes 1 and 0 correspond
/// to the release number of the suffix, if one exists. If there is no
/// suffix, then this bits are always 0.
/// suffix, then these bits are always 0.
///
/// The order of the encoding above is significant. For example, suffixes are
/// encoded at a less significant location than the release numbers, so that
@ -2532,8 +2532,8 @@ fn parse_u64(bytes: &[u8]) -> Result<u64, VersionParseError> {
}
/// The minimum version that can be represented by a [`Version`]: `0a0.dev0`.
pub static MIN_VERSION: once_cell::sync::Lazy<Version> =
once_cell::sync::Lazy::new(|| Version::from_str("0a0.dev0").unwrap());
pub static MIN_VERSION: LazyLock<Version> =
LazyLock::new(|| Version::from_str("0a0.dev0").unwrap());
#[cfg(test)]
mod tests {

View File

@ -21,7 +21,6 @@ workspace = true
[dependencies]
derivative = { workspace = true }
once_cell = { workspace = true }
pep440_rs = { workspace = true }
pyo3 = { workspace = true, optional = true, features = ["abi3", "extension-module"] }
pyo3-log = { workspace = true, optional = true }

View File

@ -1,10 +1,9 @@
use regex::Regex;
use std::borrow::Cow;
use std::fmt::Debug;
use std::ops::Deref;
use std::path::{Path, PathBuf};
use once_cell::sync::Lazy;
use regex::Regex;
use std::sync::LazyLock;
use thiserror::Error;
use url::{ParseError, Url};
@ -301,13 +300,13 @@ pub enum VerbatimUrlError {
pub fn expand_env_vars(s: &str) -> Cow<'_, str> {
// Generate the project root, to be used via the `${PROJECT_ROOT}`
// environment variable.
static PROJECT_ROOT_FRAGMENT: Lazy<String> = Lazy::new(|| {
static PROJECT_ROOT_FRAGMENT: LazyLock<String> = LazyLock::new(|| {
let project_root = std::env::current_dir().unwrap();
project_root.to_string_lossy().to_string()
});
static RE: Lazy<Regex> =
Lazy::new(|| Regex::new(r"(?P<var>\$\{(?P<name>[A-Z0-9_]+)})").unwrap());
static RE: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"(?P<var>\$\{(?P<name>[A-Z0-9_]+)})").unwrap());
RE.replace_all(s, |caps: &regex::Captures<'_>| {
let name = caps.name("name").unwrap().as_str();

View File

@ -22,7 +22,6 @@ chrono = { workspace = true, features = ["serde"] }
indexmap = { workspace = true, features = ["serde"] }
itertools = { workspace = true }
mailparse = { workspace = true }
once_cell = { workspace = true }
regex = { workspace = true }
rkyv = { workspace = true }
serde = { workspace = true }

View File

@ -1,9 +1,8 @@
use std::borrow::Cow;
use std::str::FromStr;
use once_cell::sync::Lazy;
use regex::Regex;
use serde::{de, Deserialize, Deserializer, Serialize};
use std::borrow::Cow;
use std::str::FromStr;
use std::sync::LazyLock;
use tracing::warn;
use pep440_rs::{VersionSpecifiers, VersionSpecifiersParseError};
@ -12,21 +11,22 @@ use pep508_rs::{Pep508Error, Pep508Url, Requirement};
use crate::VerbatimParsedUrl;
/// Ex) `>=7.2.0<8.0.0`
static MISSING_COMMA: Lazy<Regex> = Lazy::new(|| Regex::new(r"(\d)([<>=~^!])").unwrap());
static MISSING_COMMA: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"(\d)([<>=~^!])").unwrap());
/// Ex) `!=~5.0`
static NOT_EQUAL_TILDE: Lazy<Regex> = Lazy::new(|| Regex::new(r"!=~((?:\d\.)*\d)").unwrap());
static NOT_EQUAL_TILDE: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"!=~((?:\d\.)*\d)").unwrap());
/// Ex) `>=1.9.*`, `<3.4.*`
static INVALID_TRAILING_DOT_STAR: Lazy<Regex> =
Lazy::new(|| Regex::new(r"(<=|>=|<|>)(\d+(\.\d+)*)\.\*").unwrap());
static INVALID_TRAILING_DOT_STAR: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"(<=|>=|<|>)(\d+(\.\d+)*)\.\*").unwrap());
/// Ex) `!=3.0*`
static MISSING_DOT: Lazy<Regex> = Lazy::new(|| Regex::new(r"(\d\.\d)+\*").unwrap());
static MISSING_DOT: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"(\d\.\d)+\*").unwrap());
/// Ex) `>=3.6,`
static TRAILING_COMMA: Lazy<Regex> = Lazy::new(|| Regex::new(r",\s*$").unwrap());
static TRAILING_COMMA: LazyLock<Regex> = LazyLock::new(|| Regex::new(r",\s*$").unwrap());
/// Ex) `>dev`
static GREATER_THAN_DEV: Lazy<Regex> = Lazy::new(|| Regex::new(r">dev").unwrap());
static GREATER_THAN_DEV: LazyLock<Regex> = LazyLock::new(|| Regex::new(r">dev").unwrap());
/// Ex) `>=9.0.0a1.0`
static TRAILING_ZERO: Lazy<Regex> =
Lazy::new(|| Regex::new(r"(\d+(\.\d)*(a|b|rc|post|dev)\d+)\.0").unwrap());
static TRAILING_ZERO: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"(\d+(\.\d)*(a|b|rc|post|dev)\d+)\.0").unwrap());
// Search and replace functions that fix invalid specifiers.
type FixUp = for<'a> fn(&'a str) -> Cow<'a, str>;
@ -74,7 +74,7 @@ static FIXUPS: &[(FixUp, &str)] = &[
// Given `>= 2.7'`, rewrite to `>= 2.7`
fn remove_stray_quotes(input: &str) -> Cow<'_, str> {
/// Ex) `'>= 2.7'`, `>=3.6'`
static STRAY_QUOTES: Lazy<Regex> = Lazy::new(|| Regex::new(r#"['"]"#).unwrap());
static STRAY_QUOTES: LazyLock<Regex> = LazyLock::new(|| Regex::new(r#"['"]"#).unwrap());
// make sure not to touch markers, which can have quotes (e.g. `python_version >= '3.7'`)
match input.find(';') {

View File

@ -12,7 +12,6 @@ async-trait = { workspace = true }
base64 = { workspace = true }
futures = { workspace = true }
http = { workspace = true }
once_cell = { workspace = true }
once-map = { workspace = true }
reqwest = { workspace = true }
reqwest-middleware = { workspace = true }

View File

@ -4,14 +4,13 @@ mod keyring;
mod middleware;
mod realm;
use std::sync::Arc;
use std::sync::{Arc, LazyLock};
use cache::CredentialsCache;
use credentials::Credentials;
pub use keyring::KeyringProvider;
pub use middleware::AuthMiddleware;
use once_cell::sync::Lazy;
use realm::Realm;
use tracing::trace;
use url::Url;
@ -21,7 +20,8 @@ use url::Url;
/// Global authentication cache for a uv invocation
///
/// This is used to share credentials across uv clients.
pub(crate) static CREDENTIALS_CACHE: Lazy<CredentialsCache> = Lazy::new(CredentialsCache::default);
pub(crate) static CREDENTIALS_CACHE: LazyLock<CredentialsCache> =
LazyLock::new(CredentialsCache::default);
/// Populate the global authentication store with credentials on a URL, if there are any.
///

View File

@ -28,7 +28,6 @@ anyhow = { workspace = true }
fs-err = { workspace = true }
indoc = { workspace = true }
itertools = { workspace = true }
once_cell = { workspace = true }
regex = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }

View File

@ -2,6 +2,13 @@
//!
//! <https://packaging.python.org/en/latest/specifications/source-distribution-format/>
use fs_err as fs;
use indoc::formatdoc;
use itertools::Itertools;
use regex::Regex;
use rustc_hash::FxHashMap;
use serde::de::{value, SeqAccess, Visitor};
use serde::{de, Deserialize, Deserializer};
use std::ffi::OsString;
use std::fmt::{Display, Formatter};
use std::io;
@ -9,16 +16,8 @@ use std::path::{Path, PathBuf};
use std::process::{ExitStatus, Output};
use std::rc::Rc;
use std::str::FromStr;
use std::sync::LazyLock;
use std::{env, iter};
use fs_err as fs;
use indoc::formatdoc;
use itertools::Itertools;
use once_cell::sync::Lazy;
use regex::Regex;
use rustc_hash::FxHashMap;
use serde::de::{value, SeqAccess, Visitor};
use serde::{de, Deserialize, Deserializer};
use tempfile::{tempdir_in, TempDir};
use thiserror::Error;
use tokio::process::Command;
@ -35,7 +34,7 @@ use uv_python::{Interpreter, PythonEnvironment};
use uv_types::{BuildContext, BuildIsolation, SourceBuildTrait};
/// e.g. `pygraphviz/graphviz_wrap.c:3020:10: fatal error: graphviz/cgraph.h: No such file or directory`
static MISSING_HEADER_RE_GCC: Lazy<Regex> = Lazy::new(|| {
static MISSING_HEADER_RE_GCC: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(
r".*\.(?:c|c..|h|h..):\d+:\d+: fatal error: (.*\.(?:h|h..)): No such file or directory",
)
@ -43,32 +42,32 @@ static MISSING_HEADER_RE_GCC: Lazy<Regex> = Lazy::new(|| {
});
/// e.g. `pygraphviz/graphviz_wrap.c:3023:10: fatal error: 'graphviz/cgraph.h' file not found`
static MISSING_HEADER_RE_CLANG: Lazy<Regex> = Lazy::new(|| {
static MISSING_HEADER_RE_CLANG: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r".*\.(?:c|c..|h|h..):\d+:\d+: fatal error: '(.*\.(?:h|h..))' file not found")
.unwrap()
});
/// e.g. `pygraphviz/graphviz_wrap.c(3023): fatal error C1083: Cannot open include file: 'graphviz/cgraph.h': No such file or directory`
static MISSING_HEADER_RE_MSVC: Lazy<Regex> = Lazy::new(|| {
static MISSING_HEADER_RE_MSVC: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r".*\.(?:c|c..|h|h..)\(\d+\): fatal error C1083: Cannot open include file: '(.*\.(?:h|h..))': No such file or directory")
.unwrap()
});
/// e.g. `/usr/bin/ld: cannot find -lncurses: No such file or directory`
static LD_NOT_FOUND_RE: Lazy<Regex> = Lazy::new(|| {
static LD_NOT_FOUND_RE: LazyLock<Regex> = LazyLock::new(|| {
Regex::new(r"/usr/bin/ld: cannot find -l([a-zA-Z10-9]+): No such file or directory").unwrap()
});
/// e.g. `error: invalid command 'bdist_wheel'`
static WHEEL_NOT_FOUND_RE: Lazy<Regex> =
Lazy::new(|| Regex::new(r"error: invalid command 'bdist_wheel'").unwrap());
static WHEEL_NOT_FOUND_RE: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"error: invalid command 'bdist_wheel'").unwrap());
/// e.g. `ModuleNotFoundError: No module named 'torch'`
static TORCH_NOT_FOUND_RE: Lazy<Regex> =
Lazy::new(|| Regex::new(r"ModuleNotFoundError: No module named 'torch'").unwrap());
static TORCH_NOT_FOUND_RE: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"ModuleNotFoundError: No module named 'torch'").unwrap());
/// The default backend to use when PEP 517 is used without a `build-system` section.
static DEFAULT_BACKEND: Lazy<Pep517Backend> = Lazy::new(|| Pep517Backend {
static DEFAULT_BACKEND: LazyLock<Pep517Backend> = LazyLock::new(|| Pep517Backend {
backend: "setuptools.build_meta:__legacy__".to_string(),
backend_path: None,
requirements: vec![Requirement::from(
@ -77,7 +76,7 @@ static DEFAULT_BACKEND: Lazy<Pep517Backend> = Lazy::new(|| Pep517Backend {
});
/// The requirements for `--legacy-setup-py` builds.
static SETUP_PY_REQUIREMENTS: Lazy<[Requirement; 2]> = Lazy::new(|| {
static SETUP_PY_REQUIREMENTS: LazyLock<[Requirement; 2]> = LazyLock::new(|| {
[
Requirement::from(pep508_rs::Requirement::from_str("setuptools >= 40.8.0").unwrap()),
Requirement::from(pep508_rs::Requirement::from_str("wheel").unwrap()),

View File

@ -5,11 +5,11 @@ This implementation was guided by the following things:
* RFCs 9110 and 9111.
* The `http-cache-semantics` crate. (The implementation here is completely
different, but the source of `http-cache-semantics` helped guide the
implementation here and understanding of HTTP caching.)
different, but the source of `http-cache-semantics` helped guide the
implementation here and understanding of HTTP caching.)
* A desire for our cache policy to support zero-copy deserialization. That
is, we want the cached response fast path (where no revalidation request is
necessary) to avoid any costly deserialization for the cache policy at all.
is, we want the cached response fast path (where no revalidation request is
necessary) to avoid any costly deserialization for the cache policy at all.
# Flow
@ -33,13 +33,13 @@ the server for a fresh response. In our case, the main utility of `max-age` is
two fold:
* PyPI sets a `max-age` of 600 seconds (10 minutes) on its responses. As long
as our cached responses have an age less than this, we can completely avoid
talking to PyPI at all when we need access to the full set of versions for a
package.
as our cached responses have an age less than this, we can completely avoid
talking to PyPI at all when we need access to the full set of versions for a
package.
* Most other assets, like wheels, are forever immutable. They will never
change. So servers will typically set a very high `max-age`, which means we
will almost never need to ask the server for permission to reuse our cached
wheel.
change. So servers will typically set a very high `max-age`, which means we
will almost never need to ask the server for permission to reuse our cached
wheel.
When a cached response exceeds the `max-age` configured on a response, then
we call that response stale. Generally speaking, we won't return responses

View File

@ -35,7 +35,6 @@ anyhow = { workspace = true }
fs-err = { workspace = true }
futures = { workspace = true }
nanoid = { workspace = true }
once_cell = { workspace = true }
path-absolutize = { workspace = true }
reqwest = { workspace = true }
reqwest-middleware = { workspace = true }

View File

@ -1,7 +1,6 @@
use std::collections::BTreeMap;
use std::path::Path;
use once_cell::sync::Lazy;
use std::sync::LazyLock;
use uv_configuration::PreviewMode;
use uv_normalize::{ExtraName, GroupName, PackageName};
@ -15,8 +14,8 @@ use crate::Metadata;
///
/// Internally, we model dependency groups as a generic concept; but externally, we only expose the
/// `dev-dependencies` group.
pub static DEV_DEPENDENCIES: Lazy<GroupName> =
Lazy::new(|| GroupName::new("dev".to_string()).unwrap());
pub static DEV_DEPENDENCIES: LazyLock<GroupName> =
LazyLock::new(|| GroupName::new("dev".to_string()).unwrap());
#[derive(Debug, Clone)]
pub struct RequiresDist {

View File

@ -22,7 +22,6 @@ either = { workspace = true }
encoding_rs_io = { workspace = true }
fs-err = { workspace = true }
fs2 = { workspace = true }
once_cell = { workspace = true }
path-absolutize = { workspace = true }
path-slash = { workspace = true }
tempfile = { workspace = true }

View File

@ -1,16 +1,16 @@
use either::Either;
use std::borrow::Cow;
use std::path::{Component, Path, PathBuf};
use std::sync::LazyLock;
use once_cell::sync::Lazy;
use either::Either;
use path_slash::PathExt;
/// The current working directory.
pub static CWD: Lazy<PathBuf> =
Lazy::new(|| std::env::current_dir().expect("The current directory must exist"));
pub static CWD: LazyLock<PathBuf> =
LazyLock::new(|| std::env::current_dir().expect("The current directory must exist"));
/// The current working directory, canonicalized.
pub static CANONICAL_CWD: Lazy<PathBuf> = Lazy::new(|| {
pub static CANONICAL_CWD: LazyLock<PathBuf> = LazyLock::new(|| {
std::env::current_dir()
.expect("The current directory must exist")
.canonicalize()

View File

@ -33,7 +33,6 @@ configparser = { workspace = true }
fs-err = { workspace = true, features = ["tokio"] }
futures = { workspace = true }
itertools = { workspace = true }
once_cell = { workspace = true }
owo-colors = { workspace = true }
regex = { workspace = true }
reqwest = { workspace = true }

View File

@ -2,10 +2,10 @@ use std::borrow::Cow;
use std::io;
use std::path::{Path, PathBuf};
use std::process::{Command, ExitStatus};
use std::sync::OnceLock;
use configparser::ini::Ini;
use fs_err as fs;
use once_cell::sync::OnceCell;
use same_file::is_same_file;
use serde::{Deserialize, Serialize};
use thiserror::Error;
@ -40,7 +40,7 @@ pub struct Interpreter {
sys_executable: PathBuf,
sys_path: Vec<PathBuf>,
stdlib: PathBuf,
tags: OnceCell<Tags>,
tags: OnceLock<Tags>,
target: Option<Target>,
prefix: Option<Prefix>,
pointer_size: PointerSize,
@ -72,7 +72,7 @@ impl Interpreter {
sys_executable: info.sys_executable,
sys_path: info.sys_path,
stdlib: info.stdlib,
tags: OnceCell::new(),
tags: OnceLock::new(),
target: None,
prefix: None,
})
@ -104,7 +104,7 @@ impl Interpreter {
sys_executable: PathBuf::from("/dev/null"),
sys_path: vec![],
stdlib: PathBuf::from("/dev/null"),
tags: OnceCell::new(),
tags: OnceLock::new(),
target: None,
prefix: None,
pointer_size: PointerSize::_64,
@ -204,15 +204,17 @@ impl Interpreter {
/// Returns the [`Tags`] for this Python executable.
pub fn tags(&self) -> Result<&Tags, TagsError> {
self.tags.get_or_try_init(|| {
Tags::from_env(
if self.tags.get().is_none() {
let tags = Tags::from_env(
self.platform(),
self.python_tuple(),
self.implementation_name(),
self.implementation_tuple(),
self.gil_disabled,
)
})
)?;
self.tags.set(tags).expect("tags should not be set");
}
Ok(self.tags.get().expect("tags should be set"))
}
/// Returns `true` if the environment is a PEP 405-compliant virtual environment.

View File

@ -1,9 +1,8 @@
use regex::Regex;
use std::io;
use std::path::PathBuf;
use std::process::{Command, ExitStatus};
use once_cell::sync::Lazy;
use regex::Regex;
use std::sync::LazyLock;
use thiserror::Error;
use tracing::info_span;
@ -34,7 +33,7 @@ pub enum Error {
/// -V:3.12 C:\Users\Ferris\AppData\Local\Programs\Python\Python312\python.exe
/// -V:3.8 C:\Users\Ferris\AppData\Local\Programs\Python\Python38\python.exe
/// ```
static PY_LIST_PATHS: Lazy<Regex> = Lazy::new(|| {
static PY_LIST_PATHS: LazyLock<Regex> = LazyLock::new(|| {
// Without the `R` flag, paths have trailing \r
Regex::new(r"(?mR)^ -(?:V:)?(\d).(\d+)-?(?:arm)?\d*\s*\*?\s*(.*)$").unwrap()
});

View File

@ -14,7 +14,6 @@ pypi-types = { workspace = true }
fs-err = { workspace = true, features = ["tokio"] }
memchr = { workspace = true }
once_cell = { workspace = true }
serde = { workspace = true, features = ["derive"] }
thiserror = { workspace = true }
toml = { workspace = true }

View File

@ -1,13 +1,12 @@
use std::io;
use std::path::Path;
use memchr::memmem::Finder;
use once_cell::sync::Lazy;
use pypi_types::VerbatimParsedUrl;
use serde::{Deserialize, Serialize};
use std::io;
use std::path::Path;
use std::sync::LazyLock;
use thiserror::Error;
static FINDER: Lazy<Finder> = Lazy::new(|| Finder::new(b"# /// script"));
static FINDER: LazyLock<Finder> = LazyLock::new(|| Finder::new(b"# /// script"));
/// PEP 723 metadata as parsed from a `script` comment block.
///

View File

@ -19,9 +19,9 @@ dependencies = [
[[package]]
name = "anstream"
version = "0.6.14"
version = "0.6.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b"
checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526"
dependencies = [
"anstyle",
"anstyle-parse",
@ -34,33 +34,33 @@ dependencies = [
[[package]]
name = "anstyle"
version = "1.0.7"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b"
checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
[[package]]
name = "anstyle-parse"
version = "0.2.4"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4"
checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.1.0"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391"
checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
dependencies = [
"windows-sys",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.3"
version = "3.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19"
checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
dependencies = [
"anstyle",
"windows-sys",
@ -74,9 +74,9 @@ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
[[package]]
name = "assert_cmd"
version = "2.0.14"
version = "2.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed72493ac66d5804837f480ab3766c72bdfab91a65e565fc54fa9e42db0073a8"
checksum = "bc65048dd435533bb1baf2ed9956b9a278fbfdcf90301b39ee117f06c0199d37"
dependencies = [
"anstyle",
"bstr",
@ -89,9 +89,9 @@ dependencies = [
[[package]]
name = "assert_fs"
version = "1.1.1"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cd762e110c8ed629b11b6cde59458cc1c71de78ebbcc30099fc8e0403a2a2ec"
checksum = "7efdb1fdb47602827a342857666feb372712cbc64b414172bd6b167a02927674"
dependencies = [
"anstyle",
"doc-comment",
@ -127,9 +127,9 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]]
name = "bstr"
version = "1.9.1"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706"
checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c"
dependencies = [
"memchr",
"regex-automata",
@ -159,9 +159,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "colorchoice"
version = "1.0.1"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0"
[[package]]
name = "crc32fast"
@ -361,9 +361,9 @@ dependencies = [
[[package]]
name = "is_terminal_polyfill"
version = "1.70.0"
version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
[[package]]
name = "junction"
@ -458,9 +458,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "predicates"
version = "3.1.0"
version = "3.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68b87bfd4605926cdfefc1c3b5f8fe560e3feca9d5552cf68c466d3d8236c7e8"
checksum = "7e9086cc7640c29a356d1a29fd134380bee9d8f79a17410aa76e7ad295f42c97"
dependencies = [
"anstyle",
"difflib",
@ -469,15 +469,15 @@ dependencies = [
[[package]]
name = "predicates-core"
version = "1.0.6"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174"
checksum = "ae8177bee8e75d6846599c6b9ff679ed51e882816914eec639944d7c9aa11931"
[[package]]
name = "predicates-tree"
version = "1.0.9"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf"
checksum = "41b740d195ed3166cd147c8047ec98db0e22ec019eb8eeb76d343b795304fb13"
dependencies = [
"predicates-core",
"termtree",
@ -485,18 +485,18 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.78"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.35"
version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
dependencies = [
"proc-macro2",
]
@ -599,7 +599,7 @@ checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.58",
"syn 2.0.72",
]
[[package]]
@ -615,9 +615,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.58"
version = "2.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687"
checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af"
dependencies = [
"proc-macro2",
"quote",
@ -659,7 +659,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.58",
"syn 2.0.72",
]
[[package]]
@ -681,7 +681,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.58",
"syn 2.0.72",
]
[[package]]
@ -750,7 +750,6 @@ dependencies = [
"fs-err",
"fs2",
"junction",
"once_cell",
"path-absolutize",
"path-slash",
"tempfile",
@ -782,7 +781,6 @@ name = "uv-warnings"
version = "0.0.1"
dependencies = [
"anstream",
"once_cell",
"owo-colors",
"rustc-hash",
]
@ -886,7 +884,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.58",
"syn 2.0.72",
]
[[package]]
@ -897,7 +895,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.58",
"syn 2.0.72",
]
[[package]]

View File

@ -14,6 +14,5 @@ workspace = true
[dependencies]
anstream = { workspace = true }
once_cell = { workspace = true }
owo-colors = { workspace = true }
rustc-hash = { workspace = true }

View File

@ -1,10 +1,9 @@
use std::sync::atomic::AtomicBool;
use std::sync::Mutex;
use std::sync::{LazyLock, Mutex};
// macro hygiene: The user might not have direct dependencies on those crates
#[doc(hidden)]
pub use anstream;
use once_cell::sync::Lazy;
#[doc(hidden)]
pub use owo_colors;
use rustc_hash::FxHashSet;
@ -37,7 +36,7 @@ macro_rules! warn_user {
};
}
pub static WARNINGS: Lazy<Mutex<FxHashSet<String>>> = Lazy::new(Mutex::default);
pub static WARNINGS: LazyLock<Mutex<FxHashSet<String>>> = LazyLock::new(Mutex::default);
/// Warn a user once, if warnings are enabled, with uniqueness determined by the content of the
/// message.

View File

@ -137,6 +137,7 @@ fn interpreter_meets_requirements(
}
#[derive(Debug)]
#[allow(clippy::large_enum_variant)]
pub(crate) enum FoundInterpreter {
Interpreter(Interpreter),
Environment(PythonEnvironment),

View File

@ -232,7 +232,7 @@ impl TestContext {
// And for the symlink we created in the test the Python path
filters.extend(
Self::path_patterns(&python_dir.join(version.to_string()))
Self::path_patterns(python_dir.join(version.to_string()))
.into_iter()
.map(|pattern| {
(
@ -338,7 +338,7 @@ impl TestContext {
.env("UV_NO_WRAP", "1")
.env("HOME", self.home_dir.as_os_str())
.env("UV_PYTHON_INSTALL_DIR", "")
.env("UV_TEST_PYTHON_PATH", &self.python_path())
.env("UV_TEST_PYTHON_PATH", self.python_path())
.env("UV_EXCLUDE_NEWER", EXCLUDE_NEWER)
.current_dir(self.temp_dir.path());

View File

@ -3117,7 +3117,7 @@ fn override_dependency_from_specific_uv_toml() -> Result<()> {
.arg("pyproject.toml")
.arg("--config-file")
.arg("../uv/uv.toml")
.current_dir(&context.temp_dir.child("project"))
.current_dir(context.temp_dir.child("project"))
, @r###"
success: true
exit_code: 0

View File

@ -530,7 +530,7 @@ fn workspace_lock_idempotence(workspace: &str, subdirectories: &[&str]) -> Resul
context
.lock()
.arg("--preview")
.current_dir(&work_dir.join(dir))
.current_dir(work_dir.join(dir))
.assert()
.success();

View File

@ -1,2 +1,2 @@
[toolchain]
channel = "1.79"
channel = "1.80"