diff --git a/crates/uv-distribution-types/src/prioritized_distribution.rs b/crates/uv-distribution-types/src/prioritized_distribution.rs index ae02e7735..def371bc2 100644 --- a/crates/uv-distribution-types/src/prioritized_distribution.rs +++ b/crates/uv-distribution-types/src/prioritized_distribution.rs @@ -1,6 +1,8 @@ use std::fmt::{Display, Formatter}; -use uv_distribution_filename::{BuildTag, WheelFilename}; +use tracing::debug; + +use uv_distribution_filename::{BuildTag, WheelFilename}; use uv_pep440::VersionSpecifiers; use uv_pep508::{MarkerExpression, MarkerOperator, MarkerTree, MarkerValueString}; use uv_platform_tags::{IncompatibleTag, TagPriority}; @@ -634,6 +636,9 @@ impl IncompatibleWheel { } /// Given a wheel filename, determine the set of supported platforms, in terms of their markers. +/// +/// This is roughly the inverse of platform tag generation: given a tag, we want to infer the +/// supported platforms (rather than generating the supported tags from a given platform). pub fn implied_markers(filename: &WheelFilename) -> MarkerTree { let mut marker = MarkerTree::FALSE; for platform_tag in &filename.platform_tag { @@ -641,32 +646,281 @@ pub fn implied_markers(filename: &WheelFilename) -> MarkerTree { "any" => { return MarkerTree::TRUE; } - tag if tag.starts_with("win") => { - marker.or(MarkerTree::expression(MarkerExpression::String { + + // Windows + "win32" => { + let mut tag_marker = MarkerTree::expression(MarkerExpression::String { key: MarkerValueString::SysPlatform, operator: MarkerOperator::Equal, value: "win32".to_string(), + }); + tag_marker.and(MarkerTree::expression(MarkerExpression::String { + key: MarkerValueString::PlatformMachine, + operator: MarkerOperator::Equal, + value: "x86".to_string(), })); + marker.or(tag_marker); } - tag if tag.starts_with("macosx") => { - marker.or(MarkerTree::expression(MarkerExpression::String { + "win_amd64" => { + let mut tag_marker = MarkerTree::expression(MarkerExpression::String { + key: MarkerValueString::SysPlatform, + operator: MarkerOperator::Equal, + value: "win32".to_string(), + }); + tag_marker.and(MarkerTree::expression(MarkerExpression::String { + key: MarkerValueString::PlatformMachine, + operator: MarkerOperator::Equal, + value: "x86_64".to_string(), + })); + marker.or(tag_marker); + } + "win_arm64" => { + let mut tag_marker = MarkerTree::expression(MarkerExpression::String { + key: MarkerValueString::SysPlatform, + operator: MarkerOperator::Equal, + value: "win32".to_string(), + }); + tag_marker.and(MarkerTree::expression(MarkerExpression::String { + key: MarkerValueString::PlatformMachine, + operator: MarkerOperator::Equal, + value: "arm64".to_string(), + })); + marker.or(tag_marker); + } + + // macOS + tag if tag.starts_with("macosx_") => { + let mut tag_marker = MarkerTree::expression(MarkerExpression::String { key: MarkerValueString::SysPlatform, operator: MarkerOperator::Equal, value: "darwin".to_string(), - })); + }); + + // Parse the macOS version from the tag. + // + // For example, given `macosx_10_9_x86_64`, infer `10.9`, followed by `x86_64`. + // + // If at any point we fail to parse, we assume the tag is invalid and skip it. + let mut parts = tag.splitn(4, '_'); + + // Skip the "macosx_" prefix. + if parts.next().is_none_or(|part| part != "macosx") { + debug!("Failed to parse macOS prefix from tag: {tag}"); + continue; + } + + // Skip the major and minor version numbers. + if parts + .next() + .and_then(|part| part.parse::().ok()) + .is_none() + { + debug!("Failed to parse macOS major version from tag: {tag}"); + continue; + }; + if parts + .next() + .and_then(|part| part.parse::().ok()) + .is_none() + { + debug!("Failed to parse macOS minor version from tag: {tag}"); + continue; + }; + + // Extract the architecture from the end of the tag. + let Some(arch) = parts.next() else { + debug!("Failed to parse macOS architecture from tag: {tag}"); + continue; + }; + + // Extract the architecture from the end of the tag. + let mut arch_marker = MarkerTree::FALSE; + let supported_architectures = match arch { + "universal" => { + // Allow any of: "x86_64", "i386", "ppc64", "ppc", "intel" + ["x86_64", "i386", "ppc64", "ppc", "intel"].iter() + } + "universal2" => { + // Allow any of: "x86_64", "arm64" + ["x86_64", "arm64"].iter() + } + "intel" => { + // Allow any of: "x86_64", "i386" + ["x86_64", "i386"].iter() + } + "x86_64" => { + // Allow only "x86_64" + ["x86_64"].iter() + } + "arm64" => { + // Allow only "arm64" + ["arm64"].iter() + } + "ppc64" => { + // Allow only "ppc64" + ["ppc64"].iter() + } + "ppc" => { + // Allow only "ppc" + ["ppc"].iter() + } + "i386" => { + // Allow only "i386" + ["i386"].iter() + } + _ => { + debug!("Unknown macOS architecture in wheel tag: {tag}"); + continue; + } + }; + for arch in supported_architectures { + arch_marker.or(MarkerTree::expression(MarkerExpression::String { + key: MarkerValueString::PlatformMachine, + operator: MarkerOperator::Equal, + value: (*arch).to_string(), + })); + } + tag_marker.and(arch_marker); + + marker.or(tag_marker); } - tag if tag.starts_with("manylinux") - || tag.starts_with("musllinux") - || tag.starts_with("linux") => - { - marker.or(MarkerTree::expression(MarkerExpression::String { + + // Linux + tag => { + let mut tag_marker = MarkerTree::expression(MarkerExpression::String { key: MarkerValueString::SysPlatform, operator: MarkerOperator::Equal, value: "linux".to_string(), + }); + + // Parse the architecture from the tag. + let arch = if let Some(arch) = tag.strip_prefix("linux_") { + arch + } else if let Some(arch) = tag.strip_prefix("manylinux1_") { + arch + } else if let Some(arch) = tag.strip_prefix("manylinux2010_") { + arch + } else if let Some(arch) = tag.strip_prefix("manylinux2014_") { + arch + } else if let Some(arch) = tag.strip_prefix("musllinux_") { + // Skip over the version tags (e.g., given `musllinux_1_2`, skip over `1` and `2`). + let mut parts = arch.splitn(3, '_'); + if parts + .next() + .and_then(|part| part.parse::().ok()) + .is_none() + { + debug!("Failed to parse musllinux major version from tag: {tag}"); + continue; + }; + if parts + .next() + .and_then(|part| part.parse::().ok()) + .is_none() + { + debug!("Failed to parse musllinux minor version from tag: {tag}"); + continue; + }; + let Some(arch) = parts.next() else { + debug!("Failed to parse musllinux architecture from tag: {tag}"); + continue; + }; + arch + } else if let Some(arch) = tag.strip_prefix("manylinux_") { + // Skip over the version tags (e.g., given `manylinux_2_17`, skip over `2` and `17`). + let mut parts = arch.splitn(3, '_'); + if parts + .next() + .and_then(|part| part.parse::().ok()) + .is_none() + { + debug!("Failed to parse manylinux major version from tag: {tag}"); + continue; + }; + if parts + .next() + .and_then(|part| part.parse::().ok()) + .is_none() + { + debug!("Failed to parse manylinux minor version from tag: {tag}"); + continue; + }; + let Some(arch) = parts.next() else { + debug!("Failed to parse manylinux architecture from tag: {tag}"); + continue; + }; + arch + } else { + continue; + }; + tag_marker.and(MarkerTree::expression(MarkerExpression::String { + key: MarkerValueString::PlatformMachine, + operator: MarkerOperator::Equal, + value: arch.to_string(), })); + + marker.or(tag_marker); } - _ => {} } } marker } + +#[cfg(test)] +mod tests { + use std::str::FromStr; + + use super::*; + + #[track_caller] + fn assert_markers(filename: &str, expected: &str) { + let filename = WheelFilename::from_str(filename).unwrap(); + assert_eq!( + implied_markers(&filename), + expected.parse::().unwrap() + ); + } + + #[test] + fn test_implied_markers() { + let filename = WheelFilename::from_str("example-1.0-py3-none-any.whl").unwrap(); + assert_eq!(implied_markers(&filename), MarkerTree::TRUE); + + assert_markers( + "example-1.0-cp310-cp310-win32.whl", + "sys_platform == 'win32' and platform_machine == 'x86'", + ); + assert_markers( + "numpy-2.2.1-cp313-cp313t-win_amd64.whl", + "sys_platform == 'win32' and platform_machine == 'x86_64'", + ); + assert_markers( + "numpy-2.2.1-cp313-cp313t-win_arm64.whl", + "sys_platform == 'win32' and platform_machine == 'arm64'", + ); + assert_markers( + "numpy-2.2.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", + "sys_platform == 'linux' and platform_machine == 'aarch64'", + ); + assert_markers( + "numpy-2.2.1-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", + "sys_platform == 'linux' and platform_machine == 'x86_64'", + ); + assert_markers( + "numpy-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", + "sys_platform == 'linux' and platform_machine == 'aarch64'", + ); + assert_markers( + "numpy-2.2.1-cp310-cp310-macosx_14_0_x86_64.whl", + "sys_platform == 'darwin' and platform_machine == 'x86_64'", + ); + assert_markers( + "numpy-2.2.1-cp310-cp310-macosx_10_9_x86_64.whl", + "sys_platform == 'darwin' and platform_machine == 'x86_64'", + ); + assert_markers( + "numpy-2.2.1-cp310-cp310-macosx_11_0_arm64.whl", + "sys_platform == 'darwin' and platform_machine == 'arm64'", + ); + } +} diff --git a/crates/uv-resolver/src/resolver/mod.rs b/crates/uv-resolver/src/resolver/mod.rs index e57bc54e1..e6d36cbdb 100644 --- a/crates/uv-resolver/src/resolver/mod.rs +++ b/crates/uv-resolver/src/resolver/mod.rs @@ -31,7 +31,7 @@ use uv_distribution_types::{ use uv_git::GitResolver; use uv_normalize::{ExtraName, GroupName, PackageName}; use uv_pep440::{release_specifiers_to_ranges, Version, VersionSpecifiers, MIN_VERSION}; -use uv_pep508::MarkerTree; +use uv_pep508::{MarkerExpression, MarkerOperator, MarkerTree, MarkerValueString}; use uv_platform_tags::Tags; use uv_pypi_types::{ConflictItem, ConflictItemRef, Conflicts, Requirement, VerbatimParsedUrl}; use uv_types::{BuildContext, HashStrategy, InstalledPackagesProvider}; @@ -1372,7 +1372,7 @@ impl ResolverState ResolverState Result<()> { ----- stdout ----- ----- stderr ----- - Resolved 31 packages in [TIME] + Resolved 33 packages in [TIME] "###); let lock = context.read("uv.lock"); @@ -21460,9 +21460,10 @@ fn lock_pytorch_cpu() -> Result<()> { resolution-markers = [ "python_full_version >= '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux'", "python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux'", - "platform_machine != 'x86_64' or sys_platform != 'linux'", - "sys_platform != 'darwin'", - "sys_platform == 'darwin'", + "(platform_machine != 'aarch64' and platform_machine != 'x86_64') or sys_platform != 'linux'", + "platform_machine == 'aarch64' and sys_platform == 'linux'", + "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')", + "(platform_machine == 'aarch64' and sys_platform == 'linux') or sys_platform == 'darwin'", ] conflicts = [[ { package = "project", extra = "cpu" }, @@ -21801,14 +21802,16 @@ fn lock_pytorch_cpu() -> Result<()> { [package.optional-dependencies] cpu = [ - { name = "torch", version = "2.5.1", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "sys_platform == 'darwin'" }, - { name = "torch", version = "2.5.1+cpu", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "sys_platform != 'darwin'" }, - { name = "torchvision", version = "0.20.1", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "sys_platform == 'darwin'" }, - { name = "torchvision", version = "0.20.1+cpu", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "sys_platform != 'darwin'" }, + { name = "torch", version = "2.5.1", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or sys_platform == 'darwin'" }, + { name = "torch", version = "2.5.1+cpu", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, + { name = "torchvision", version = "0.20.1", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or sys_platform == 'darwin'" }, + { name = "torchvision", version = "0.20.1+cpu", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, ] cu124 = [ - { name = "torch", version = "2.5.1+cu124", source = { registry = "https://download.pytorch.org/whl/cu124" } }, - { name = "torchvision", version = "0.20.1+cu124", source = { registry = "https://download.pytorch.org/whl/cu124" } }, + { name = "torch", version = "2.5.1", source = { registry = "https://download.pytorch.org/whl/cu124" }, marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" }, + { name = "torch", version = "2.5.1+cu124", source = { registry = "https://download.pytorch.org/whl/cu124" }, marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "torchvision", version = "0.20.1", source = { registry = "https://download.pytorch.org/whl/cu124" }, marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" }, + { name = "torchvision", version = "0.20.1+cu124", source = { registry = "https://download.pytorch.org/whl/cu124" }, marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, ] [package.metadata] @@ -21847,37 +21850,57 @@ fn lock_pytorch_cpu() -> Result<()> { version = "2.5.1" source = { registry = "https://download.pytorch.org/whl/cpu" } resolution-markers = [ - "sys_platform == 'darwin'", + "(platform_machine == 'aarch64' and sys_platform == 'linux') or sys_platform == 'darwin'", ] dependencies = [ - { name = "filelock", marker = "sys_platform == 'darwin'" }, - { name = "fsspec", marker = "sys_platform == 'darwin'" }, - { name = "jinja2", marker = "sys_platform == 'darwin'" }, - { name = "networkx", marker = "sys_platform == 'darwin'" }, - { name = "setuptools", marker = "sys_platform == 'darwin'" }, - { name = "sympy", marker = "sys_platform == 'darwin'" }, - { name = "typing-extensions", marker = "sys_platform == 'darwin'" }, + { name = "filelock", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or sys_platform == 'darwin'" }, + { name = "fsspec", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or sys_platform == 'darwin'" }, + { name = "jinja2", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or sys_platform == 'darwin'" }, + { name = "networkx", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or sys_platform == 'darwin'" }, + { name = "setuptools", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or sys_platform == 'darwin'" }, + { name = "sympy", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or sys_platform == 'darwin'" }, + { name = "typing-extensions", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or sys_platform == 'darwin'" }, ] wheels = [ { url = "https://download.pytorch.org/whl/cpu/torch-2.5.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:36d1be99281b6f602d9639bd0af3ee0006e7aab16f6718d86f709d395b6f262c" }, { url = "https://download.pytorch.org/whl/cpu/torch-2.5.1-cp312-none-macosx_11_0_arm64.whl", hash = "sha256:8c712df61101964eb11910a846514011f0b6f5920c55dbf567bff8a34163d5b1" }, ] + [[package]] + name = "torch" + version = "2.5.1" + source = { registry = "https://download.pytorch.org/whl/cu124" } + resolution-markers = [ + "platform_machine == 'aarch64' and sys_platform == 'linux'", + ] + dependencies = [ + { name = "filelock", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" }, + { name = "fsspec", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" }, + { name = "jinja2", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" }, + { name = "networkx", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" }, + { name = "setuptools", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" }, + { name = "sympy", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" }, + { name = "typing-extensions", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" }, + ] + wheels = [ + { url = "https://download.pytorch.org/whl/cu124/torch-2.5.1-cp312-cp312-linux_aarch64.whl", hash = "sha256:302041d457ee169fd925b53da283c13365c6de75c6bb3e84130774b10e2fbb39" }, + ] + [[package]] name = "torch" version = "2.5.1+cpu" source = { registry = "https://download.pytorch.org/whl/cpu" } resolution-markers = [ - "sys_platform != 'darwin'", + "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')", ] dependencies = [ - { name = "filelock", marker = "sys_platform != 'darwin'" }, - { name = "fsspec", marker = "sys_platform != 'darwin'" }, - { name = "jinja2", marker = "sys_platform != 'darwin'" }, - { name = "networkx", marker = "sys_platform != 'darwin'" }, - { name = "setuptools", marker = "sys_platform != 'darwin'" }, - { name = "sympy", marker = "sys_platform != 'darwin'" }, - { name = "typing-extensions", marker = "sys_platform != 'darwin'" }, + { name = "filelock", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, + { name = "fsspec", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, + { name = "jinja2", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, + { name = "networkx", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, + { name = "setuptools", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, + { name = "sympy", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, + { name = "typing-extensions", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, ] wheels = [ { url = "https://download.pytorch.org/whl/cpu/torch-2.5.1%2Bcpu-cp312-cp312-linux_x86_64.whl", hash = "sha256:4856f9d6925121d13c2df07aa7580b767f449dfe71ae5acde9c27535d5da4840" }, @@ -21892,13 +21915,13 @@ fn lock_pytorch_cpu() -> Result<()> { resolution-markers = [ "python_full_version >= '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux'", "python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux'", - "platform_machine != 'x86_64' or sys_platform != 'linux'", + "(platform_machine != 'aarch64' and platform_machine != 'x86_64') or sys_platform != 'linux'", ] dependencies = [ - { name = "filelock" }, - { name = "fsspec" }, - { name = "jinja2" }, - { name = "networkx" }, + { name = "filelock", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "fsspec", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "jinja2", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "networkx", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, { name = "nvidia-cublas-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" }, { name = "nvidia-cuda-cupti-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" }, { name = "nvidia-cuda-nvrtc-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" }, @@ -21911,10 +21934,10 @@ fn lock_pytorch_cpu() -> Result<()> { { name = "nvidia-nccl-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" }, { name = "nvidia-nvjitlink-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" }, { name = "nvidia-nvtx-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" }, - { name = "setuptools" }, - { name = "sympy" }, + { name = "setuptools", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "sympy", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, { name = "triton", marker = "python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux'" }, - { name = "typing-extensions" }, + { name = "typing-extensions", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, ] wheels = [ { url = "https://download.pytorch.org/whl/cu124/torch-2.5.1%2Bcu124-cp312-cp312-linux_x86_64.whl", hash = "sha256:bf6484bfe5bc4f92a4a1a1bf553041505e19a911f717065330eb061afe0e14d7" }, @@ -21927,29 +21950,45 @@ fn lock_pytorch_cpu() -> Result<()> { version = "0.20.1" source = { registry = "https://download.pytorch.org/whl/cpu" } resolution-markers = [ - "sys_platform == 'darwin'", + "(platform_machine == 'aarch64' and sys_platform == 'linux') or sys_platform == 'darwin'", ] dependencies = [ - { name = "numpy", marker = "sys_platform == 'darwin'" }, - { name = "pillow", marker = "sys_platform == 'darwin'" }, - { name = "torch", version = "2.5.1", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "sys_platform == 'darwin'" }, + { name = "numpy", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or sys_platform == 'darwin'" }, + { name = "pillow", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or sys_platform == 'darwin'" }, + { name = "torch", version = "2.5.1", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or sys_platform == 'darwin'" }, ] wheels = [ { url = "https://download.pytorch.org/whl/cpu/torchvision-0.20.1-cp312-cp312-linux_aarch64.whl", hash = "sha256:9f853ba4497ac4691815ad41b523ee23cf5ba4f87b1ce869d704052e233ca8b7" }, { url = "https://download.pytorch.org/whl/cpu/torchvision-0.20.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1a31256ff945d64f006bb306813a7c95a531fe16bfb2535c837dd4c104533d7a" }, ] + [[package]] + name = "torchvision" + version = "0.20.1" + source = { registry = "https://download.pytorch.org/whl/cu124" } + resolution-markers = [ + "platform_machine == 'aarch64' and sys_platform == 'linux'", + ] + dependencies = [ + { name = "numpy", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" }, + { name = "pillow", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" }, + { name = "torch", version = "2.5.1", source = { registry = "https://download.pytorch.org/whl/cu124" }, marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" }, + ] + wheels = [ + { url = "https://download.pytorch.org/whl/cu124/torchvision-0.20.1-cp312-cp312-linux_aarch64.whl", hash = "sha256:3e3289e53d0cb5d1b7f55b3f5912f46a08293c6791585ba2fc32c12cded9f9af" }, + ] + [[package]] name = "torchvision" version = "0.20.1+cpu" source = { registry = "https://download.pytorch.org/whl/cpu" } resolution-markers = [ - "sys_platform != 'darwin'", + "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')", ] dependencies = [ - { name = "numpy", marker = "sys_platform != 'darwin'" }, - { name = "pillow", marker = "sys_platform != 'darwin'" }, - { name = "torch", version = "2.5.1+cpu", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "sys_platform != 'darwin'" }, + { name = "numpy", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, + { name = "pillow", marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, + { name = "torch", version = "2.5.1+cpu", source = { registry = "https://download.pytorch.org/whl/cpu" }, marker = "(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')" }, ] wheels = [ { url = "https://download.pytorch.org/whl/cpu/torchvision-0.20.1%2Bcpu-cp312-cp312-linux_x86_64.whl", hash = "sha256:5f46c7ac7f00a065cb40bfb1e1bfc4ba16a35f5d46b3fe70cca6b3cea7f822f7" }, @@ -21963,12 +22002,12 @@ fn lock_pytorch_cpu() -> Result<()> { resolution-markers = [ "python_full_version >= '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux'", "python_full_version < '3.13' and platform_machine == 'x86_64' and sys_platform == 'linux'", - "platform_machine != 'x86_64' or sys_platform != 'linux'", + "(platform_machine != 'aarch64' and platform_machine != 'x86_64') or sys_platform != 'linux'", ] dependencies = [ - { name = "numpy" }, - { name = "pillow" }, - { name = "torch", version = "2.5.1+cu124", source = { registry = "https://download.pytorch.org/whl/cu124" } }, + { name = "numpy", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "pillow", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "torch", version = "2.5.1+cu124", source = { registry = "https://download.pytorch.org/whl/cu124" }, marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, ] wheels = [ { url = "https://download.pytorch.org/whl/cu124/torchvision-0.20.1%2Bcu124-cp312-cp312-linux_x86_64.whl", hash = "sha256:d1053ec5054549e7dac2613b151bffe323f3c924939d296df4d7d34925aaf3ad" }, diff --git a/crates/uv/tests/it/pip_compile.rs b/crates/uv/tests/it/pip_compile.rs index 1a6de326a..f4ae05acd 100644 --- a/crates/uv/tests/it/pip_compile.rs +++ b/crates/uv/tests/it/pip_compile.rs @@ -7494,9 +7494,9 @@ fn universal_platform_fork() -> Result<()> { # via torch sympy==1.13.1 # via torch - torch==2.5.1 ; sys_platform == 'darwin' + torch==2.5.1 ; (platform_machine == 'aarch64' and sys_platform == 'linux') or sys_platform == 'darwin' # via -r requirements.in - torch==2.5.1+cpu ; sys_platform != 'darwin' + torch==2.5.1+cpu ; (platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux') # via -r requirements.in typing-extensions==4.9.0 # via torch @@ -7629,9 +7629,9 @@ fn universal_transitive_disjoint_locals() -> Result<()> { # -r requirements.in # torchvision # triton - torchvision==0.15.1 ; sys_platform == 'darwin' or sys_platform == 'win32' + torchvision==0.15.1 ; platform_machine != 'x86_64' or sys_platform == 'darwin' or sys_platform == 'win32' # via -r requirements.in - torchvision==0.15.1+rocm5.4.2 ; sys_platform != 'darwin' and sys_platform != 'win32' + torchvision==0.15.1+rocm5.4.2 ; platform_machine == 'x86_64' and sys_platform != 'darwin' and sys_platform != 'win32' # via -r requirements.in triton==2.0.0 ; platform_machine == 'x86_64' and sys_platform == 'linux' # via torch @@ -7924,11 +7924,11 @@ fn universal_disjoint_base_or_local_requirement() -> Result<()> { # via torch sympy==1.12 # via torch - torch==2.0.0 ; python_full_version < '3.11' and sys_platform == 'darwin' + torch==2.0.0 ; (python_full_version < '3.11' and platform_machine == 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.11' and sys_platform == 'darwin') # via # -r requirements.in # example - torch==2.0.0+cpu ; python_full_version >= '3.13' or (python_full_version < '3.11' and sys_platform != 'darwin') + torch==2.0.0+cpu ; python_full_version >= '3.13' or (python_full_version < '3.11' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.11' and sys_platform != 'darwin' and sys_platform != 'linux') # via # -r requirements.in # example @@ -7963,15 +7963,15 @@ fn universal_nested_overlapping_local_requirement() -> Result<()> { name = "example" version = "0.0.0" dependencies = [ - "torch==2.0.0+cu118 ; platform_machine == 'x86_64' and os_name == 'Linux'" + "torch==2.0.0+cu118 ; implementation_name == 'cpython' and os_name == 'Linux'" ] requires-python = ">=3.11" "#})?; let requirements_in = context.temp_dir.child("requirements.in"); requirements_in.write_str(indoc! {" - torch==2.0.0 ; platform_machine == 'x86_64' - torch==2.3.0 ; platform_machine != 'x86_64' + torch==2.0.0 ; implementation_name == 'cpython' + torch==2.3.0 ; implementation_name != 'cpython' . "})?; @@ -7985,7 +7985,7 @@ fn universal_nested_overlapping_local_requirement() -> Result<()> { ----- stdout ----- # This file was autogenerated by uv via the following command: # uv pip compile --cache-dir [CACHE_DIR] requirements.in --universal - cmake==3.28.4 ; platform_machine == 'x86_64' and sys_platform == 'linux' + cmake==3.28.4 ; implementation_name == 'cpython' and platform_machine == 'x86_64' and sys_platform == 'linux' # via triton . # via -r requirements.in @@ -7994,38 +7994,38 @@ fn universal_nested_overlapping_local_requirement() -> Result<()> { # pytorch-triton-rocm # torch # triton - fsspec==2024.3.1 ; platform_machine != 'x86_64' + fsspec==2024.3.1 ; implementation_name != 'cpython' # via torch - intel-openmp==2021.4.0 ; platform_machine != 'x86_64' and sys_platform == 'win32' + intel-openmp==2021.4.0 ; implementation_name != 'cpython' and sys_platform == 'win32' # via mkl jinja2==3.1.3 # via torch - lit==18.1.2 ; platform_machine == 'x86_64' and sys_platform == 'linux' + lit==18.1.2 ; implementation_name == 'cpython' and platform_machine == 'x86_64' and sys_platform == 'linux' # via triton markupsafe==2.1.5 # via jinja2 - mkl==2021.4.0 ; platform_machine != 'x86_64' and sys_platform == 'win32' + mkl==2021.4.0 ; implementation_name != 'cpython' and sys_platform == 'win32' # via torch mpmath==1.3.0 # via sympy networkx==3.2.1 # via torch - pytorch-triton-rocm==2.3.0 ; platform_machine != 'x86_64' and sys_platform != 'darwin' and sys_platform != 'win32' + pytorch-triton-rocm==2.3.0 ; (implementation_name != 'cpython' and platform_machine != 'aarch64' and sys_platform == 'linux') or (implementation_name != 'cpython' and sys_platform != 'darwin' and sys_platform != 'linux' and sys_platform != 'win32') # via torch sympy==1.12 # via torch - tbb==2021.11.0 ; platform_machine != 'x86_64' and sys_platform == 'win32' + tbb==2021.11.0 ; implementation_name != 'cpython' and sys_platform == 'win32' # via mkl - torch==2.0.0+cu118 ; platform_machine == 'x86_64' + torch==2.0.0+cu118 ; implementation_name == 'cpython' # via # -r requirements.in # example # triton - torch==2.3.0 ; (platform_machine != 'x86_64' and sys_platform == 'darwin') or (platform_machine != 'x86_64' and sys_platform == 'win32') + torch==2.3.0 ; (implementation_name != 'cpython' and platform_machine == 'aarch64' and sys_platform == 'linux') or (implementation_name != 'cpython' and sys_platform == 'darwin') or (implementation_name != 'cpython' and sys_platform == 'win32') # via -r requirements.in - torch==2.3.0+rocm6.0 ; platform_machine != 'x86_64' and sys_platform != 'darwin' and sys_platform != 'win32' + torch==2.3.0+rocm6.0 ; (implementation_name != 'cpython' and platform_machine != 'aarch64' and sys_platform == 'linux') or (implementation_name != 'cpython' and sys_platform != 'darwin' and sys_platform != 'linux' and sys_platform != 'win32') # via -r requirements.in - triton==2.0.0 ; platform_machine == 'x86_64' and sys_platform == 'linux' + triton==2.0.0 ; implementation_name == 'cpython' and platform_machine == 'x86_64' and sys_platform == 'linux' # via torch typing-extensions==4.10.0 # via torch @@ -8070,7 +8070,6 @@ fn universal_nested_overlapping_local_requirement() -> Result<()> { # via -r requirements.in filelock==3.13.1 # via - # pytorch-triton-rocm # torch # triton fsspec==2024.3.1 ; platform_machine != 'x86_64' @@ -8089,8 +8088,6 @@ fn universal_nested_overlapping_local_requirement() -> Result<()> { # via sympy networkx==3.2.1 # via torch - pytorch-triton-rocm==2.3.0 ; platform_machine != 'x86_64' and sys_platform != 'darwin' and sys_platform != 'win32' - # via torch sympy==1.12 # via torch tbb==2021.11.0 ; platform_machine != 'x86_64' and sys_platform == 'win32' @@ -8100,9 +8097,7 @@ fn universal_nested_overlapping_local_requirement() -> Result<()> { # -r requirements.in # example # triton - torch==2.3.0 ; (platform_machine != 'x86_64' and sys_platform == 'darwin') or (platform_machine != 'x86_64' and sys_platform == 'win32') - # via -r requirements.in - torch==2.3.0+rocm6.0 ; platform_machine != 'x86_64' and sys_platform != 'darwin' and sys_platform != 'win32' + torch==2.3.0 ; platform_machine != 'x86_64' # via -r requirements.in triton==2.0.0 ; platform_machine == 'x86_64' and sys_platform == 'linux' # via torch @@ -8110,7 +8105,7 @@ fn universal_nested_overlapping_local_requirement() -> Result<()> { # via torch ----- stderr ----- - Resolved 19 packages in [TIME] + Resolved 17 packages in [TIME] "### ); @@ -8129,8 +8124,8 @@ fn universal_nested_disjoint_local_requirement() -> Result<()> { name = "example" version = "0.0.0" dependencies = [ - "torch==2.0.0+cu118 ; platform_machine == 'x86_64'", - "torch==2.0.0+cpu ; platform_machine != 'x86_64'" + "torch==2.0.0+cu118 ; implementation_name == 'cpython'", + "torch==2.0.0+cpu ; implementation_name != 'cpython'" ] requires-python = ">=3.11" "#})?; @@ -8154,7 +8149,7 @@ fn universal_nested_disjoint_local_requirement() -> Result<()> { ----- stdout ----- # This file was autogenerated by uv via the following command: # uv pip compile --cache-dir [CACHE_DIR] requirements.in --universal - cmake==3.28.4 ; os_name == 'Linux' and platform_machine == 'x86_64' and sys_platform == 'linux' + cmake==3.28.4 ; implementation_name == 'cpython' and os_name == 'Linux' and platform_machine == 'x86_64' and sys_platform == 'linux' # via triton . ; os_name == 'Linux' # via -r requirements.in @@ -8169,7 +8164,7 @@ fn universal_nested_disjoint_local_requirement() -> Result<()> { # via mkl jinja2==3.1.3 # via torch - lit==18.1.2 ; os_name == 'Linux' and platform_machine == 'x86_64' and sys_platform == 'linux' + lit==18.1.2 ; implementation_name == 'cpython' and os_name == 'Linux' and platform_machine == 'x86_64' and sys_platform == 'linux' # via triton markupsafe==2.1.5 # via jinja2 @@ -8179,26 +8174,26 @@ fn universal_nested_disjoint_local_requirement() -> Result<()> { # via sympy networkx==3.2.1 # via torch - pytorch-triton-rocm==2.3.0 ; os_name != 'Linux' and sys_platform != 'darwin' and sys_platform != 'win32' + pytorch-triton-rocm==2.3.0 ; (os_name != 'Linux' and platform_machine != 'aarch64' and sys_platform == 'linux') or (os_name != 'Linux' and sys_platform != 'darwin' and sys_platform != 'linux' and sys_platform != 'win32') # via torch sympy==1.12 # via torch tbb==2021.11.0 ; os_name != 'Linux' and sys_platform == 'win32' # via mkl - torch==2.0.0+cpu ; os_name == 'Linux' and platform_machine != 'x86_64' + torch==2.0.0+cpu ; implementation_name != 'cpython' and os_name == 'Linux' # via # -r requirements.in # example - torch==2.0.0+cu118 ; os_name == 'Linux' and platform_machine == 'x86_64' + torch==2.0.0+cu118 ; implementation_name == 'cpython' and os_name == 'Linux' # via # -r requirements.in # example # triton - torch==2.3.0 ; (os_name != 'Linux' and sys_platform == 'darwin') or (os_name != 'Linux' and sys_platform == 'win32') + torch==2.3.0 ; (os_name != 'Linux' and platform_machine == 'aarch64' and sys_platform == 'linux') or (os_name != 'Linux' and sys_platform == 'darwin') or (os_name != 'Linux' and sys_platform == 'win32') # via -r requirements.in - torch==2.3.0+rocm6.0 ; os_name != 'Linux' and sys_platform != 'darwin' and sys_platform != 'win32' + torch==2.3.0+rocm6.0 ; (os_name != 'Linux' and platform_machine != 'aarch64' and sys_platform == 'linux') or (os_name != 'Linux' and sys_platform != 'darwin' and sys_platform != 'linux' and sys_platform != 'win32') # via -r requirements.in - triton==2.0.0 ; os_name == 'Linux' and platform_machine == 'x86_64' and sys_platform == 'linux' + triton==2.0.0 ; implementation_name == 'cpython' and os_name == 'Linux' and platform_machine == 'x86_64' and sys_platform == 'linux' # via torch typing-extensions==4.10.0 # via torch @@ -8993,8 +8988,6 @@ fn universal_marker_propagation() -> Result<()> { # via torchvision pytorch-triton-rocm==2.0.2 ; platform_machine == 'x86_64' and sys_platform != 'darwin' and sys_platform != 'win32' # via torch - pytorch-triton-rocm==2.2.0 ; platform_machine != 'x86_64' and sys_platform != 'darwin' and sys_platform != 'win32' - # via torch requests==2.31.0 # via torchvision sympy==1.12 @@ -9008,11 +9001,7 @@ fn universal_marker_propagation() -> Result<()> { # -r requirements.in # pytorch-triton-rocm # torchvision - torch==2.2.0 ; (platform_machine != 'x86_64' and sys_platform == 'darwin') or (platform_machine != 'x86_64' and sys_platform == 'win32') - # via - # -r requirements.in - # torchvision - torch==2.2.0+rocm5.7 ; platform_machine != 'x86_64' and sys_platform != 'darwin' and sys_platform != 'win32' + torch==2.2.0 ; platform_machine != 'x86_64' # via # -r requirements.in # torchvision @@ -9020,9 +9009,7 @@ fn universal_marker_propagation() -> Result<()> { # via -r requirements.in torchvision==0.15.1+rocm5.4.2 ; platform_machine == 'x86_64' and sys_platform != 'darwin' and sys_platform != 'win32' # via -r requirements.in - torchvision==0.17.0 ; (platform_machine != 'x86_64' and sys_platform == 'darwin') or (platform_machine != 'x86_64' and sys_platform == 'win32') - # via -r requirements.in - torchvision==0.17.0+rocm5.7 ; platform_machine != 'x86_64' and sys_platform != 'darwin' and sys_platform != 'win32' + torchvision==0.17.0 ; platform_machine != 'x86_64' # via -r requirements.in typing-extensions==4.10.0 # via torch @@ -9031,7 +9018,7 @@ fn universal_marker_propagation() -> Result<()> { ----- stderr ----- warning: The requested Python version 3.8 is not available; 3.12.[X] will be used to build dependencies instead. - Resolved 28 packages in [TIME] + Resolved 25 packages in [TIME] "### );