2f5a64a8b3
When building only a single crate in the workspace to run its tests, we often recompile a lot of other, unrelated crates. Whenever cargo has a different set of crate features, it needs to recompile. By moving some features (non-exhaustive for now) to the workspace level, we always activate them an avoid recompiling. The cargo docs mismatch the behavior of cargo around default-deps, so I filed that upstream and left most `default-features` mismatches: https://github.com/rust-lang/cargo/issues/14841. Reference script: ```python import tomllib from collections import defaultdict from pathlib import Path uv = Path("/home/konsti/projects/uv") skip_list = ["uv-trampoline", "uv-dev", "uv-performance-flate2-backend", "uv-performance-memory-allocator"] root_feature_map = defaultdict(set) root_default_features = defaultdict(bool) cargo_toml = tomllib.loads(uv.joinpath("Cargo.toml").read_text()) for dep, declaration in cargo_toml["workspace"]["dependencies"].items(): root_default_features[dep] = root_default_features[dep] or declaration.get("default-features", True) root_feature_map[dep].update(declaration.get("features", [])) feature_map = defaultdict(set) default_features = defaultdict(bool) for crate in uv.joinpath("crates").iterdir(): if crate.name in skip_list: continue if not crate.joinpath("Cargo.toml").is_file(): continue cargo_toml = tomllib.loads(crate.joinpath("Cargo.toml").read_text()) for dep, declaration in cargo_toml.get("dependencies", {}).items(): # If any item uses default features, they are used everywhere default_features[dep] = default_features[dep] or declaration.get("default-features", True) feature_map[dep].update(declaration.get("features", [])) for dep, features in sorted(feature_map.items()): features = features - root_feature_map.get(dep, set()) if not features and default_features[dep] == root_default_features[dep]: continue print(dep, default_features[dep], sorted(features)) ```
47 lines
1.3 KiB
TOML
47 lines
1.3 KiB
TOML
[package]
|
|
name = "uv-distribution-types"
|
|
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 }
|
|
|
|
[lib]
|
|
doctest = false
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
uv-auth = { workspace = true }
|
|
uv-cache-info = { workspace = true }
|
|
uv-cache-key = { workspace = true }
|
|
uv-distribution-filename = { workspace = true }
|
|
uv-fs = { workspace = true }
|
|
uv-git = { workspace = true }
|
|
uv-normalize = { workspace = true }
|
|
uv-pep440 = { workspace = true }
|
|
uv-pep508 = { workspace = true }
|
|
uv-platform-tags = { workspace = true }
|
|
uv-pypi-types = { workspace = true }
|
|
|
|
anyhow = { workspace = true }
|
|
bitflags = { workspace = true }
|
|
fs-err = { workspace = true }
|
|
itertools = { workspace = true }
|
|
jiff = { workspace = true }
|
|
petgraph = { workspace = true }
|
|
rkyv = { workspace = true }
|
|
rustc-hash = { workspace = true }
|
|
schemars = { workspace = true, optional = true }
|
|
serde = { workspace = true, features = ["derive"] }
|
|
serde_json = { workspace = true }
|
|
thiserror = { workspace = true }
|
|
tracing = { workspace = true }
|
|
url = { workspace = true }
|
|
urlencoding = { workspace = true }
|
|
version-ranges = { workspace = true }
|