Skip to content

Commit 189dd02

Browse files
committed
Add to wheel tag; add basic plumbing
1 parent dfa5eed commit 189dd02

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1191
-71
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Vendored dependencies for the variant prototype.
2+
/vendor/
3+
14
# Insta snapshots.
25
*.pending-snap
36

Cargo.lock

Lines changed: 68 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ uv-static = { path = "crates/uv-static" }
6565
uv-tool = { path = "crates/uv-tool" }
6666
uv-trampoline-builder = { path = "crates/uv-trampoline-builder" }
6767
uv-types = { path = "crates/uv-types" }
68+
uv-variants = { path = "crates/uv-variants" }
69+
uv-variant-frontend = { path = "crates/uv-variant-frontend" }
6870
uv-version = { path = "crates/uv-version" }
6971
uv-virtualenv = { path = "crates/uv-virtualenv" }
7072
uv-warnings = { path = "crates/uv-warnings" }
@@ -153,6 +155,7 @@ serde = { version = "1.0.210", features = ["derive", "rc"] }
153155
serde-untagged = { version = "0.1.6" }
154156
serde_json = { version = "1.0.128" }
155157
sha2 = { version = "0.10.8" }
158+
sha3 = { version = "0.10.8" }
156159
smallvec = { version = "1.13.2" }
157160
spdx = { version = "0.10.6" }
158161
syn = { version = "2.0.77" }

build-wheels.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
# build-wheels.sh
3+
#
4+
# This script builds wheels for the project's dependencies.
5+
#
6+
# It uses uv to build wheels for the following packages:
7+
# - `provider_fictional_hw`: A fictional hardware provider package
8+
# - `variantlib`: A library for handling variant configurations
9+
#
10+
# The wheels are built and placed in the ./wheels directory.
11+
#
12+
# Any existing wheels are removed before building.
13+
14+
set -euxo pipefail
15+
16+
UV=./target/debug/uv
17+
18+
# Create the destination directory if it doesn't exist.
19+
rm -rf wheels
20+
mkdir wheels
21+
22+
# Build the wheels for the fictional hardware provider package.
23+
$UV build --out-dir ./wheels --project ./vendor/provider_fictional_hw
24+
25+
# Build the wheels for the variant library.
26+
$UV build --out-dir ./wheels --project ./vendor/variantlib

crates/uv-bench/benches/uv.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ mod resolver {
208208
markers,
209209
conflicts,
210210
Some(&TAGS),
211+
None,
211212
&flat_index,
212213
&index,
213214
&hashes,

crates/uv-dispatch/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ uv-pypi-types = { workspace = true }
3333
uv-python = { workspace = true }
3434
uv-resolver = { workspace = true }
3535
uv-types = { workspace = true }
36+
uv-variant-frontend = { workspace = true }
3637
uv-version = { workspace = true }
3738
uv-workspace = { workspace = true }
3839

crates/uv-dispatch/src/lib.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use uv_distribution_types::{
2828
};
2929
use uv_git::GitResolver;
3030
use uv_installer::{Installer, Plan, Planner, Preparer, SitePackages};
31-
use uv_pypi_types::{Conflicts, Requirement};
31+
use uv_pypi_types::{Conflicts, Requirement, VariantProviderBackend};
3232
use uv_python::{Interpreter, PythonEnvironment};
3333
use uv_resolver::{
3434
ExcludeNewer, FlatIndex, Flexibility, InMemoryIndex, Manifest, OptionsBuilder,
@@ -38,6 +38,7 @@ use uv_types::{
3838
AnyErrorBuild, BuildContext, BuildIsolation, BuildStack, EmptyInstalledPackages, HashStrategy,
3939
InFlight,
4040
};
41+
use uv_variant_frontend::VariantBuild;
4142
use uv_workspace::WorkspaceCache;
4243

4344
#[derive(Debug, Error)]
@@ -161,6 +162,24 @@ impl<'a> BuildDispatch<'a> {
161162
.collect();
162163
self
163164
}
165+
166+
pub async fn setup_variants<'data>(
167+
&'data self,
168+
backend: VariantProviderBackend,
169+
build_output: BuildOutput,
170+
) -> Result<VariantBuild, uv_variant_frontend::Error> {
171+
let builder = VariantBuild::setup(
172+
backend,
173+
self.interpreter,
174+
self,
175+
self.build_extra_env_vars.clone(),
176+
build_output,
177+
self.concurrency.builds,
178+
)
179+
.boxed_local()
180+
.await?;
181+
Ok(builder)
182+
}
164183
}
165184

166185
#[allow(refining_impl_trait)]
@@ -229,6 +248,7 @@ impl BuildContext for BuildDispatch<'_> {
229248
// Conflicting groups only make sense when doing universal resolution.
230249
Conflicts::empty(),
231250
Some(tags),
251+
None,
232252
self.flat_index,
233253
&self.shared_state.index,
234254
self.hasher,

crates/uv-distribution-filename/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ uv-normalize = { workspace = true }
2121
uv-pep440 = { workspace = true }
2222
uv-platform-tags = { workspace = true }
2323
uv-small-str = { workspace = true }
24+
uv-variants = { workspace = true }
2425

2526
memchr = { workspace = true }
2627
rkyv = { workspace = true, features = ["smallvec-1"] }

crates/uv-distribution-filename/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,6 @@ mod tests {
101101

102102
#[test]
103103
fn wheel_filename_size() {
104-
assert_eq!(size_of::<WheelFilename>(), 48);
104+
assert_eq!(size_of::<WheelFilename>(), 64);
105105
}
106106
}

crates/uv-distribution-filename/src/snapshots/uv_distribution_filename__wheel__tests__ok_build_tag.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Ok(
88
"foo",
99
),
1010
version: "1.2.3",
11+
variant: None,
1112
tags: Large {
1213
large: WheelTagLarge {
1314
build_tag: Some(

0 commit comments

Comments
 (0)