Skip to content

Commit 6bdb32b

Browse files
lysnikolaoulithomas1mroeschke
authored
CI: Add Windows wheels for the free-threaded build (#60146)
Co-authored-by: Thomas Li <[email protected]> Co-authored-by: Matthew Roeschke <[email protected]>
1 parent 5f23ace commit 6bdb32b

8 files changed

+34
-32
lines changed

.gitattributes

+2-1
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,5 @@ pandas/tests/io/parser/data export-ignore
8585

8686
# Include cibw script in sdist since it's needed for building wheels
8787
scripts/cibw_before_build.sh -export-ignore
88-
scripts/cibw_before_test.sh -export-ignore
88+
scripts/cibw_before_build_windows.sh -export-ignore
89+
scripts/cibw_before_test_windows.sh -export-ignore

.github/workflows/unit-tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,8 @@ jobs:
387387
- name: Build Environment
388388
run: |
389389
python --version
390-
python -m pip install --upgrade pip setuptools wheel meson[ninja]==1.2.1 meson-python==0.13.1
391-
python -m pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy cython
390+
python -m pip install --upgrade pip setuptools wheel numpy meson[ninja]==1.2.1 meson-python==0.13.1
391+
python -m pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple cython
392392
python -m pip install versioneer[toml]
393393
python -m pip install python-dateutil pytz tzdata hypothesis>=6.84.0 pytest>=7.3.2 pytest-xdist>=3.4.0 pytest-cov
394394
python -m pip install -ve . --no-build-isolation --no-index --no-deps -Csetup-args="--werror"

.github/workflows/wheels.yml

-18
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,6 @@ jobs:
111111
- buildplat: [ubuntu-22.04, pyodide_wasm32]
112112
python: ["cp312", "3.12"]
113113
cibw_build_frontend: 'build'
114-
# TODO: Build free-threaded wheels for Windows
115-
exclude:
116-
- buildplat: [windows-2022, win_amd64]
117-
python: ["cp313t", "3.13"]
118114

119115
env:
120116
IS_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
@@ -181,20 +177,6 @@ jobs:
181177
shell: bash -el {0}
182178
run: for whl in $(ls wheelhouse); do wheel unpack wheelhouse/$whl -d /tmp; done
183179

184-
# Testing on windowsservercore instead of GHA runner to fail on missing DLLs
185-
- name: Test Windows Wheels
186-
if: ${{ matrix.buildplat[1] == 'win_amd64' }}
187-
shell: pwsh
188-
run: |
189-
$TST_CMD = @"
190-
python -m pip install hypothesis>=6.84.0 pytest>=7.3.2 pytest-xdist>=3.4.0;
191-
python -m pip install `$(Get-Item pandas\wheelhouse\*.whl);
192-
python -c `'import pandas as pd; pd.test(extra_args=[`\"--no-strict-data-files`\", `\"-m not clipboard and not single_cpu and not slow and not network and not db`\"])`';
193-
"@
194-
# add rc to the end of the image name if the Python version is unreleased
195-
docker pull python:${{ matrix.python[1] == '3.13' && '3.13-rc' || format('{0}-windowsservercore', matrix.python[1]) }}
196-
docker run --env PANDAS_CI='1' -v ${PWD}:C:\pandas python:${{ matrix.python[1] == '3.13' && '3.13-rc' || format('{0}-windowsservercore', matrix.python[1]) }} powershell -Command $TST_CMD
197-
198180
- uses: actions/upload-artifact@v4
199181
with:
200182
name: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}

MANIFEST.in

+2
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,5 @@ graft pandas/_libs/include
6565

6666
# Include cibw script in sdist since it's needed for building wheels
6767
include scripts/cibw_before_build.sh
68+
include scripts/cibw_before_build_windows.sh
69+
include scripts/cibw_before_test_windows.sh

pyproject.toml

+7-8
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,13 @@ free-threaded-support = true
160160
before-build = "PACKAGE_DIR={package} bash {package}/scripts/cibw_before_build.sh"
161161

162162
[tool.cibuildwheel.windows]
163-
before-build = "pip install delvewheel && bash {package}/scripts/cibw_before_build.sh"
163+
before-build = "pip install delvewheel && bash {package}/scripts/cibw_before_build_windows.sh"
164+
before-test = "bash {package}/scripts/cibw_before_test_windows.sh"
165+
test-command = """
166+
set PANDAS_CI='1' && \
167+
python -c "import pandas as pd; \
168+
pd.test(extra_args=['--no-strict-data-files', '-m not clipboard and not single_cpu and not slow and not network and not db']);" \
169+
"""
164170
repair-wheel-command = "delvewheel repair -w {dest_dir} {wheel}"
165171

166172
[[tool.cibuildwheel.overrides]]
@@ -175,13 +181,6 @@ test-command = """
175181
select = "*-musllinux*"
176182
before-test = "apk update && apk add musl-locales"
177183

178-
[[tool.cibuildwheel.overrides]]
179-
select = "*-win*"
180-
# We test separately for Windows, since we use
181-
# the windowsservercore docker image to check if any dlls are
182-
# missing from the wheel
183-
test-command = ""
184-
185184
[[tool.cibuildwheel.overrides]]
186185
# Don't strip wheels on macOS.
187186
# macOS doesn't support stripping wheels with linker

scripts/cibw_before_build.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ done
55

66
# TODO: Delete when there's a PyPI Cython release that supports free-threaded Python 3.13.
77
FREE_THREADED_BUILD="$(python -c"import sysconfig; print(bool(sysconfig.get_config_var('Py_GIL_DISABLED')))")"
8-
if [[ $FREE_THREADED_BUILD == "True" ]]; then
8+
if [[ $FREE_THREADED_BUILD == "True" ]]; then
99
python -m pip install -U pip
10-
python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy cython
11-
python -m pip install ninja meson-python versioneer[toml]
10+
python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple cython
11+
python -m pip install numpy ninja meson-python versioneer[toml]
1212
fi

scripts/cibw_before_build_windows.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Add 3rd party licenses, like numpy does
2+
for file in $PACKAGE_DIR/LICENSES/*; do
3+
cat $file >> $PACKAGE_DIR/LICENSE
4+
done
5+
6+
# TODO: Delete when there's a PyPI Cython release that supports free-threaded Python 3.13
7+
# and a NumPy Windows wheel for the free-threaded build on PyPI.
8+
FREE_THREADED_BUILD="$(python -c"import sysconfig; print(bool(sysconfig.get_config_var('Py_GIL_DISABLED')))")"
9+
if [[ $FREE_THREADED_BUILD == "True" ]]; then
10+
python -m pip install -U pip
11+
python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy cython
12+
python -m pip install ninja meson-python versioneer[toml]
13+
fi

scripts/cibw_before_test_windows.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# TODO: Delete when there's a NumPy Windows wheel for the free-threaded build on PyPI.
2+
FREE_THREADED_BUILD="$(python -c"import sysconfig; print(bool(sysconfig.get_config_var('Py_GIL_DISABLED')))")"
3+
if [[ $FREE_THREADED_BUILD == "True" ]]; then
4+
python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
5+
fi

0 commit comments

Comments
 (0)