mirror of
https://github.com/astral-sh/uv
synced 2026-01-24 06:50:18 -05:00
The architecture of uv does not necessarily match that of the python
interpreter (#2326). In cross compiling/testing scenarios the operating
system can also mismatch. To solve this, we move arch and os detection
to python, vendoring the relevant pypa/packaging code, preventing
mismatches between what the python interpreter was compiled for and what
uv was compiled for.
To make the scripts more manageable, they are now a directory in a
tempdir and we run them with `python -m` . I've simplified the
pypa/packaging code since we're still building the tags in rust. A
`Platform` is now instantiated by querying the python interpreter for
its platform. The pypa/packaging files are copied verbatim for easier
updates except a `lru_cache()` python 3.7 backport.
Error handling is done by a `"result": "success|error"` field that allow
passing error details to rust:
```console
$ uv venv --no-cache
× Can't use Python at `/home/konsti/projects/uv/.venv/bin/python3`
╰─▶ Unknown operation system `linux`
```
I've used the [maturin sysconfig
collection](855f6d2cb1/sysconfig)
as reference. I'm unsure how to test these changes across the wide
variety of platforms.
Fixes #2326
71 lines
2.5 KiB
TOML
71 lines
2.5 KiB
TOML
[package]
|
|
name = "uv-dev"
|
|
version = "0.0.1"
|
|
description = "Build wheels from source distributions"
|
|
publish = false
|
|
|
|
edition = { workspace = true }
|
|
rust-version = { workspace = true }
|
|
homepage = { workspace = true }
|
|
documentation = { workspace = true }
|
|
repository = { workspace = true }
|
|
authors = { workspace = true }
|
|
license = { workspace = true }
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
distribution-filename = { path = "../distribution-filename" }
|
|
distribution-types = { path = "../distribution-types" }
|
|
install-wheel-rs = { path = "../install-wheel-rs" }
|
|
pep440_rs = { path = "../pep440-rs" }
|
|
pep508_rs = { path = "../pep508-rs" }
|
|
platform-tags = { path = "../platform-tags" }
|
|
pypi-types = { path = "../pypi-types" }
|
|
uv-build = { path = "../uv-build" }
|
|
uv-cache = { path = "../uv-cache", features = ["clap"] }
|
|
uv-client = { path = "../uv-client" }
|
|
uv-dispatch = { path = "../uv-dispatch" }
|
|
uv-distribution = { path = "../uv-distribution" }
|
|
uv-installer = { path = "../uv-installer" }
|
|
uv-interpreter = { path = "../uv-interpreter" }
|
|
uv-normalize = { path = "../uv-normalize" }
|
|
uv-resolver = { path = "../uv-resolver" }
|
|
uv-traits = { path = "../uv-traits" }
|
|
uv-virtualenv = { path = "../uv-virtualenv" }
|
|
|
|
# Any dependencies that are exclusively used in `uv-dev` should be listed as non-workspace
|
|
# dependencies, to ensure that we're forced to think twice before including them in other crates.
|
|
anstream = { workspace = true }
|
|
anyhow = { workspace = true }
|
|
chrono = { workspace = true }
|
|
clap = { workspace = true, features = ["derive"] }
|
|
fs-err = { workspace = true, features = ["tokio"] }
|
|
futures = { workspace = true }
|
|
indicatif = { workspace = true }
|
|
itertools = { workspace = true }
|
|
owo-colors = { workspace = true }
|
|
petgraph = { workspace = true }
|
|
poloto = { version = "19.1.2" }
|
|
resvg = { version = "0.29.0" }
|
|
rustc-hash = { workspace = true }
|
|
serde = { workspace = true }
|
|
serde_json = { workspace = true }
|
|
tagu = { version = "0.1.6" }
|
|
tempfile = { workspace = true }
|
|
tokio = { workspace = true }
|
|
tracing = { workspace = true }
|
|
tracing-durations-export = { workspace = true, features = ["plot"] }
|
|
tracing-indicatif = { workspace = true }
|
|
tracing-subscriber = { workspace = true }
|
|
url = { workspace = true }
|
|
walkdir = { workspace = true }
|
|
which = { workspace = true }
|
|
|
|
[target.'cfg(target_os = "windows")'.dependencies]
|
|
mimalloc = { version = "0.1.39" }
|
|
|
|
[target.'cfg(all(not(target_os = "windows"), not(target_os = "openbsd"), any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "powerpc64")))'.dependencies]
|
|
tikv-jemallocator = { version = "0.5.4" }
|