From 8b5b0c29797cf88d78ef014916a5e5a5d51bbf95 Mon Sep 17 00:00:00 2001 From: Lucas Colley Date: Sat, 27 Jun 2026 11:54:16 +0100 Subject: [PATCH 1/3] gh-152384: pixi-packages: use `flags` to define variants --- Tools/pixi-packages/README.md | 14 +++++++------- Tools/pixi-packages/asan/variants.yaml | 6 ------ Tools/pixi-packages/clone-recipe.sh | 10 ---------- Tools/pixi-packages/default/pixi.toml | 15 --------------- Tools/pixi-packages/default/variants.yaml | 6 ------ Tools/pixi-packages/freethreading/pixi.toml | 15 --------------- Tools/pixi-packages/freethreading/variants.yaml | 6 ------ Tools/pixi-packages/{asan => }/pixi.toml | 6 ------ Tools/pixi-packages/{default => }/recipe.yaml | 9 ++++----- Tools/pixi-packages/tsan-freethreading/pixi.toml | 15 --------------- .../tsan-freethreading/variants.yaml | 6 ------ Tools/pixi-packages/variants.yaml | 8 ++++++++ 12 files changed, 19 insertions(+), 97 deletions(-) delete mode 100644 Tools/pixi-packages/asan/variants.yaml delete mode 100755 Tools/pixi-packages/clone-recipe.sh delete mode 100644 Tools/pixi-packages/default/pixi.toml delete mode 100644 Tools/pixi-packages/default/variants.yaml delete mode 100644 Tools/pixi-packages/freethreading/pixi.toml delete mode 100644 Tools/pixi-packages/freethreading/variants.yaml rename Tools/pixi-packages/{asan => }/pixi.toml (56%) rename Tools/pixi-packages/{default => }/recipe.yaml (91%) delete mode 100644 Tools/pixi-packages/tsan-freethreading/pixi.toml delete mode 100644 Tools/pixi-packages/tsan-freethreading/variants.yaml create mode 100644 Tools/pixi-packages/variants.yaml diff --git a/Tools/pixi-packages/README.md b/Tools/pixi-packages/README.md index d818fddaac6a1e6..1aad4f227e3d1db 100644 --- a/Tools/pixi-packages/README.md +++ b/Tools/pixi-packages/README.md @@ -10,7 +10,8 @@ in a [Pixi workspace](https://pixi.sh/latest/first_workspace/), like: ```toml [dependencies] python.git = "https://github.com/python/cpython" -python.subdirectory = "Tools/pixi-packages/asan" +python.subdirectory = "Tools/pixi-packages" +python.flags = "asan" ``` This is particularly useful when developers need to build CPython from source @@ -18,17 +19,18 @@ This is particularly useful when developers need to build CPython from source clone or build steps. Instead, Pixi will automatically handle both the build and installation of the package. -Each package definition is contained in a subdirectory, but they share the build script -`build.sh` in this directory. Currently defined package variants: +Each package variant carries a 'flag' to enable selection of that variant — see +[the Pixi docs](https://pixi.prefix.dev/latest/concepts/package_specifications/#extras-and-flags +for details of how to use this. Currently defined package variants: - `default` - `freethreading` - `asan`: ASan-instrumented build -- `tsan-freethreading`: TSan-instrumented free-threading build +- `tsan_freethreading`: TSan-instrumented free-threading build ## Maintenance -- Keep the `abi_tag` and `version` fields in each `variants.yaml` up to date with the +- Keep the `abi_tag` and `version` fields in `variants.yaml` up to date with the Python version - Update `build.sh` for any breaking changes in the `configure` and `make` workflow @@ -36,8 +38,6 @@ Each package definition is contained in a subdirectory, but they share the build - More package variants (such as UBSan) - Support for Windows -- Using a single `pixi.toml` for all package variants is blocked on - [pixi#5248](https://github.com/prefix-dev/pixi/issues/5248) ## Troubleshooting diff --git a/Tools/pixi-packages/asan/variants.yaml b/Tools/pixi-packages/asan/variants.yaml deleted file mode 100644 index 2404948457e6bb5..000000000000000 --- a/Tools/pixi-packages/asan/variants.yaml +++ /dev/null @@ -1,6 +0,0 @@ -variant: - - asan -abi_tag: - - asan_cp315 -version: - - 3.15 diff --git a/Tools/pixi-packages/clone-recipe.sh b/Tools/pixi-packages/clone-recipe.sh deleted file mode 100755 index 25ceaf85c35f56d..000000000000000 --- a/Tools/pixi-packages/clone-recipe.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# Please always only modify default/recipe.yaml and default/pixi.toml and then run this -# script to propagate the changes to the other variants. -set -o errexit -cd "$(dirname "$0")" - -for variant in asan freethreading tsan-freethreading; do - cp -av default/pixi.toml ${variant}/ -done diff --git a/Tools/pixi-packages/default/pixi.toml b/Tools/pixi-packages/default/pixi.toml deleted file mode 100644 index bf9841e18677cab..000000000000000 --- a/Tools/pixi-packages/default/pixi.toml +++ /dev/null @@ -1,15 +0,0 @@ -# NOTE: Please always only modify default/pixi.toml and then run clone-recipe.sh to -# propagate the changes to the other variants. - -[workspace] -channels = ["https://prefix.dev/conda-forge"] -platforms = ["linux-64", "linux-aarch64", "osx-64", "osx-arm64"] -preview = ["pixi-build"] -requires-pixi = ">=0.66.0" - -[package.build.backend] -name = "pixi-build-rattler-build" -version = "*" - -[package.build.config] -recipe = "../default/recipe.yaml" diff --git a/Tools/pixi-packages/default/variants.yaml b/Tools/pixi-packages/default/variants.yaml deleted file mode 100644 index f66e9e7a2226bab..000000000000000 --- a/Tools/pixi-packages/default/variants.yaml +++ /dev/null @@ -1,6 +0,0 @@ -variant: - - default -abi_tag: - - cp315 -version: - - 3.15 diff --git a/Tools/pixi-packages/freethreading/pixi.toml b/Tools/pixi-packages/freethreading/pixi.toml deleted file mode 100644 index bf9841e18677cab..000000000000000 --- a/Tools/pixi-packages/freethreading/pixi.toml +++ /dev/null @@ -1,15 +0,0 @@ -# NOTE: Please always only modify default/pixi.toml and then run clone-recipe.sh to -# propagate the changes to the other variants. - -[workspace] -channels = ["https://prefix.dev/conda-forge"] -platforms = ["linux-64", "linux-aarch64", "osx-64", "osx-arm64"] -preview = ["pixi-build"] -requires-pixi = ">=0.66.0" - -[package.build.backend] -name = "pixi-build-rattler-build" -version = "*" - -[package.build.config] -recipe = "../default/recipe.yaml" diff --git a/Tools/pixi-packages/freethreading/variants.yaml b/Tools/pixi-packages/freethreading/variants.yaml deleted file mode 100644 index 022833d04c3821f..000000000000000 --- a/Tools/pixi-packages/freethreading/variants.yaml +++ /dev/null @@ -1,6 +0,0 @@ -variant: - - freethreading -abi_tag: - - cp315t -version: - - 3.15 diff --git a/Tools/pixi-packages/asan/pixi.toml b/Tools/pixi-packages/pixi.toml similarity index 56% rename from Tools/pixi-packages/asan/pixi.toml rename to Tools/pixi-packages/pixi.toml index bf9841e18677cab..857026a67d00906 100644 --- a/Tools/pixi-packages/asan/pixi.toml +++ b/Tools/pixi-packages/pixi.toml @@ -1,6 +1,3 @@ -# NOTE: Please always only modify default/pixi.toml and then run clone-recipe.sh to -# propagate the changes to the other variants. - [workspace] channels = ["https://prefix.dev/conda-forge"] platforms = ["linux-64", "linux-aarch64", "osx-64", "osx-arm64"] @@ -10,6 +7,3 @@ requires-pixi = ">=0.66.0" [package.build.backend] name = "pixi-build-rattler-build" version = "*" - -[package.build.config] -recipe = "../default/recipe.yaml" diff --git a/Tools/pixi-packages/default/recipe.yaml b/Tools/pixi-packages/recipe.yaml similarity index 91% rename from Tools/pixi-packages/default/recipe.yaml rename to Tools/pixi-packages/recipe.yaml index 30d0d5a2ed2e04d..a1ab5d478412eef 100644 --- a/Tools/pixi-packages/default/recipe.yaml +++ b/Tools/pixi-packages/recipe.yaml @@ -1,6 +1,3 @@ -# NOTE: Please always only modify default/recipe.yaml and then run clone-recipe.sh to -# propagate the changes to the other variants. - context: # Keep up to date freethreading_tag: ${{ "t" if "freethreading" in variant else "" }} @@ -9,7 +6,7 @@ recipe: name: python source: - - path: ../../.. + - path: ../.. outputs: - package: @@ -25,12 +22,14 @@ outputs: name: python version: ${{ version }} build: + flags: + - ${{ variant }} string: "0_${{ abi_tag }}" files: exclude: - "*.o" script: - file: ../build.sh + file: build.sh env: PYTHON_VARIANT: ${{ variant }} python: diff --git a/Tools/pixi-packages/tsan-freethreading/pixi.toml b/Tools/pixi-packages/tsan-freethreading/pixi.toml deleted file mode 100644 index bf9841e18677cab..000000000000000 --- a/Tools/pixi-packages/tsan-freethreading/pixi.toml +++ /dev/null @@ -1,15 +0,0 @@ -# NOTE: Please always only modify default/pixi.toml and then run clone-recipe.sh to -# propagate the changes to the other variants. - -[workspace] -channels = ["https://prefix.dev/conda-forge"] -platforms = ["linux-64", "linux-aarch64", "osx-64", "osx-arm64"] -preview = ["pixi-build"] -requires-pixi = ">=0.66.0" - -[package.build.backend] -name = "pixi-build-rattler-build" -version = "*" - -[package.build.config] -recipe = "../default/recipe.yaml" diff --git a/Tools/pixi-packages/tsan-freethreading/variants.yaml b/Tools/pixi-packages/tsan-freethreading/variants.yaml deleted file mode 100644 index 6ed09fcc9b656bb..000000000000000 --- a/Tools/pixi-packages/tsan-freethreading/variants.yaml +++ /dev/null @@ -1,6 +0,0 @@ -variant: - - tsan-freethreading -abi_tag: - - tsan_cp315t -version: - - 3.15 diff --git a/Tools/pixi-packages/variants.yaml b/Tools/pixi-packages/variants.yaml new file mode 100644 index 000000000000000..877fc1778a08145 --- /dev/null +++ b/Tools/pixi-packages/variants.yaml @@ -0,0 +1,8 @@ +version: ["3.16"] + +openssl: + - '3.5' + +zip_keys: [["variant", "abi_tag"]] +variant: ["default", "asan", "freethreading", "tsan_freethreading"] +abi_tag: ["cp316", "asan_cp316", "cp316t", "tsan_cp316t"] From b226f35230709e293e633aa64667cb3249ecff3b Mon Sep 17 00:00:00 2001 From: Lucas Colley Date: Fri, 10 Jul 2026 14:31:45 +0100 Subject: [PATCH 2/3] tweaks --- Tools/pixi-packages/README.md | 2 +- Tools/pixi-packages/build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tools/pixi-packages/README.md b/Tools/pixi-packages/README.md index 1aad4f227e3d1db..952e4978ccbe0f3 100644 --- a/Tools/pixi-packages/README.md +++ b/Tools/pixi-packages/README.md @@ -11,7 +11,7 @@ in a [Pixi workspace](https://pixi.sh/latest/first_workspace/), like: [dependencies] python.git = "https://github.com/python/cpython" python.subdirectory = "Tools/pixi-packages" -python.flags = "asan" +python.flags = ["asan"] ``` This is particularly useful when developers need to build CPython from source diff --git a/Tools/pixi-packages/build.sh b/Tools/pixi-packages/build.sh index 7e22e6243a5f779..7d98c3b58237618 100644 --- a/Tools/pixi-packages/build.sh +++ b/Tools/pixi-packages/build.sh @@ -7,7 +7,7 @@ if [[ "${PYTHON_VARIANT}" == "freethreading" ]]; then elif [[ "${PYTHON_VARIANT}" == "asan" ]]; then CONFIGURE_EXTRA="--with-address-sanitizer" export ASAN_OPTIONS="strict_init_order=true" -elif [[ "${PYTHON_VARIANT}" == "tsan-freethreading" ]]; then +elif [[ "${PYTHON_VARIANT}" == "tsan_freethreading" ]]; then CONFIGURE_EXTRA="--disable-gil --with-thread-sanitizer" export TSAN_OPTIONS="suppressions=${SRC_DIR}/Tools/tsan/suppressions_free_threading.txt" elif [[ "${PYTHON_VARIANT}" == "default" ]]; then From 5cba45c44e2c7292c0148296e7e4bcef70594626 Mon Sep 17 00:00:00 2001 From: Lucas Colley Date: Fri, 10 Jul 2026 14:38:38 +0100 Subject: [PATCH 3/3] add news --- .../2026-07-10-14-38-31.gh-issue-152384.uaPADM.rst | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Misc/NEWS.d/next/Tools-Demos/2026-07-10-14-38-31.gh-issue-152384.uaPADM.rst diff --git a/Misc/NEWS.d/next/Tools-Demos/2026-07-10-14-38-31.gh-issue-152384.uaPADM.rst b/Misc/NEWS.d/next/Tools-Demos/2026-07-10-14-38-31.gh-issue-152384.uaPADM.rst new file mode 100644 index 000000000000000..08b94d5486f64d8 --- /dev/null +++ b/Misc/NEWS.d/next/Tools-Demos/2026-07-10-14-38-31.gh-issue-152384.uaPADM.rst @@ -0,0 +1,8 @@ +The CPython Pixi packages are now all accessible at the same +``Tools/pixi-packages`` subdirectory, rather than at +``Tools/pixi-packages/{variant}`` as before. Variants are now selected not +via subdirectory but via ``flags``; see +https://pixi.prefix.dev/latest/concepts/package_specifications/#extras-and-flags +for usage instructions. The ``tsan-freethreading`` variant has been renamed +to ``tsan_freethreading``, while the ``default``, ``asan``, and +``freethreading`` variants retain their previous names.