mirror of
https://github.com/astral-sh/uv
synced 2026-01-24 15:00: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
74 lines
2.4 KiB
TOML
74 lines
2.4 KiB
TOML
[package]
|
|
name = "uv-resolver"
|
|
version = "0.0.1"
|
|
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]
|
|
cache-key = { path = "../cache-key" }
|
|
distribution-filename = { path = "../distribution-filename", features = ["serde"] }
|
|
distribution-types = { path = "../distribution-types" }
|
|
install-wheel-rs = { path = "../install-wheel-rs" }
|
|
once-map = { path = "../once-map" }
|
|
pep440_rs = { path = "../pep440-rs", features = ["pubgrub"] }
|
|
pep508_rs = { path = "../pep508-rs" }
|
|
platform-tags = { path = "../platform-tags" }
|
|
pypi-types = { path = "../pypi-types" }
|
|
uv-cache = { path = "../uv-cache" }
|
|
uv-client = { path = "../uv-client" }
|
|
uv-distribution = { path = "../uv-distribution" }
|
|
uv-git = { path = "../uv-git", features = ["vendored-openssl"] }
|
|
uv-interpreter = { path = "../uv-interpreter" }
|
|
uv-normalize = { path = "../uv-normalize" }
|
|
uv-traits = { path = "../uv-traits" }
|
|
uv-warnings = { path = "../uv-warnings" }
|
|
|
|
anstream = { workspace = true }
|
|
anyhow = { workspace = true }
|
|
chrono = { workspace = true }
|
|
clap = { workspace = true, features = ["derive"], optional = true }
|
|
dashmap = { workspace = true }
|
|
derivative = { workspace = true }
|
|
either = { workspace = true }
|
|
fs-err = { workspace = true, features = ["tokio"] }
|
|
futures = { workspace = true }
|
|
indexmap = { workspace = true }
|
|
itertools = { workspace = true }
|
|
once_cell = { workspace = true }
|
|
owo-colors = { workspace = true }
|
|
petgraph = { workspace = true }
|
|
pubgrub = { workspace = true }
|
|
reqwest = { workspace = true }
|
|
rkyv = { workspace = true, features = ["strict", "validation"] }
|
|
rustc-hash = { workspace = true }
|
|
serde_json = { workspace = true }
|
|
sha2 = { workspace = true }
|
|
tempfile = { workspace = true }
|
|
thiserror = { workspace = true }
|
|
tokio = { workspace = true, features = ["macros"] }
|
|
tokio-stream = { workspace = true }
|
|
tokio-util = { workspace = true, features = ["compat"] }
|
|
tracing = { workspace = true }
|
|
url = { workspace = true }
|
|
zip = { workspace = true }
|
|
|
|
[dev-dependencies]
|
|
uv-virtualenv = { path = "../uv-virtualenv" }
|
|
uv-interpreter = { path = "../uv-interpreter" }
|
|
|
|
once_cell = { version = "1.19.0" }
|
|
insta = { version = "1.36.1" }
|
|
|
|
[features]
|
|
default = ["pypi"]
|
|
# Introduces a dependency on PyPI.
|
|
pypi = []
|