Skip to content

Commit dae8ad2

Browse files
committed
Support the free-threaded build
1 parent 42c2d8f commit dae8ad2

File tree

7 files changed

+164
-14
lines changed

7 files changed

+164
-14
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<array>
5+
<dict>
6+
<key>attributeSetting</key>
7+
<integer>1</integer>
8+
<key>choiceAttribute</key>
9+
<string>selected</string>
10+
<key>choiceIdentifier</key>
11+
<string>org.python.Python.PythonTFramework-3.14</string>
12+
</dict>
13+
</array>
14+
</plist>

.github/requirements/build-requirements.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Must be kept sync with build-system.requires at pyproject.toml
22
setuptools!=74.0.0
3-
cffi>=1.12; platform_python_implementation != 'PyPy'
3+
cffi>=1.12; platform_python_implementation != 'PyPy' and python_version < '3.14'
4+
cffi>=2.0.0b; platform_python_implementation != 'PyPy' and python_version >= '3.14'
45
maturin>=1,<2
56

67
# Must be kept sync with build-system.requires at vectors/pyproject.toml

.github/requirements/build-requirements.txt

Lines changed: 87 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file was autogenerated by uv via the following command:
22
# uv pip compile --universal --python-version 3.9 --allow-unsafe --generate-hashes build-requirements.in -o build-requirements.txt
3-
cffi==1.17.1 ; platform_python_implementation != 'PyPy' \
3+
cffi==1.17.1 ; python_full_version < '3.14' and platform_python_implementation != 'PyPy' \
44
--hash=sha256:045d61c734659cc045141be4bae381a41d89b741f795af1dd018bfb532fd0df8 \
55
--hash=sha256:0984a4925a435b1da406122d4d7968dd861c1385afe3b45ba82b750f229811e2 \
66
--hash=sha256:0e2b1fac190ae3ebfe37b979cc1ce69c81f4e4fe5746bb401dca63a9062cdaf1 \
@@ -84,8 +84,93 @@ maturin==1.9.3 \
8484
--hash=sha256:d71e8ccfc96602b25ecca77074b4a3459f419ab29505e966b9f1e7cc316f7a3e \
8585
--hash=sha256:f29cb1068396ee0376cf5b9f4dce706bea9f768555831d44259b316e25ce311d \
8686
--hash=sha256:fb2ee86861e72495eb9afd83f3672de0e4061740247f14492703c189829e7928
87+
cffi==2.0.0b1 ; python_full_version >= '3.14' and platform_python_implementation != 'PyPy' \
88+
--hash=sha256:0dbbe4a9bfcc058fccfee33ea5bebe50440767d219c2efa3a722a90ed59e8cfa \
89+
--hash=sha256:0eb17b22e313c453c940931f5d063ba9e87e5db12d99473477ab1851e66fedb4 \
90+
--hash=sha256:142c9c0c75fbc95ce23836e538681bd89e483de37b7cdf251dbdf0975995f8ac \
91+
--hash=sha256:14505e4a82aa84abddab6e493946d3ed6bf6d268b58e4c2f5bcf8ec2dee2ca2d \
92+
--hash=sha256:14c0ade7949f088615450abf884064b4ef11e8c9917b99d53f12e06cdfd2cd36 \
93+
--hash=sha256:16dc303af3630f54186b86aadf1121badf3cba6de17dfeacb84c5091e059a690 \
94+
--hash=sha256:1f4ca4ac8b9ee620ff5cb4307fae08691a0911bf0eeb488e8d6cf55bd77dfe43 \
95+
--hash=sha256:2155d2a0819c3fdcaa37832fb69e698d455627c23f83bc9c7adbef699fe4be19 \
96+
--hash=sha256:230a97779cdd6734b6af3bfda4be31406bab58a078f25327b169975be9225a46 \
97+
--hash=sha256:2355cd38f375906da70a8bad548eb63f65bed43c1044ed075691fa36e8e8315a \
98+
--hash=sha256:265666e15da6974e6a74110873321e84c7c2288e379aca44a7df4713325b9be4 \
99+
--hash=sha256:27309de8cebf48e056550db6607e2fb2c50109b54fc72c02b3b34811233483be \
100+
--hash=sha256:2b08dd1a826b678d39aa78f30edc1b7d9bd1e5b7e5adc2d47e8f56ab25ac7c13 \
101+
--hash=sha256:2da933859e1465a08f36d88e0452194da27b9ff0813e5ba49f02c544682d40e0 \
102+
--hash=sha256:2ea57043b545f346b081877737cb0320960012107d0250fa5183a4306f9365d6 \
103+
--hash=sha256:2fd8f55419576289d7cd8c9349ea46a222379936136754ab4c2b041294b0b48d \
104+
--hash=sha256:314afab228f7b45de7bae55059b4e706296e7d3984d53e643cc0389757216221 \
105+
--hash=sha256:31b8e3204cdef043e59a296383e6a43461d17c5c3d73fa9cebf4716a561291b0 \
106+
--hash=sha256:339e853c75f69c726b1a85f2217db6880422f915770679c47150eea895e02b46 \
107+
--hash=sha256:352e1949f7af33c37b060d2c2ea8a8fa1be6695ff94f8d5f7738bacacb9d6de4 \
108+
--hash=sha256:39eedbed09879f6d1591ad155afcc162aa11ebf3271215339b4aef3df5631573 \
109+
--hash=sha256:3b8aee0176d80781a21855832c411cfd3126c34966650693ec1245f0b756498b \
110+
--hash=sha256:3ba9946f292f7ae3a6f1cc72af259c477c291eb10ad3ca74180862e39f46a521 \
111+
--hash=sha256:3cc3245802b4950bc5459a2ef9a650d948972e44df120ecd2c6201814c8edb54 \
112+
--hash=sha256:4210ddc2b41c20739c64dede1304fb81415220ea671885623063fab44066e376 \
113+
--hash=sha256:4440de58d19c0bebe6a2f3b721253d67b27aabb34e00ab35756d8699876191ea \
114+
--hash=sha256:47a91ab8d17ed7caed27e5b2eda3b3478f3d28cecb3939d708545804273e159b \
115+
--hash=sha256:4b69c24a89c30a7821ecd25bcaff99075d95dd0c85c8845768c340a7736d84cf \
116+
--hash=sha256:504d264944d0934d7b02164af5c62b175255ef0d39c5142d95968b710c58a8f6 \
117+
--hash=sha256:505bec438236c623d7cfd8cc740598611a1d4883a629a0e33eb9e3c2dcd81b04 \
118+
--hash=sha256:53c780c2ec8ce0e5db9b74e9b0b55ff5d5f70071202740cef073a2771fa1d2ce \
119+
--hash=sha256:53fbcfdb35760bc6fb68096632d29700bcf37fd0d71922dcc577eb6193fc6edc \
120+
--hash=sha256:5acd1da34b96c8881b5df0e3d83cdbecc349b9ad5e9b8c0c589646c241448853 \
121+
--hash=sha256:5f304ce328ecfb7bc36034374c20d0b4ae70423253f8a81c5e0b5efd90e29cd4 \
122+
--hash=sha256:5f373f9bdc3569acd8aaebb6b521080eeb5a298533a58715537caf74e9e27f6b \
123+
--hash=sha256:601ddbaa51b1bd96a92a6a26e855060390023ab600377280a9bed7703ed2a088 \
124+
--hash=sha256:60c2c1d7adf558b932de9e4633f68e359063d1a748c92a4a3cba832085e9819b \
125+
--hash=sha256:6a1faa47c7fbe0627f6b621dadebed9f532a789a1d3b519731304da1d3ec3d14 \
126+
--hash=sha256:6de033c73dc89f80139c5a7d135fbd6c1d7b28ebb0d2df98cd1f4ef76991b15c \
127+
--hash=sha256:6ff1ba153e0740c2ea47d74d015c1a03c3addab1681633be0838103c297b855c \
128+
--hash=sha256:71ab35c6cc375da1e2c06af65bf0b5049199ad9b264f9ed7c90c0fe9450900e3 \
129+
--hash=sha256:762dd8db1bd710f7b828b3c6cbb7101b5e190e722eb5633eb79b1a6b751e349a \
130+
--hash=sha256:765c82d4a73ded03bfea961364f4c57dd6cfe7b0d57b7a2d9b95e2e7bd5de6f7 \
131+
--hash=sha256:76a19efb88a495bb7377fc542c7f97c9816dfc1d6bb4ad147acb99599a83e248 \
132+
--hash=sha256:782f60714ea2935e5391a0f69ad4705624cdc86243b18dcfafd08565c28e89bd \
133+
--hash=sha256:7b17e92900eb61bce62ea07ea8dd0dc33aa476ee8f977918050e52f90f5b645c \
134+
--hash=sha256:7dfd6f8f57e812f3175aa0d4d36ed797b6ff35f7cdfefea05417569b543ddc94 \
135+
--hash=sha256:853e90e942246f9e098f16baa45896f80675f86ab6447823c4030a67c3cc112d \
136+
--hash=sha256:856eb353a42b04d02b0633c71123276710a5390e92a27fbd2446864ca7d27923 \
137+
--hash=sha256:87acb9e2221ed37c385c9cef866377fbaa13180de9ba1cdc4e6dc927b273c87f \
138+
--hash=sha256:8af08fd246d2a544c8b68c25c171809d08eed9372f2026ae48dad17d26525578 \
139+
--hash=sha256:916141ca9ff05e9f67fe73c39a527d96a7101191673dee9985e71cd164b55915 \
140+
--hash=sha256:91fc109a1412dd29657f442a61bb571baaa1d074628145008ceb54dc9bb13941 \
141+
--hash=sha256:9c70c77ec47b96a593477386d7bf23243996c75f1cc7ce383ba35dcedca9bd14 \
142+
--hash=sha256:9d04b5fc06ba0ce45d7e51dfd8a14dc20708ef301fcf5a215c507f4e084b00c8 \
143+
--hash=sha256:9e23ac717e8b3767c80198d483c743fe596b055a6e29ef34f9d8cdf61f941f2f \
144+
--hash=sha256:a160995771c54b12dc5a1ef44d6fd59aeea4909e2d58c10169156e9d9a7e2960 \
145+
--hash=sha256:a812e9ab7a0bfef3e89089c0359e631d8521d5efc8d21c7ede3f1568db689920 \
146+
--hash=sha256:a898f76bac81f9a371df6c8664228a85cdea6b283a721f2493f0df6f80afd208 \
147+
--hash=sha256:aaec3f41cd6f0ffda5e23365822710d747b8613d3b8f54e12b5d7dcde688300d \
148+
--hash=sha256:ab4aea2f93ab6c408f0c6be8ddebe4d1086b4966148f542fe11cf82ca698dc07 \
149+
--hash=sha256:adbed7d68bc8837eb2c73e01bc284b5af9898e82b6067a6cbffea4f1820626e4 \
150+
--hash=sha256:bce5ce4790b8347c2d7937312218d0282af344f8a589db163520a02fe8e42281 \
151+
--hash=sha256:bd7ce5d8224fb5a57bd7f1d9843aa4ecb870ec3f4a2101e1ba8314e91177e184 \
152+
--hash=sha256:bdd3ce5e620ff6ee1e89fb7abb620756482fb3e337e5121e441cb0071c11cbd0 \
153+
--hash=sha256:be957dd266facf8e4925643073159b05021a990b46620b06ca27eaf9d900dbc2 \
154+
--hash=sha256:c177aa1cdae420519665da22760f4a4a159551733d4686a4467f579bf7b75470 \
155+
--hash=sha256:c5713cac21b2351a53958c765d8e9eda45184bb757c3ccab139608e708788796 \
156+
--hash=sha256:cb351fade24f7ba9ca481bee53d4257053b9fa9da55da276fe1187a990a49dde \
157+
--hash=sha256:cbde39be02aa7d8fbcd6bf1a9241cb1d84f2e2f0614970c51a707a9a176b85c6 \
158+
--hash=sha256:cf1b2510f1a91c4d7e8f83df6a13404332421e6e4a067059174d455653ae5314 \
159+
--hash=sha256:d2ede96d5de012d74b174082dec44c58a35b42e0ea9f197063ddb5e504ee0c7e \
160+
--hash=sha256:d31ba9f54739dcf98edb87e4881e326fad79e4866137c24afb0da531c1a965ca \
161+
--hash=sha256:d88f849d03c9aa2d7bbd710a0e20266f92bf524396c7fce881cd5a1971447812 \
162+
--hash=sha256:e227627762046204df31c589d7406540778d05622e395d41fc68b7895d40c174 \
163+
--hash=sha256:e2920fa42cf0616c21ea6d3948ad207cf0e420d2d2ef449d86ccad6ef9c13393 \
164+
--hash=sha256:e342223ada6b1d34f3719d3612991924cb68fa7f8fb2ec22f5bda254882828ab \
165+
--hash=sha256:ebb116751a49977c0b130493d3af13c567c4613946d293d4f61601237fabcd5f \
166+
--hash=sha256:ecf72cb96106fbde29682db37569c7cee3ebf29ecf9ead46978679057c6df234 \
167+
--hash=sha256:f2ebc97ba03b26e9b6b048b6c3981165126905cb20564fbf6584f5e072a1c189 \
168+
--hash=sha256:f4b5acb4cddcaf0ebb82a226f9fa1d5063505e0c206031ee1f4d173750b592fd \
169+
--hash=sha256:fba9546b80f3b275f04915ffbca7b75aa22a353c4f6410469fb1d8c340ec1c31 \
170+
--hash=sha256:fe8cb43962af8e43facad740930fadc4cf8cdc1e073f59d0f13714711807979f \
171+
--hash=sha256:ffbbeedd6bac26c0373b71831d3c73181a1c100dc6fc7aadbfcca54cace417db
87172
# via -r build-requirements.in
88-
pycparser==2.22 ; platform_python_implementation != 'PyPy' \
173+
pycparser==2.22 ; (python_full_version < '3.14' and platform_python_implementation != 'PyPy') or (implementation_name != 'PyPy' and platform_python_implementation != 'PyPy') \
89174
--hash=sha256:491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6 \
90175
--hash=sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc
91176
# via cffi

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ jobs:
5858
- {VERSION: "3.13", NOXSESSION: "tests-rust-debug"}
5959
# Not actually an MSRV, just for coverage on this
6060
- {VERSION: "3.13", NOXSESSION: "tests", RUST: "1.87", OPENSSL: {TYPE: "openssl", VERSION: "3.5.2"}}
61-
- {VERSION: "3.13", NOXSESSION: "tests", RUST: "1.87", NOXARGS: "--enable-fips=1", OPENSSL: {TYPE: "openssl", CONFIG_FLAGS: "enable-fips", VERSION: "3.5.2"}}
61+
- {VERSION: "3.13", NOXSESSION: "tests", RUST: "1.87", NOXARGS: "--enable-fips=1", OPENSSL: {TYPE: "openssl", CONFIG_FLAGS: "enable-fips", VERSION: "3.5.1"}}
62+
- {VERSION: "3.14t-dev", NOXSESSION: "rust,tests"}
6263
timeout-minutes: 15
6364
steps:
6465
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -288,6 +289,7 @@ jobs:
288289
PYTHON:
289290
- {VERSION: "3.8", NOXSESSION: "tests"}
290291
- {VERSION: "3.13", NOXSESSION: "tests"}
292+
- {VERSION: "3.14t-dev", NOXSESSION: "tests"}
291293
exclude:
292294
# We only test latest Python on arm64. py38 won't work since there's no universal2 binary
293295
- PYTHON: {VERSION: "3.8", NOXSESSION: "tests"}
@@ -356,6 +358,7 @@ jobs:
356358
PYTHON:
357359
- {VERSION: "3.8", NOXSESSION: "tests-nocoverage"}
358360
- {VERSION: "3.13", NOXSESSION: "tests"}
361+
- {VERSION: "3.14t-dev", NOXSESSION: "tests"}
359362
include:
360363
# Not in the main matrix because we want tests-nocoverage on Python
361364
# 3.13

