diff --git a/build-wheels.sh b/build-wheels.sh new file mode 100755 index 000000000..193eed495 --- /dev/null +++ b/build-wheels.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# build-wheels.sh +# +# This script builds wheels for the project's dependencies. +# +# It uses uv to build wheels for the following packages: +# - `provider_fictional_hw`: A fictional hardware provider package +# - `variantlib`: A library for handling variant configurations +# +# The wheels are built and placed in the ./wheels directory. +# +# Any existing wheels are removed before building. + +set -euxo pipefail + +UV=./target/debug/uv + +# Create the destination directory if it doesn't exist. +rm -rf wheels +mkdir wheels + +# Build the wheels for the fictional hardware provider package. +$UV build --out-dir ./wheels --project ./vendor/provider_fictional_hw + +# Build the wheels for the variant library. +$UV build --out-dir ./wheels --project ./vendor/variantlib diff --git a/files/anyio-4.9.0-py3-none-any.whl b/files/anyio-4.9.0-py3-none-any.whl new file mode 100644 index 000000000..35d82af00 Binary files /dev/null and b/files/anyio-4.9.0-py3-none-any.whl differ diff --git a/files/built_by_uv-0.1.0-py3-none-any-cpu1.whl b/files/built_by_uv-0.1.0-py3-none-any-cpu1.whl new file mode 100644 index 000000000..b84b2693b Binary files /dev/null and b/files/built_by_uv-0.1.0-py3-none-any-cpu1.whl differ diff --git a/files/built_by_uv-0.1.0-py3-none-any-cpu2.whl b/files/built_by_uv-0.1.0-py3-none-any-cpu2.whl new file mode 100644 index 000000000..b84b2693b Binary files /dev/null and b/files/built_by_uv-0.1.0-py3-none-any-cpu2.whl differ diff --git a/files/built_by_uv-0.1.0-py3-none-any-cpu3.whl b/files/built_by_uv-0.1.0-py3-none-any-cpu3.whl new file mode 100644 index 000000000..b84b2693b Binary files /dev/null and b/files/built_by_uv-0.1.0-py3-none-any-cpu3.whl differ diff --git a/files/built_by_uv-0.1.0-py3-none-any-cpu4.whl b/files/built_by_uv-0.1.0-py3-none-any-cpu4.whl new file mode 100644 index 000000000..b84b2693b Binary files /dev/null and b/files/built_by_uv-0.1.0-py3-none-any-cpu4.whl differ diff --git a/files/built_by_uv-0.1.0-variants.json b/files/built_by_uv-0.1.0-variants.json new file mode 100644 index 000000000..b2cc5ac41 --- /dev/null +++ b/files/built_by_uv-0.1.0-variants.json @@ -0,0 +1,61 @@ +{ + "default-priorities": { + "feature": { + "cpu_level": [ + "x86_64_level" + ] + }, + "namespace": [ + "cpu_level" + ], + "property": { + "cpu_level": { + "x86_64_level": [ + "v4", + "v3", + "v2", + "v1" + ] + } + } + }, + "providers": { + "cpu_level": { + "enable-if": "platform_machine == 'x86_64' or platform_machine == 'AMD64'", + "plugin-api": "cpu_level_provider", + "requires": [ + "cpu_level_provider" + ] + } + }, + "variants": { + "cpu1": { + "cpu_level": { + "x86_64_level": [ + "v1" + ] + } + }, + "cpu2": { + "cpu_level": { + "x86_64_level": [ + "v2" + ] + } + }, + "cpu3": { + "cpu_level": { + "x86_64_level": [ + "v3" + ] + } + }, + "cpu4": { + "cpu_level": { + "x86_64_level": [ + "v4" + ] + } + } + } +} diff --git a/files/cpu_level_provider-0.1.0-py3-none-any.whl b/files/cpu_level_provider-0.1.0-py3-none-any.whl new file mode 100644 index 000000000..a7726639c Binary files /dev/null and b/files/cpu_level_provider-0.1.0-py3-none-any.whl differ diff --git a/files/cpu_level_provider-0.1.0.tar.gz b/files/cpu_level_provider-0.1.0.tar.gz new file mode 100644 index 000000000..beed6644e Binary files /dev/null and b/files/cpu_level_provider-0.1.0.tar.gz differ diff --git a/files/idna-3.10-py3-none-any.whl b/files/idna-3.10-py3-none-any.whl new file mode 100644 index 000000000..52759bdd2 Binary files /dev/null and b/files/idna-3.10-py3-none-any.whl differ diff --git a/files/sniffio-1.3.1-py3-none-any.whl b/files/sniffio-1.3.1-py3-none-any.whl new file mode 100644 index 000000000..04f44e47d Binary files /dev/null and b/files/sniffio-1.3.1-py3-none-any.whl differ diff --git a/files_sdist/built_by_uv-0.1.0.tar.gz b/files_sdist/built_by_uv-0.1.0.tar.gz new file mode 100644 index 000000000..8632c807e Binary files /dev/null and b/files_sdist/built_by_uv-0.1.0.tar.gz differ diff --git a/files_wheel/built_by_uv-0.1.0-py3-none-any.whl b/files_wheel/built_by_uv-0.1.0-py3-none-any.whl new file mode 100644 index 000000000..b84b2693b Binary files /dev/null and b/files_wheel/built_by_uv-0.1.0-py3-none-any.whl differ diff --git a/scripts/packages/built-by-uv/pyproject.toml b/scripts/packages/built-by-uv/pyproject.toml index fe590308f..c25c89211 100644 --- a/scripts/packages/built-by-uv/pyproject.toml +++ b/scripts/packages/built-by-uv/pyproject.toml @@ -23,6 +23,13 @@ scripts = "scripts" data = "assets" headers = "header" +[variant.default-priorities] +namespace = ["cpu_level"] + +[variant.providers.cpu_level] +requires = ["cpu_level_provider >= 0.1, <0.2"] +enable-if = "platform_machine == 'x86_64' or platform_machine == 'AMD64'" + [build-system] requires = ["uv_build>=0.8.0,<0.10.0"] build-backend = "uv_build" diff --git a/test_torch.sh b/test_torch.sh new file mode 100755 index 000000000..c0b44a581 --- /dev/null +++ b/test_torch.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -e + +uv venv --clear -q -p 3.13 && echo "torch" | cargo run -q -- pip compile - --index https://download.pytorch.org/whl/test/variant/ --no-progress --no-annotate -v # --no-cache + +export NV_VARIANT_PROVIDER_FORCE_KMD_DRIVER_VERSION=570.133.20 +export NV_VARIANT_PROVIDER_FORCE_CUDA_DRIVER_VERSION=12.8 +uv venv --clear -q -p 3.13 && echo "torch" | cargo run -q -- pip compile - --index https://download.pytorch.org/whl/test/variant/ --no-progress --no-annotate -v # --no-cache + +# For user testing +# cargo run pip install torch --index https://download.pytorch.org/whl/test/variant/ --no-cache diff --git a/test_variants.sh b/test_variants.sh new file mode 100755 index 000000000..fd90f2465 --- /dev/null +++ b/test_variants.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e + +# No matching variant wheel, no non-variant wheel or sdist +uv venv -q && ( ( UV_CPU_LEVEL_OVERRIDE=0 cargo run pip install built-by-uv --no-index --no-cache --no-progress --find-links ./files && exit 1 ) || exit 0 ) +# No matching variant wheel, but a non-variant wheel +uv venv -q && UV_CPU_LEVEL_OVERRIDE=0 cargo run pip install built-by-uv --no-index --no-cache --no-progress --find-links ./files --find-links ./files_wheel +# No matching variant wheel, but a non-variant sdist +uv venv -q && UV_CPU_LEVEL_OVERRIDE=0 cargo run pip install built-by-uv --no-index --no-cache --no-progress --find-links ./files --find-links ./files_sdist +# Matching cpu2 variant wheel +uv venv -q && UV_CPU_LEVEL_OVERRIDE=2 cargo run pip install built-by-uv --no-index --no-cache --no-progress -v --find-links ./files --find-links ./files_wheel +# Matching cpu2 variant wheel, to be preferred over the wheel and the sdist +uv venv -q && UV_CPU_LEVEL_OVERRIDE=2 cargo run pip install built-by-uv --no-index --no-cache --no-progress -v --find-links ./files --find-links ./files_wheel --find-links ./files_sdist