pub const VERSION: &str = "0.13.10";
const RELEASES: &str = "https://github.com/astral-sh/uv/releases/download";
pub const MAX_DOWNLOAD: u64 = 64 * 1024 * 1024;
pub const MAX_FILE: u64 = 128 * 1024 * 1024;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct PinnedFile {
pub path: &'static str,
pub sha256: &'static str,
pub size: u64,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct PinnedUv {
pub os: &'static str,
pub arch: &'static str,
pub archive: &'static str,
pub archive_sha256: &'static str,
pub archive_size: u64,
pub uv: PinnedFile,
pub uvx: PinnedFile,
}
pub const PINNED: &[PinnedUv] = &[
PinnedUv {
os: "windows",
arch: "x86_64",
archive: "uv-x86_64-pc-windows-msvc.zip",
archive_sha256: "297b3881fe1adfb922becc2c1613202abb41dc83ea5ff43d472aa087ca1f8683",
archive_size: 15641577,
uv: PinnedFile {
path: "uv.exe",
sha256: "9f9f3631112f847c81b2063637ce01f4dd8d65e8ac2a8f4bb1c121f7effa5c76",
size: 32770864,
},
uvx: PinnedFile {
path: "uvx.exe",
sha256: "ecc61418ab3b09c9963bb0e04bd8b4a2ee9a25d40228446835e23e3c8139545c",
size: 338736,
},
},
PinnedUv {
os: "linux",
arch: "x86_64",
archive: "uv-x86_64-unknown-linux-gnu.tar.gz",
archive_sha256: "bf65ac1a0af10f92c522d91ac096c7c0a39657647b155577e7836c2cbbb4526c",
archive_size: 17113138,
uv: PinnedFile {
path: "uv-x86_64-unknown-linux-gnu/uv",
sha256: "bfe31619b549d39d9031cb2cadc5a95d1258efcad746628a3a6212da4ae5dfbf",
size: 38538864,
},
uvx: PinnedFile {
path: "uv-x86_64-unknown-linux-gnu/uvx",
sha256: "844e0e7d7fc19c187ba4e23b256c1b9ae1e72ce02974e719979906d6fe0a76ad",
size: 331352,
},
},
PinnedUv {
os: "linux",
arch: "aarch64",
archive: "uv-aarch64-unknown-linux-gnu.tar.gz",
archive_sha256: "14590f644805a6234ffe071154340669e38137f38e60aa9629690119704107d2",
archive_size: 16275135,
uv: PinnedFile {
path: "uv-aarch64-unknown-linux-gnu/uv",
sha256: "54d8e2847b8da2889015e590ef80c4203e0730cd1b0c314da6d2dd11d5817217",
size: 32711296,
},
uvx: PinnedFile {
path: "uv-aarch64-unknown-linux-gnu/uvx",
sha256: "8a5e35032e9b4cc5c031b22809151566513ba0de83f3cd604e87b274073895f4",
size: 297680,
},
},
PinnedUv {
os: "macos",
arch: "aarch64",
archive: "uv-aarch64-apple-darwin.tar.gz",
archive_sha256: "e419bf07533bdbf48795fc793601c834dd79db57a8c49ce8e25cfe3a8639958d",
archive_size: 14700626,
uv: PinnedFile {
path: "uv-aarch64-apple-darwin/uv",
sha256: "4ff271e49765b1d8ed72cfbf720401941efccac6b2997ce87bb05ee790312ab3",
size: 28604656,
},
uvx: PinnedFile {
path: "uv-aarch64-apple-darwin/uvx",
sha256: "0d621b3bcc9ec4a1b55ce0499620f8518513bebf42e7a16b4b411717c42fd690",
size: 334528,
},
},
PinnedUv {
os: "macos",
arch: "x86_64",
archive: "uv-x86_64-apple-darwin.tar.gz",
archive_sha256: "153e03197588204c04fc4c81cc4bafbfa4280222a385e4ee36a87aeec0ae63b4",
archive_size: 17489953,
uv: PinnedFile {
path: "uv-x86_64-apple-darwin/uv",
sha256: "4ae0c9d36977fe47218549301930c4f7f9cf6706a9a30d75ad23ed496769d589",
size: 39252576,
},
uvx: PinnedFile {
path: "uv-x86_64-apple-darwin/uvx",
sha256: "767d2ad8606dbb63c4f534ff470bcee06b9889069de3c575c5ac04842e8e56d2",
size: 344176,
},
},
];
pub fn pinned_for(os: &str, arch: &str) -> Option<&'static PinnedUv> {
PINNED.iter().find(|pin| pin.os == os && pin.arch == arch)
}
pub fn pinned() -> Option<&'static PinnedUv> {
pinned_for(std::env::consts::OS, std::env::consts::ARCH)
}
pub fn download_url(version: &str, archive: &str) -> String {
format!("{RELEASES}/{version}/{archive}")
}