.github/workflows/wheel-builder.yml

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ jobs:
6767
PYTHON:
6868
- { VERSION: "cp311-cp311", ABI_VERSION: 'py38' }
6969
- { VERSION: "cp311-cp311", ABI_VERSION: 'py311' }
70+
- { VERSION: "cp314-cp314t" }
7071
- { VERSION: "pp310-pypy310_pp73" }
7172
- { VERSION: "pp311-pypy311_pp73" }
7273
MANYLINUX:
@@ -84,7 +85,7 @@ jobs:
8485

8586
- { NAME: "manylinux_2_28_ppc64le", CONTAINER: "cryptography-manylinux_2_28:ppc64le", RUNNER: "ubuntu-24.04-ppc64le" }
8687
- { NAME: "manylinux_2_34_ppc64le", CONTAINER: "cryptography-manylinux_2_34:ppc64le", RUNNER: "ubuntu-24.04-ppc64le" }
87-
88+
8889
exclude:
8990
# There are no readily available musllinux PyPy distributions
9091
- PYTHON: { VERSION: "pp310-pypy310_pp73" }
@@ -122,6 +123,14 @@ jobs:
122123
- PYTHON: { VERSION: "pp311-pypy311_pp73" }
123124
MANYLINUX: { NAME: "manylinux_2_28_ppc64le", CONTAINER: "cryptography-manylinux_2_28:ppc64le", RUNNER: "ubuntu-24.04-ppc64le" }
124125

