run: |
sudo ./.github/workflows/posix-deps-apt.sh
# On ubuntu-26.04 image, clang is clang-21 by default
+ # NOTE: when bumping to a new version of clang,
+ # please update the versions in `Tools/pixi-packages/variants.yaml` too.
echo "CC=clang" >> "$GITHUB_ENV"
echo "CXX=clang++" >> "$GITHUB_ENV"
- name: TSan option setup
--- /dev/null
+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.
```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
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 `version` field in `variants.yaml` up to date with the
Python version
- Update `build.sh` for any breaking changes in the `configure` and `make` workflow
- 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
+++ /dev/null
-variant:
- - asan
-abi_tag:
- - asan_cp315
-version:
- - 3.15
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
exit 1
fi
+VER_REF=$(grep "\[PYTHON_VERSION\]\, \[" configure.ac | sed -n 's/.*\[\([0-9.]*\)\].*/\1/p')
+VER=$(echo ${PKG_VERSION} | sed -E 's/^([0-9]+\.[0-9]+).*/\1/')
+
+if [[ "${VER_REF}" != "${VER}" ]]; then
+ echo "Unexpected version from conda package. Got ${VER}. Expected ${VER_REF}. Do you need to update 'version' in 'variants.yaml'?"
+ exit 1
+fi
+
# rattler-build by default set a target of 10.9
# override it to at least 10.12
case ${MACOSX_DEPLOYMENT_TARGET:-10.12} in
+++ /dev/null
-#!/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
+++ /dev/null
-# 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"
+++ /dev/null
-variant:
- - default
-abi_tag:
- - cp315
-version:
- - 3.15
+++ /dev/null
-# 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"
+++ /dev/null
-variant:
- - freethreading
-abi_tag:
- - cp315t
-version:
- - 3.15
-# 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"
+requires-pixi = ">=0.72.2"
[package.build.backend]
name = "pixi-build-rattler-build"
version = "*"
-
-[package.build.config]
-recipe = "../default/recipe.yaml"
-# 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 "" }}
+ abi_prefix: ${{ (variant | split("_"))[0] + "_" if "san" in variant else "" }}
+ abi_tag: ${{ abi_prefix }}cp${{ (version | split('.'))[:2] | join('') }}${{ freethreading_tag }}
recipe:
name: python
source:
- - path: ../../..
+ - path: ../..
outputs:
- package:
name: python
version: ${{ version }}
build:
+ flags:
+ - ${{ variant }}
+ variant:
+ down_prioritize_variant: ${{ 0 if variant == "default" else 1 }}
string: "0_${{ abi_tag }}"
files:
exclude:
- "*.o"
script:
- file: ../build.sh
+ file: build.sh
env:
PYTHON_VARIANT: ${{ variant }}
python:
- libuuid
- libmpdec-devel
- expat
- - if: linux and "san" in variant
- then:
- - libsanitizer
- if: osx and "san" in variant
then:
- libcompiler-rt
+++ /dev/null
-# 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"
+++ /dev/null
-variant:
- - tsan-freethreading
-abi_tag:
- - tsan_cp315t
-version:
- - 3.15
--- /dev/null
+version: ["3.16"]
+variant: ["default", "asan", "freethreading", "tsan_freethreading"]
+
+openssl:
+ - '3.5'
+
+# match `.github/workflows/reusable-san.yml`
+c_compiler:
+ - clang
+c_compiler_version:
+ - 21
+cxx_compiler:
+ - clangxx
+cxx_compiler_version:
+ - 21