Skip to content

Commit 0d7e5e0

Browse files
authored
Add support for freethreaded builds of Python 3.13 (#326)
* 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
1 parent ef71d13 commit 0d7e5e0

File tree

13 files changed

+810
-476
lines changed

13 files changed

+810
-476
lines changed

.github/workflows/apple.yml

Lines changed: 63 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -47,161 +47,186 @@ jobs:
4747
- target_triple: 'aarch64-apple-darwin'
4848
runner: macos-14
4949
py: 'cpython-3.8'
50-
optimizations: 'debug'
50+
options: 'debug'
5151
- target_triple: 'aarch64-apple-darwin'
5252
runner: macos-14
5353
py: 'cpython-3.8'
54-
optimizations: 'pgo'
54+
options: 'pgo'
5555
- target_triple: 'aarch64-apple-darwin'
5656
runner: macos-14
5757
py: 'cpython-3.8'
58-
optimizations: 'pgo+lto'
58+
options: 'pgo+lto'
5959

6060
- target_triple: 'aarch64-apple-darwin'
6161
runner: macos-14
6262
py: 'cpython-3.9'
63-
optimizations: 'debug'
63+
options: 'debug'
6464
- target_triple: 'aarch64-apple-darwin'
6565
runner: macos-14
6666
py: 'cpython-3.9'
67-
optimizations: 'pgo'
67+
options: 'pgo'
6868
- target_triple: 'aarch64-apple-darwin'
6969
runner: macos-14
7070
py: 'cpython-3.9'
71-
optimizations: 'pgo+lto'
71+
options: 'pgo+lto'
7272

7373
- target_triple: 'aarch64-apple-darwin'
7474
runner: macos-14
7575
py: 'cpython-3.10'
76-
optimizations: 'debug'
76+
options: 'debug'
7777
- target_triple: 'aarch64-apple-darwin'
7878
runner: macos-14
7979
py: 'cpython-3.10'
80-
optimizations: 'pgo'
80+
options: 'pgo'
8181
- target_triple: 'aarch64-apple-darwin'
8282
runner: macos-14
8383
py: 'cpython-3.10'
84-
optimizations: 'pgo+lto'
84+
options: 'pgo+lto'
8585

8686
- target_triple: 'aarch64-apple-darwin'
8787
runner: macos-14
8888
py: 'cpython-3.11'
89-
optimizations: 'debug'
89+
options: 'debug'
9090
- target_triple: 'aarch64-apple-darwin'
9191
runner: macos-14
9292
py: 'cpython-3.11'
93-
optimizations: 'pgo'
93+
options: 'pgo'
9494
- target_triple: 'aarch64-apple-darwin'
9595
runner: macos-14
9696
py: 'cpython-3.11'
97-
optimizations: 'pgo+lto'
97+
options: 'pgo+lto'
9898

9999
- target_triple: 'aarch64-apple-darwin'
100100
runner: macos-14
101101
py: 'cpython-3.12'
102-
optimizations: 'debug'
102+
options: 'debug'
103103
- target_triple: 'aarch64-apple-darwin'
104104
runner: macos-14
105105
py: 'cpython-3.12'
106-
optimizations: 'pgo'
106+
options: 'pgo'
107107
- target_triple: 'aarch64-apple-darwin'
108108
runner: macos-14
109109
py: 'cpython-3.12'
110-
optimizations: 'pgo+lto'
110+
options: 'pgo+lto'
111111

112112
- target_triple: 'aarch64-apple-darwin'
113113
runner: macos-14
114114
py: 'cpython-3.13'
115-
optimizations: 'debug'
115+
options: 'debug'
116116
- target_triple: 'aarch64-apple-darwin'
117117
runner: macos-14
118118
py: 'cpython-3.13'
119-
optimizations: 'pgo'
119+
options: 'pgo'
120120
- target_triple: 'aarch64-apple-darwin'
121121
runner: macos-14
122122
py: 'cpython-3.13'
123-
optimizations: 'pgo+lto'
123+
options: 'pgo+lto'
124+
125+
- target_triple: 'aarch64-apple-darwin'
126+
runner: macos-14
127+
py: 'cpython-3.13'
128+
options: 'freethreaded+debug'
129+
- target_triple: 'aarch64-apple-darwin'
130+
runner: macos-14
131+
py: 'cpython-3.13'
132+
options: 'freethreaded+pgo'
133+
- target_triple: 'aarch64-apple-darwin'
134+
runner: macos-14
135+
py: 'cpython-3.13'
136+
options: 'freethreaded+pgo+lto'
124137

125138
# macOS on Intel hardware. This is pretty straightforward. We exclude
126139
# noopt because it doesn't provide any compelling advantages over PGO
127140
# or LTO builds.
128141
- target_triple: 'x86_64-apple-darwin'
129142
runner: macos-13
130143
py: 'cpython-3.8'
131-
optimizations: 'debug'
144+
options: 'debug'
132145
- target_triple: 'x86_64-apple-darwin'
133146
runner: macos-13
134147
py: 'cpython-3.8'
135-
optimizations: 'pgo'
148+
options: 'pgo'
136149
- target_triple: 'x86_64-apple-darwin'
137150
runner: macos-13
138151
py: 'cpython-3.8'
139-
optimizations: 'pgo+lto'
152+
options: 'pgo+lto'
140153

141154
- target_triple: 'x86_64-apple-darwin'
142155
runner: macos-13
143156
py: 'cpython-3.9'
144-
optimizations: 'debug'
157+
options: 'debug'
145158
- target_triple: 'x86_64-apple-darwin'
146159
runner: macos-13
147160
py: 'cpython-3.9'
148-
optimizations: 'pgo'
161+
options: 'pgo'
149162
- target_triple: 'x86_64-apple-darwin'
150163
runner: macos-13
151164
py: 'cpython-3.9'
152-
optimizations: 'pgo+lto'
165+
options: 'pgo+lto'
153166

154167
- target_triple: 'x86_64-apple-darwin'
155168
runner: macos-13
156169
py: 'cpython-3.10'
157-
optimizations: 'debug'
170+
options: 'debug'
158171
- target_triple: 'x86_64-apple-darwin'
159172
runner: macos-13
160173
py: 'cpython-3.10'
161-
optimizations: 'pgo'
174+
options: 'pgo'
162175
- target_triple: 'x86_64-apple-darwin'
163176
runner: macos-13
164177
py: 'cpython-3.10'
165-
optimizations: 'pgo+lto'
178+
options: 'pgo+lto'
166179

167180
- target_triple: 'x86_64-apple-darwin'
168181
runner: macos-13
169182
py: 'cpython-3.11'
170-
optimizations: 'debug'
183+
options: 'debug'
171184
- target_triple: 'x86_64-apple-darwin'
172185
runner: macos-13
173186
py: 'cpython-3.11'
174-
optimizations: 'pgo'
187+
options: 'pgo'
175188
- target_triple: 'x86_64-apple-darwin'
176189
runner: macos-13
177190
py: 'cpython-3.11'
178-
optimizations: 'pgo+lto'
191+
options: 'pgo+lto'
179192

180193
- target_triple: 'x86_64-apple-darwin'
181194
runner: macos-13
182195
py: 'cpython-3.12'
183-
optimizations: 'debug'
196+
options: 'debug'
184197
- target_triple: 'x86_64-apple-darwin'
185198
runner: macos-13
186199
py: 'cpython-3.12'
187-
optimizations: 'pgo'
200+
options: 'pgo'
188201
- target_triple: 'x86_64-apple-darwin'
189202
runner: macos-13
190203
py: 'cpython-3.12'
191-
optimizations: 'pgo+lto'
204+
options: 'pgo+lto'
192205

193206
- target_triple: 'x86_64-apple-darwin'
194207
runner: macos-13
195208
py: 'cpython-3.13'
196-
optimizations: 'debug'
209+
options: 'debug'
210+
- target_triple: 'x86_64-apple-darwin'
211+
runner: macos-13
212+
py: 'cpython-3.13'
213+
options: 'pgo'
214+
- target_triple: 'x86_64-apple-darwin'
215+
runner: macos-13
216+
py: 'cpython-3.13'
217+
options: 'pgo+lto'
218+
- target_triple: 'x86_64-apple-darwin'
219+
runner: macos-13
220+
py: 'cpython-3.13'
221+
options: 'freethreaded+debug'
197222
- target_triple: 'x86_64-apple-darwin'
198223
runner: macos-13
199224
py: 'cpython-3.13'
200-
optimizations: 'pgo'
225+
options: 'freethreaded+pgo'
201226
- target_triple: 'x86_64-apple-darwin'
202227
runner: macos-13
203228
py: 'cpython-3.13'
204-
optimizations: 'pgo+lto'
229+
options: 'freethreaded+pgo+lto'
205230
needs:
206231
- pythonbuild
207232
runs-on: ${{ matrix.build.runner }}
@@ -232,12 +257,12 @@ jobs:
232257
exit 1
233258
fi
234259
235-
./build-macos.py --target-triple ${{ matrix.build.target_triple }} --python ${{ matrix.build.py }} --optimizations ${{ matrix.build.optimizations }}
260+
./build-macos.py --target-triple ${{ matrix.build.target_triple }} --python ${{ matrix.build.py }} --options ${{ matrix.build.options }}
236261
237262
- name: Upload Distributions
238263
uses: actions/upload-artifact@v4
239264
with:
240-
name: ${{ matrix.build.py }}-${{ matrix.build.target_triple }}-${{ matrix.build.optimizations }}
265+
name: ${{ matrix.build.py }}-${{ matrix.build.target_triple }}-${{ matrix.build.options }}
241266
path: dist/*
242267

243268
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)