Skip to content

Commit 2931f20

Browse files
lucascolleyhugovkisurufngoldbaum
authored
gh-152384: pixi-packages: use flags to define variants (#152385)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Isuru Fernando <isuruf@gmail.com> Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
1 parent 597ec2d commit 2931f20

15 files changed

Lines changed: 50 additions & 103 deletions

File tree

.github/workflows/reusable-san.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ jobs:
3939
run: |
4040
sudo ./.github/workflows/posix-deps-apt.sh
4141
# On ubuntu-26.04 image, clang is clang-21 by default
42+
# NOTE: when bumping to a new version of clang,
43+
# please update the versions in `Tools/pixi-packages/variants.yaml` too.
4244
echo "CC=clang" >> "$GITHUB_ENV"
4345
echo "CXX=clang++" >> "$GITHUB_ENV"
4446
- name: TSan option setup
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
The CPython Pixi packages are now all accessible at the same
2+
``Tools/pixi-packages`` subdirectory, rather than at
3+
``Tools/pixi-packages/{variant}`` as before. Variants are now selected not
4+
via subdirectory but via ``flags``; see
5+
https://pixi.prefix.dev/latest/concepts/package_specifications/#extras-and-flags
6+
for usage instructions. The ``tsan-freethreading`` variant has been renamed
7+
to ``tsan_freethreading``, while the ``default``, ``asan``, and
8+
``freethreading`` variants retain their previous names.

Tools/pixi-packages/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,34 @@ in a [Pixi workspace](https://pixi.sh/latest/first_workspace/), like:
1010
```toml
1111
[dependencies]
1212
python.git = "https://github.com/python/cpython"
13-
python.subdirectory = "Tools/pixi-packages/asan"
13+
python.subdirectory = "Tools/pixi-packages"
14+
python.flags = ["asan"]
1415
```
1516

1617
This is particularly useful when developers need to build CPython from source
1718
(for example, for an ASan or TSan-instrumented build), as it does not require any manual
1819
clone or build steps. Instead, Pixi will automatically handle both the build
1920
and installation of the package.
2021

21-
Each package definition is contained in a subdirectory, but they share the build script
22-
`build.sh` in this directory. Currently defined package variants:
22+
Each package variant carries a 'flag' to enable selection of that variant — see
23+
[the Pixi docs](https://pixi.prefix.dev/latest/concepts/package_specifications/#extras-and-flags)
24+
for details of how to use this. Currently defined package variants:
2325

2426
- `default`
2527
- `freethreading`
2628
- `asan`: ASan-instrumented build
27-
- `tsan-freethreading`: TSan-instrumented free-threading build
29+
- `tsan_freethreading`: TSan-instrumented free-threading build
2830

2931
## Maintenance
3032

31-
- Keep the `abi_tag` and `version` fields in each `variants.yaml` up to date with the
33+
- Keep the `version` field in `variants.yaml` up to date with the
3234
Python version
3335
- Update `build.sh` for any breaking changes in the `configure` and `make` workflow
3436

3537
## Opportunities for future improvement
3638

3739
- More package variants (such as UBSan)
3840
- Support for Windows
39-
- Using a single `pixi.toml` for all package variants is blocked on
40-
[pixi#5248](https://github.com/prefix-dev/pixi/issues/5248)
4141

4242
## Troubleshooting
4343

Tools/pixi-packages/asan/variants.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

Tools/pixi-packages/build.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if [[ "${PYTHON_VARIANT}" == "freethreading" ]]; then
77
elif [[ "${PYTHON_VARIANT}" == "asan" ]]; then
88
CONFIGURE_EXTRA="--with-address-sanitizer"
99
export ASAN_OPTIONS="strict_init_order=true"
10-
elif [[ "${PYTHON_VARIANT}" == "tsan-freethreading" ]]; then
10+
elif [[ "${PYTHON_VARIANT}" == "tsan_freethreading" ]]; then
1111
CONFIGURE_EXTRA="--disable-gil --with-thread-sanitizer"
1212
export TSAN_OPTIONS="suppressions=${SRC_DIR}/Tools/tsan/suppressions_free_threading.txt"
1313
elif [[ "${PYTHON_VARIANT}" == "default" ]]; then
@@ -17,6 +17,14 @@ else
1717
exit 1
1818
fi
1919

20+
VER_REF=$(grep "\[PYTHON_VERSION\]\, \[" configure.ac | sed -n 's/.*\[\([0-9.]*\)\].*/\1/p')
21+
VER=$(echo ${PKG_VERSION} | sed -E 's/^([0-9]+\.[0-9]+).*/\1/')
22+
23+
if [[ "${VER_REF}" != "${VER}" ]]; then
24+
echo "Unexpected version from conda package. Got ${VER}. Expected ${VER_REF}. Do you need to update 'version' in 'variants.yaml'?"
25+
exit 1
26+
fi
27+
2028
# rattler-build by default set a target of 10.9
2129
# override it to at least 10.12
2230
case ${MACOSX_DEPLOYMENT_TARGET:-10.12} in

Tools/pixi-packages/clone-recipe.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

Tools/pixi-packages/default/pixi.toml

Lines changed: 0 additions & 15 deletions
This file was deleted.

Tools/pixi-packages/default/variants.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

Tools/pixi-packages/freethreading/pixi.toml

Lines changed: 0 additions & 15 deletions
This file was deleted.

Tools/pixi-packages/freethreading/variants.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)