diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a79f3b9324d59..e276dadc2e659 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,6 +82,8 @@ jobs: name: "cargo clippy | windows" steps: - uses: actions/checkout@v4 + - name: "Install nasm" + uses: ilammy/setup-nasm@v1 - name: "Install Rust toolchain" run: rustup target add x86_64-pc-windows-msvc - name: Load xwin cache @@ -201,7 +203,7 @@ jobs: steps: - name: Create Dev Drive using ReFS run: | - $Volume = New-VHD -Path C:/uv_dev_drive.vhdx -SizeBytes 12GB | + $Volume = New-VHD -Path C:/uv_dev_drive.vhdx -SizeBytes 14GB | Mount-VHD -Passthru | Initialize-Disk -Passthru | New-Partition -AssignDriveLetter -UseMaximumSize | @@ -216,6 +218,9 @@ jobs: run: | Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.DEV_DRIVE }}/uv" -Recurse + - name: "Install nasm" + uses: ilammy/setup-nasm@v1 + - name: "Install Rust toolchain" working-directory: ${{ env.DEV_DRIVE }}/uv env: @@ -412,7 +417,7 @@ jobs: steps: - name: Create Dev Drive using ReFS run: | - $Volume = New-VHD -Path C:/uv_dev_drive.vhdx -SizeBytes 10GB | + $Volume = New-VHD -Path C:/uv_dev_drive.vhdx -SizeBytes 12GB | Mount-VHD -Passthru | Initialize-Disk -Passthru | New-Partition -AssignDriveLetter -UseMaximumSize | @@ -429,6 +434,9 @@ jobs: - uses: rui314/setup-mold@v1 + - name: "Install nasm" + uses: ilammy/setup-nasm@v1 + - uses: Swatinem/rust-cache@v2 with: workspaces: ${{ env.DEV_DRIVE }}/uv diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f7ab2827ee157..e3240a6ceeabd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,6 +28,12 @@ See the [Python](#python) section for instructions on installing the Python vers You can install CMake from the [installers](https://cmake.org/download/) or with `pipx install cmake`. +Only on Windows, you also need to install the [Netwide Assembler (NASM)](https://nasm.us/) and add its installation directory to your PATH: + +``` +set PATH="C:\Program Files\NASM;%PATH%" +``` + ## Testing For running tests, we recommend [nextest](https://nexte.st/). diff --git a/Cargo.lock b/Cargo.lock index a73d11f83c922..6358ea65e5bce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -273,6 +273,33 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +[[package]] +name = "aws-lc-rs" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8a47f2fb521b70c11ce7369a6c5fa4bd6af7e5d62ec06303875bafe7c6ba245" +dependencies = [ + "aws-lc-sys", + "mirai-annotations", + "paste", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2927c7af777b460b7ccd95f8b67acd7b4c04ec8896bf0c8e80ba30523cffc057" +dependencies = [ + "bindgen", + "cc", + "cmake", + "dunce", + "fs_extra", + "libc", + "paste", +] + [[package]] name = "axoasset" version = "0.9.5" @@ -413,6 +440,29 @@ dependencies = [ "uv-types", ] +[[package]] +name = "bindgen" +version = "0.69.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +dependencies = [ + "bitflags 2.5.0", + "cexpr", + "clang-sys", + "itertools 0.12.1", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash 1.1.0", + "shlex", + "syn 2.0.68", + "which 4.4.2", +] + [[package]] name = "bisection" version = "0.1.0" @@ -618,6 +668,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -682,6 +741,17 @@ dependencies = [ "half", ] +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "clap" version = "4.5.8" @@ -1320,6 +1390,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "funty" version = "2.0.0" @@ -1978,12 +2054,28 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "libc" version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +[[package]] +name = "libloading" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d" +dependencies = [ + "cfg-if", + "windows-targets 0.52.5", +] + [[package]] name = "libmimalloc-sys" version = "0.1.39" @@ -2160,6 +2252,12 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.7.3" @@ -2190,6 +2288,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "mirai-annotations" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" + [[package]] name = "nanoid" version = "0.4.0" @@ -2224,6 +2328,16 @@ dependencies = [ "libc", ] +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "normalize-line-endings" version = "0.3.0" @@ -2654,6 +2768,16 @@ dependencies = [ "yansi", ] +[[package]] +name = "prettyplease" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" +dependencies = [ + "proc-macro2", + "syn 2.0.68", +] + [[package]] name = "priority-queue" version = "2.0.3" @@ -2716,7 +2840,7 @@ dependencies = [ "indoc", "libc", "memoffset 0.9.1", - "parking_lot 0.11.2", + "parking_lot 0.12.3", "portable-atomic", "pyo3-build-config", "pyo3-ffi", @@ -3328,6 +3452,8 @@ version = "0.23.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" dependencies = [ + "aws-lc-rs", + "log", "once_cell", "ring", "rustls-pki-types", @@ -3371,6 +3497,7 @@ version = "0.102.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" dependencies = [ + "aws-lc-rs", "ring", "rustls-pki-types", "untrusted", @@ -3571,6 +3698,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f" +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -4625,6 +4758,7 @@ dependencies = [ "reqwest-retry", "rkyv", "rmp-serde", + "rustls", "serde", "serde_json", "sys-info", @@ -5095,7 +5229,7 @@ dependencies = [ "uv-fs", "uv-state", "uv-warnings", - "which", + "which 6.0.1", "winapi", ] @@ -5314,6 +5448,18 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] + [[package]] name = "which" version = "6.0.1" @@ -5698,6 +5844,20 @@ name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] [[package]] name = "zip" diff --git a/Cargo.toml b/Cargo.toml index fe3dc12338879..b16c32e31b2c5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -112,12 +112,13 @@ quote = { version = "1.0.36" } rayon = { version = "1.8.0" } reflink-copy = { version = "0.1.15" } regex = { version = "1.10.2" } -reqwest = { version = "0.12.3", default-features = false, features = ["json", "gzip", "brotli", "stream", "rustls-tls", "rustls-tls-native-roots"] } +reqwest = { version = "0.12.5", default-features = false, features = ["json", "gzip", "brotli", "stream", "rustls-tls", "rustls-tls-native-roots"] } reqwest-middleware = { git = "https://github.com/astral-sh/reqwest-middleware", rev = "21ceec9a5fd2e8d6f71c3ea2999078fecbd13cbe" } reqwest-retry = { git = "https://github.com/astral-sh/reqwest-middleware", rev = "21ceec9a5fd2e8d6f71c3ea2999078fecbd13cbe" } rkyv = { version = "0.7.43", features = ["strict", "validation"] } rmp-serde = { version = "1.1.2" } rust-netrc = { version = "0.1.1" } +rustls = { version = "0.23.10", features = ["aws_lc_rs"] } rustc-hash = { version = "2.0.0" } same-file = { version = "1.0.6" } schemars = { version = "0.8.16", features = ["url"] } diff --git a/crates/uv-client/Cargo.toml b/crates/uv-client/Cargo.toml index 8b5657b4f310b..93b9cc1017984 100644 --- a/crates/uv-client/Cargo.toml +++ b/crates/uv-client/Cargo.toml @@ -36,6 +36,7 @@ itertools = { workspace = true } reqwest = { workspace = true } reqwest-middleware = { workspace = true } reqwest-retry = { workspace = true } +rustls = { workspace = true } rkyv = { workspace = true } rmp-serde = { workspace = true } serde = { workspace = true } diff --git a/crates/uv-client/src/base_client.rs b/crates/uv-client/src/base_client.rs index c3ae039df9049..3a1f8be3910e4 100644 --- a/crates/uv-client/src/base_client.rs +++ b/crates/uv-client/src/base_client.rs @@ -11,6 +11,7 @@ use reqwest_retry::policies::ExponentialBackoff; use reqwest_retry::{ DefaultRetryableStrategy, RetryTransientMiddleware, Retryable, RetryableStrategy, }; +use rustls::crypto::{aws_lc_rs, CryptoProvider}; use tracing::debug; use pep508_rs::MarkerEnvironment; @@ -136,6 +137,13 @@ impl<'a> BaseClientBuilder<'a> { // Initialize the base client. let client = self.client.clone().unwrap_or_else(|| { + if CryptoProvider::get_default().is_none() { + // Use aws_lc_rs as the default TLS provider to support more SSL cert algorithms + if aws_lc_rs::default_provider().install_default().is_err() { + warn_user_once!("Failed to install aws_lc_rs as the default TLS provider."); + } + }; + // Check for the presence of an `SSL_CERT_FILE`. let ssl_cert_file_exists = env::var_os("SSL_CERT_FILE").is_some_and(|path| { let path_exists = Path::new(&path).exists();