Skip to content

Commit 10849bb

Browse files
authored
📦 pkg: ship a free-threaded wheel (#628)
1 parent 7e3b71b commit 10849bb

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

.github/workflows/dist.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ jobs:
3333
CIBW_ARCHS: ${{ matrix.arch }}
3434
CIBW_BEFORE_ALL_LINUX: >-
3535
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
36-
CIBW_BUILD: cp310-* pp311-*
36+
# cp310 carries the abi3 wheel every GIL build shares; a free-threaded interpreter cannot use the
37+
# limited API, so it takes one wheel of its own. 3.15t waits for a final release rather than
38+
# shipping against a beta ABI.
39+
CIBW_BUILD: cp310-* cp314t-* pp311-*
3740
CIBW_ENABLE: pypy
3841
# musl targets default to a static CRT, which makes Cargo drop the cdylib crate type
3942
CIBW_ENVIRONMENT_LINUX: PATH=$HOME/.cargo/bin:$PATH RUSTFLAGS="-C target-feature=-crt-static"

meson.build

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,15 @@ if host_machine.system() == 'windows'
3333
else
3434
rust_artifact = 'lib_pipdeptree.' + (host_machine.system() == 'darwin' ? 'dylib' : 'so')
3535
endif
36-
if run_command(py, '-c', 'import sys; print(sys.implementation.name)', check: true).stdout().strip() == 'pypy'
36+
# PyPy has no stable ABI, and a free-threaded build cannot use the limited API at all, so both take a wheel per
37+
# interpreter named by its own extension suffix.
38+
per_interpreter = run_command(
39+
py,
40+
'-c',
41+
'import sys, sysconfig; print(sys.implementation.name == "pypy" or bool(sysconfig.get_config_var("Py_GIL_DISABLED")))',
42+
check: true,
43+
).stdout().strip() == 'True'
44+
if per_interpreter
3745
rust_extension = '_rust' + run_command(
3846
py,
3947
'-c',

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ docs = [
7373
[tool.meson-python]
7474
limited-api = true
7575

76+
[tool.cibuildwheel]
77+
overrides = [
78+
# meson-python refuses the limited API on a free-threaded interpreter, and the package asks for it by
79+
# default, so this build opts out.
80+
{ select = "cp3*t-*", config-settings.setup-args = "-Dpython.allow_limited_api=false" },
81+
]
82+
7683
[tool.ruff]
7784
line-length = 120
7885
format.preview = true

0 commit comments

Comments
 (0)