Skip to content

Commit

Permalink
Add support for freethreaded builds of Python 3.13 (astral-sh#326)
Browse files Browse the repository at this point in the history
* Add support for freethreaded builds of Python 3.13

* Split the 3.13 matrix into another job to get past the 256 matrix item limit

* Add `build_options` to the JSON schema

* Expect version 8 in the JSON schema

* Allow freethreaded libpython during validation on macOS

* Allow freethreaded libpython during validation on Linux

* Enable mimalloc

* Include `t` in abiflags patch for free-threaded builds

* Fix mistaken toggle of `CPYTHON_OPTIMIZED` for LTO builds

* Disable freethreaded musl builds

We will work on these separately
  • Loading branch information
zanieb authored Sep 26, 2024
1 parent ef71d13 commit 0d7e5e0
Show file tree
Hide file tree
Showing 13 changed files with 810 additions and 476 deletions.
101 changes: 63 additions & 38 deletions .github/workflows/apple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,161 +47,186 @@ jobs:
- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.8'
optimizations: 'debug'
options: 'debug'
- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.8'
optimizations: 'pgo'
options: 'pgo'
- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.8'
optimizations: 'pgo+lto'
options: 'pgo+lto'

- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.9'
optimizations: 'debug'
options: 'debug'
- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.9'
optimizations: 'pgo'
options: 'pgo'
- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.9'
optimizations: 'pgo+lto'
options: 'pgo+lto'

- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.10'
optimizations: 'debug'
options: 'debug'
- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.10'
optimizations: 'pgo'
options: 'pgo'
- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.10'
optimizations: 'pgo+lto'
options: 'pgo+lto'

- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.11'
optimizations: 'debug'
options: 'debug'
- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.11'
optimizations: 'pgo'
options: 'pgo'
- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.11'
optimizations: 'pgo+lto'
options: 'pgo+lto'

- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.12'
optimizations: 'debug'
options: 'debug'
- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.12'
optimizations: 'pgo'
options: 'pgo'
- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.12'
optimizations: 'pgo+lto'
options: 'pgo+lto'

- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.13'
optimizations: 'debug'
options: 'debug'
- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.13'
optimizations: 'pgo'
options: 'pgo'
- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.13'
optimizations: 'pgo+lto'
options: 'pgo+lto'

- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.13'
options: 'freethreaded+debug'
- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.13'
options: 'freethreaded+pgo'
- target_triple: 'aarch64-apple-darwin'
runner: macos-14
py: 'cpython-3.13'
options: 'freethreaded+pgo+lto'

# macOS on Intel hardware. This is pretty straightforward. We exclude
# noopt because it doesn't provide any compelling advantages over PGO
# or LTO builds.
- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.8'
optimizations: 'debug'
options: 'debug'
- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.8'
optimizations: 'pgo'
options: 'pgo'
- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.8'
optimizations: 'pgo+lto'
options: 'pgo+lto'

- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.9'
optimizations: 'debug'
options: 'debug'
- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.9'
optimizations: 'pgo'
options: 'pgo'
- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.9'
optimizations: 'pgo+lto'
options: 'pgo+lto'

- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.10'
optimizations: 'debug'
options: 'debug'
- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.10'
optimizations: 'pgo'
options: 'pgo'
- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.10'
optimizations: 'pgo+lto'
options: 'pgo+lto'

- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.11'
optimizations: 'debug'
options: 'debug'
- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.11'
optimizations: 'pgo'
options: 'pgo'
- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.11'
optimizations: 'pgo+lto'
options: 'pgo+lto'

- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.12'
optimizations: 'debug'
options: 'debug'
- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.12'
optimizations: 'pgo'
options: 'pgo'
- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.12'
optimizations: 'pgo+lto'
options: 'pgo+lto'

- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.13'
optimizations: 'debug'
options: 'debug'
- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.13'
options: 'pgo'
- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.13'
options: 'pgo+lto'
- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.13'
options: 'freethreaded+debug'
- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.13'
optimizations: 'pgo'
options: 'freethreaded+pgo'
- target_triple: 'x86_64-apple-darwin'
runner: macos-13
py: 'cpython-3.13'
optimizations: 'pgo+lto'
options: 'freethreaded+pgo+lto'
needs:
- pythonbuild
runs-on: ${{ matrix.build.runner }}
Expand Down Expand Up @@ -232,12 +257,12 @@ jobs:
exit 1
fi
./build-macos.py --target-triple ${{ matrix.build.target_triple }} --python ${{ matrix.build.py }} --optimizations ${{ matrix.build.optimizations }}
./build-macos.py --target-triple ${{ matrix.build.target_triple }} --python ${{ matrix.build.py }} --options ${{ matrix.build.options }}
- name: Upload Distributions
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.build.py }}-${{ matrix.build.target_triple }}-${{ matrix.build.optimizations }}
name: ${{ matrix.build.py }}-${{ matrix.build.target_triple }}-${{ matrix.build.options }}
path: dist/*

- uses: actions/checkout@v4
Expand Down
Loading

0 comments on commit 0d7e5e0

Please sign in to comment.