126+
# CFFI 2.0.0b is missing manylinux2014 wheels
127+
- PYTHON: { VERSION: "cp314-cp314t" }
128+
MANYLINUX: { NAME: "manylinux2014_x86_64", CONTAINER: "cryptography-manylinux2014:x86_64", RUNNER: "ubuntu-latest" }
129+
- PYTHON: { VERSION: "cp314-cp314t" }
130+
MANYLINUX: { NAME: "manylinux2014_x86_64", CONTAINER: "cryptography-manylinux2014:x86_64", RUNNER: "ubuntu-latest" }
131+
- PYTHON: { VERSION: "cp314-cp314t" }
132+
MANYLINUX: { NAME: "manylinux2014_aarch64", CONTAINER: "cryptography-manylinux2014_aarch64", RUNNER: "ubuntu-24.04-arm" }
133+
125134
name: "${{ matrix.PYTHON.VERSION }} for ${{ matrix.MANYLINUX.NAME }}"
126135
steps:
127136
- name: Ridiculous-er workaround for static node20
@@ -156,9 +165,12 @@ jobs:
156165
PY_LIMITED_API="--config-settings=build-args=--features=pyo3/abi3-${{ matrix.PYTHON.ABI_VERSION }}"
157166
fi
158167
168+
echo $PY_LIMITED_API
169+
ls cryptography*.tar.gz
170+
159171
OPENSSL_DIR="/opt/pyca/cryptography/openssl" \
160172
OPENSSL_STATIC=1 \
161-
uv build --python=/opt/python/${{ matrix.PYTHON.VERSION }}/bin/python --wheel --require-hashes --build-constraint=$BUILD_REQUIREMENTS_PATH $PY_LIMITED_API cryptography*.tar.gz -o tmpwheelhouse/
173+
manylinux-entrypoint uv build -v --python=/opt/python/${{ matrix.PYTHON.VERSION }}/bin/python --wheel --require-hashes --build-constraint=$BUILD_REQUIREMENTS_PATH $PY_LIMITED_API cryptography*.tar.gz -o tmpwheelhouse/
162174
env:
163175
RUSTUP_HOME: /root/.rustup
164176
- run: auditwheel repair --plat ${{ matrix.MANYLINUX.NAME }} tmpwheelhouse/cryptography*.whl -w wheelhouse/
@@ -214,6 +226,16 @@ jobs:
214226
# This will change in the future as we change the base Python we
215227
# build against
216228
_PYTHON_HOST_PLATFORM: 'macosx-10.9-universal2'
229+
- VERSION: '3.14t'
230+
DOWNLOAD_URL: 'https://www.python.org/ftp/python/3.14.0/python-3.14.0rc1-macos11.pkg'
231+
BIN_PATH: '/Library/Frameworks/PythonT.framework/Versions/3.14/bin/python3.14t'
232+
DEPLOYMENT_TARGET: '10.13'
233+
# This archflags is default, but let's be explicit
234+
ARCHFLAGS: '-arch x86_64 -arch arm64'
235+
# See https://github.com/pypa/cibuildwheel/blob/c8876b5c54a6c6b08de5d4b1586906b56203bd9e/cibuildwheel/macos.py#L257-L269
236+
# This will change in the future as we change the base Python we
237+
# build against
238+
_PYTHON_HOST_PLATFORM: 'macosx-10.9-universal2'
217239
- VERSION: 'pypy-3.10'
218240
BIN_PATH: 'pypy3'
219241
DEPLOYMENT_TARGET: '10.13'
@@ -226,7 +248,7 @@ jobs:
226248
ARCHFLAGS: '-arch x86_64'
227249
name: "${{ matrix.PYTHON.VERSION }} ABI ${{ matrix.PYTHON.ABI_VERSION }} macOS ${{ matrix.PYTHON.ARCHFLAGS }}"
228250
steps:
229-
- name: Get build-requirements.txt from repository
251+
- name: Get build configuration from repository
230252
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
231253
with:
232254
# The tag to build or the tag received by the tag event
@@ -235,14 +257,22 @@ jobs:
235257
sparse-checkout: |
236258
${{ env.BUILD_REQUIREMENTS_PATH }}
237259
${{ env.UV_REQUIREMENTS_PATH }}
260+
.github/config/macos-pkg-choices-freethreaded.xml
238261
sparse-checkout-cone-mode: false
239262
- name: Setup python
240263
run: |
241264
curl --max-time 30 --retry 5 "$PYTHON_DOWNLOAD_URL" -o python.pkg
242265
sudo installer -pkg python.pkg -target /
243266
env:
244267
PYTHON_DOWNLOAD_URL: ${{ matrix.PYTHON.DOWNLOAD_URL }}
245-
if: contains(matrix.PYTHON.VERSION, 'pypy') == false
268+
if: contains(matrix.PYTHON.VERSION, 'pypy') == false && matrix.PYTHON.VERSION != '3.14t'
269+
- name: Setup free-threaded python
270+
run: |
271+
curl --max-time 30 --retry 5 "$PYTHON_DOWNLOAD_URL" -o python.pkg
272+
sudo installer -pkg python.pkg -applyChoiceChangesXML .github/config/macos-pkg-choices-freethreaded.xml -target /
273+
env:
274+
PYTHON_DOWNLOAD_URL: ${{ matrix.PYTHON.DOWNLOAD_URL }}
275+
if: matrix.PYTHON.VERSION == '3.14t'
246276
- name: Setup pypy
247277
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
248278
with:
@@ -267,6 +297,9 @@ jobs:
267297
name: cryptography-sdist
268298

