CavRiley added a commit to CavRiley/ITKPythonPackage that referenced this pull request
May 4, 2026Variants emit natively from `python -m build` instead of being
post-processed onto an existing wheel. A new variant-build pixi feature
pulls scikit-build-core (henryiii fork backing PR #1284) plus
wheelnext/variantlib via pypi-deps; new opt-in CLI flags on
scripts/build_wheels.py thread the variant property + label through to
the existing `python -m build` invocations in
scripts/build_python_instance_base.py.
Activation:
pixi run -e variant-macosx-py311 build-itk-wheels \
--wheel-variant 'itk::threading::tbb' --wheel-variant-label tbbon
or via env vars (ITKPYTHONPACKAGE_WHEEL_VARIANT[_LABEL] /
ITKPYTHONPACKAGE_NULL_VARIANT) for CI parity with the existing
ITK_PACKAGE_VERSION / MANYLINUX_VERSION style. All flags default to off,
so production envs (manylinux228-py311, macosx-py311, ...) that don't
install the fork keep emitting their existing non-variant wheels and
never see the new config-settings.
Implementation:
- pixi.toml: new [feature.variant-build] (scikit-build-core fork +
variantlib via pypi-deps), new [feature.variant-python-dev-pkgs]
(mirror of python-dev-pkgs minus the conda scikit-build-core pin โ
pixi feature merging is intersection so the upper bound would
otherwise prevent the fork from resolving), and four parallel
environments: variant-{macosx,linux,manylinux228,windows}-py311.
- scripts/build_wheels.py: three new CLI flags (--wheel-variant,
repeatable; --wheel-variant-label; --null-variant) with env-var
defaults. Cross-flag validation (mutually exclusive null + property,
property requires label) before the values land in
package_env_config.
- scripts/build_python_instance_base.py: a small _variant_config_settings
helper on BuildPythonInstanceBase that returns the right
--config-setting=variant-* list (or [] for the production-default
case). Spliced into both `python -m build` invocations
(build_external_module_wheel and build_itk_python_wheels) just before
echo_check_call. Validates the label and property regex up front so
the build backend never sees an inconsistent state.
- experiments/wheel-variants/pixi.toml: drop variant-repack from
pypi-deps (its CLI is broken end-to-end at experiment time โ see
findings.md). Phase-2 mock/ scripts retained as a reference.
Refs: scikit-build/scikit-build-core#1284, https://peps.python.org/pep-0817/
Open
Accept meson-python-style variant config settings behind the experimental flag, inject variantlib when variants are requested, and emit variant-aware wheel metadata and filenames. Include generated schema/docs updates and focused tests for settings, build requirements, and metadata output. Assisted-by: Copilot:GPT-5.4 Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
henryiii marked this pull request as ready for review
May 29, 2026 18:58