2652caa3e3
## Summary This PR adds support for resolving and installing dependencies via direct URLs, like: ``` werkzeug @ https://files.pythonhosted.org/packages/ff/1d/960bb4017c68674a1cb099534840f18d3def3ce44aed12b5ed8b78e0153e/Werkzeug-2.0.0-py3-none-any.whl ``` These are fairly common (e.g., with `torch`), but you most often see them as Git dependencies. Broadly, structs like `RemoteDistribution` and friends are now enums that can represent either registry-based dependencies or URL-based dependencies: ```rust /// A built distribution (wheel) that exists as a remote file (e.g., on `PyPI`). #[derive(Debug, Clone)] #[allow(clippy::large_enum_variant)] pub enum RemoteDistribution { /// The distribution exists in a registry, like `PyPI`. Registry(PackageName, Version, File), /// The distribution exists at an arbitrary URL. Url(PackageName, Url), } ``` In the resolver, we now allow packages to take on an extra, optional `Url` field: ```rust #[derive(Debug, Clone, Eq, Derivative)] #[derivative(PartialEq, Hash)] pub enum PubGrubPackage { Root, Package( PackageName, Option<DistInfoName>, #[derivative(PartialEq = "ignore")] #[derivative(PartialOrd = "ignore")] #[derivative(Hash = "ignore")] Option<Url>, ), } ``` However, for the purpose of version satisfaction, we ignore the URL. This allows for the URL dependency to satisfy the transitive request in cases like: ``` flask==3.0.0 werkzeug @ https://files.pythonhosted.org/packages/c3/fc/254c3e9b5feb89ff5b9076a23218dafbc99c96ac5941e900b71206e6313b/werkzeug-3.0.1-py3-none-any.whl ``` There are a couple limitations in the current approach: - The caching for remote URLs is done separately in the resolver vs. the installer. I decided not to sweat this too much... We need to figure out caching holistically. - We don't support any sort of time-based cache for remote URLs -- they just exist forever. This will be a problem for URL dependencies, where we need some way to evict and refresh them. But I've deferred it for now. - I think I need to redo how this is modeled in the resolver, because right now, we don't detect a variety of invalid cases, e.g., providing two different URLs for a dependency, asking for a URL dependency and a _different version_ of the same dependency in the list of first-party dependencies, etc. - (We don't yet support VCS dependencies.)
102 lines
3.3 KiB
TOML
102 lines
3.3 KiB
TOML
[workspace]
|
|
members = ["crates/*"]
|
|
exclude = ["vendor/pubgrub"]
|
|
resolver = "2"
|
|
|
|
[workspace.package]
|
|
edition = "2021"
|
|
rust-version = "1.72"
|
|
homepage = "https://astral.sh"
|
|
documentation = "https://astral.sh"
|
|
repository = "https://github.com/astral-sh/puffin"
|
|
authors = ["Astral Software Inc. <hey@astral.sh>"]
|
|
license = "MIT OR Apache-2.0"
|
|
|
|
[workspace.dependencies]
|
|
anyhow = { version = "1.0.75" }
|
|
bitflags = { version = "2.4.0" }
|
|
cacache = { version = "11.7.1", default-features = false, features = ["tokio-runtime"] }
|
|
camino = { version = "1.1.6", features = ["serde1"] }
|
|
clap = { version = "4.4.6" }
|
|
colored = { version = "2.0.4" }
|
|
configparser = { version = "3.0.2" }
|
|
csv = { version = "1.3.0" }
|
|
data-encoding = { version = "2.4.0" }
|
|
directories = { version = "5.0.1" }
|
|
dirs = { version = "5.0.1" }
|
|
flate2 = { version = "1.0.28" }
|
|
fs-err = { version = "2.9.0" }
|
|
fs2 = { version = "0.4.3" }
|
|
futures = { version = "0.3.28" }
|
|
fxhash = { version = "0.2.1" }
|
|
goblin = { version = "0.7.1" }
|
|
hex = { version = "0.4.3" }
|
|
http-cache-reqwest = { version = "0.11.3" }
|
|
indicatif = { version = "0.17.7" }
|
|
indoc = { version = "2.0.4" }
|
|
itertools = { version = "0.11.0" }
|
|
mailparse = { version = "0.14.0" }
|
|
memchr = { version = "2.6.4" }
|
|
miette = { version = "5.10.0" }
|
|
once_cell = { version = "1.18.0" }
|
|
petgraph = { version = "0.6.4" }
|
|
platform-info = { version = "2.0.2" }
|
|
plist = { version = "1.5.0" }
|
|
pyproject-toml = { version = "0.7.0" }
|
|
rayon = { version = "1.8.0" }
|
|
reflink-copy = { version = "0.1.10" }
|
|
regex = { version = "1.9.6" }
|
|
reqwest = { version = "0.11.22", default-features = false, features = ["json", "gzip", "brotli", "stream", "rustls-tls"] }
|
|
reqwest-middleware = { version = "0.2.3" }
|
|
reqwest-retry = { version = "0.3.0" }
|
|
rfc2047-decoder = { version = "1.0.1" }
|
|
seahash = { version = "4.1.0" }
|
|
serde = { version = "1.0.188" }
|
|
serde_json = { version = "1.0.107" }
|
|
sha2 = { version = "0.10.8" }
|
|
tar = { version = "0.4.40" }
|
|
target-lexicon = { version = "0.12.11" }
|
|
tempfile = { version = "3.8.0" }
|
|
thiserror = { version = "1.0.49" }
|
|
tokio = { version = "1.16.1", features = ["rt-multi-thread"] }
|
|
tokio-util = { version = "0.7.9", features = ["compat"] }
|
|
toml = { version = "0.8.2" }
|
|
toml_edit = { version = "0.20.2" }
|
|
tracing = { version = "0.1.37" }
|
|
tracing-indicatif = { version = "0.3.5" }
|
|
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
|
|
tracing-tree = { version = "0.2.5" }
|
|
unicode-width = { version = "0.1.8" }
|
|
unscanny = { version = "0.1.0" }
|
|
url = { version = "2.4.1" }
|
|
waitmap = { version = "1.1.0" }
|
|
walkdir = { version = "2.4.0" }
|
|
which = { version = "4.4.2" }
|
|
zip = { version = "0.6.6", default-features = false, features = ["deflate"] }
|
|
|
|
[patch.crates-io]
|
|
# For pyproject-toml
|
|
pep508_rs = { path = "crates/pep508-rs" }
|
|
|
|
[profile.profiling]
|
|
inherits = "release"
|
|
debug = true
|
|
|
|
# Config for 'cargo dist'
|
|
[workspace.metadata.dist]
|
|
# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
|
|
cargo-dist-version = "0.3.1"
|
|
# CI backends to support
|
|
ci = ["github"]
|
|
# The installers to generate for each app
|
|
installers = ["shell"]
|
|
# Target platforms to build apps for (Rust target-triple syntax)
|
|
targets = ["x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-pc-windows-msvc"]
|
|
# Publish jobs to run in CI
|
|
pr-run-mode = "skip"
|
|
|
|
# The profile that 'cargo dist' will build with
|
|
[profile.dist]
|
|
inherits = "release"
|
|
lto = "thin"
|