269299
- run: ${{ matrix.PYTHON.BIN_PATH }} -m pip install -r "${UV_REQUIREMENTS_PATH}"
300+
- name: add free-threaded python tools directory to PATH
301+
run: echo "/Library/Frameworks/PythonT.framework/Versions/3.14/bin" >> "$GITHUB_PATH"
302+
if: matrix.PYTHON.VERSION == '3.14t'
270303
- run: mkdir wheelhouse
271304
- name: Build the wheel
272305
run: |
@@ -311,6 +344,7 @@ jobs:
311344
PYTHON:
312345
- {VERSION: "3.11", "ABI_VERSION": "py38"}
313346
- {VERSION: "3.11", "ABI_VERSION": "py311"}
347+
- {VERSION: "3.14t-dev"}
314348
- {VERSION: "pypy-3.10"}
315349
- {VERSION: "pypy-3.11"}
316350
exclude:
@@ -343,6 +377,7 @@ jobs:
343377

344378
- name: Setup python
345379
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
380+
id: setup-python
346381
with:
347382
python-version: ${{ matrix.PYTHON.VERSION }}
348383
architecture: ${{ matrix.WINDOWS.ARCH }}
@@ -374,10 +409,13 @@ jobs:
374409
PY_LIMITED_API="--config-settings=build-args=--features=pyo3/abi3-${{ matrix.PYTHON.ABI_VERSION }}"
375410
fi
376411
377-
uv build --wheel --require-hashes --build-constraint=$BUILD_REQUIREMENTS_PATH cryptography*.tar.gz $PY_LIMITED_API -o wheelhouse/
412+
echo $PY_LIMITED_API
413+
ls cryptography*.tar.gz
414+
415+
uv build --python='${{ steps.setup-python.outputs.python-path }}' -v --wheel --require-hashes --build-constraint=$BUILD_REQUIREMENTS_PATH cryptography*.tar.gz $PY_LIMITED_API -o wheelhouse/
378416
shell: bash
379417
380-
- run: uv venv
418+
- run: uv venv --python='${{ steps.setup-python.outputs.python-path }}'
381419
- run: uv pip install --require-hashes -r "${BUILD_REQUIREMENTS_PATH}"
382420
shell: bash
383421
- run: uv pip install cryptography --no-index -f wheelhouse/

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ requires = [
55
"maturin>=1.8.6,<2",
66

77
# Must be kept in sync with `project.dependencies`
8-
"cffi>=1.14; platform_python_implementation != 'PyPy'",
8+
"cffi>=1.14; platform_python_implementation != 'PyPy' and python_version < '3.14'",
9+
"cffi>=2.0.0b; platform_python_implementation != 'PyPy' and python_version >= '3.14'",
910
# Used by cffi (which import distutils, and in Python 3.12, distutils has
1011
# been removed from the stdlib, but installing setuptools puts it back) as
1112
# well as our build.rs for the rust/cffi bridge.
@@ -48,7 +49,8 @@ classifiers = [
4849
requires-python = ">=3.8,!=3.9.0,!=3.9.1"
4950
dependencies = [
5051
# Must be kept in sync with `build-system.requires`
51-
"cffi>=1.14; platform_python_implementation != 'PyPy'",
52+
"cffi>=1.14; platform_python_implementation != 'PyPy' and python_version < '3.14'",
53+
"cffi>=2.0.0b; platform_python_implementation != 'PyPy' and python_version >= '3.14'",
5254
]
5355

5456
[project.urls]

src/rust/cryptography-cffi/build.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,15 @@ fn main() {
7878
build.include(python_include);
7979
}
8080

81-
// Enable abi3 mode if we're not using PyPy.
82-
if python_impl != "PyPy" {
81+
let is_free_threaded = run_python_script(
82+
&python,
83+
"import sysconfig; print(bool(sysconfig.get_config_var('Py_GIL_DISABLED')), end='')",
84+
)
85+
.unwrap()
86+
== "True";
87+
88+
// Enable abi3 mode if we're not using PyPy or the free-threaded build
89+
if !(python_impl == "PyPy" || is_free_threaded) {
8390
// cp38 (Python 3.8 to help our grep when we some day drop 3.8 support)
8491
build.define("Py_LIMITED_API", "0x030800f0");
8592
}

0 commit comments

Comments
 (0)