[WIP] Wheel Variant Experimental Support #2037
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WheelNext & Wheel Variants
Caution
This is an an experimental feature currently being formalized as a PEP.
This is not an official feature of the Python Ecosystem & Standards.
This PR is part of the work being conducted by the WheelNext open-source initiative.
This PR introduces the feature of "Wheel Variant" into hatch & hatchling as a proof-of-concept.
Hopefully, this will give a good idea on:
How do "Wheel Variants" work ?
Wheel Variant is a proposed extension to the wheel specification designed to make platform-specific package distribution easier for package maintainers, and installation more smooth for end users. The key concepts are:
A Provider Plugin system, allowing vendors and communities to ship small, install-time packages that can detect system capabilities (e.g., CUDA version, CPU features).
A declarative metadata format for wheels to express their specific requirements (e.g.,
nvidia :: cuda_version_lower_bound :: 12.8
). Yes, absolutely inspired by Python classifier format.A mechanism for installers to automatically run these plugins to match the user's system with the best-fitting variant wheel, simplifying the user experience to a familiar
[uv] pip install torch
.We have carefully designed this system to ensure that installers unaware of variants will safely ignore them, maintaining backward compatibility with the existing ecosystem.
Links and Resources:
uv
PR Details
--variant-property
to allow users to build variant wheels with a given variant specifier. Example:variant.json
into the wheel, whenever the wheel is variant-enabled.TODOs
python -m build
.cc @DEKHTIARJonathan, @warsaw