Skip to content

Commit 7c0ee27

Browse files
Upload 3.13 & free-threaded nightly wheels (#59136)
* Upload free-threaded nightly wheels on Linux and macOS * Consolidate jobs into one * Install build dependencies in before-build and pass --no-build-isolation * Fix {project} placeholder in cibuildwheel config * Correctly quote echo CIBW_BUILD_FRONTEND command * Run echo -e * Add {package} to before-build * Include cibw script in sdist & add matrix value for build frontend * Change manifest and gitattributes * Change gitattributes * Install verioneer in before-build * Add cibw_before_test to install nightly NumPy * Expand before-test to musl * Better comments plus always run before-build/before-test on 3.13 * Add --no-build-isolation in 3.13 as well * Install nightly numpy before windows tests * Address feedback; add todo for NumPy nightly and move default outside matrix * Set build_frontend to 'build' in pyodide build --------- Co-authored-by: Matthew Roeschke <[email protected]>
1 parent efb99be commit 7c0ee27

File tree

6 files changed

+52
-10
lines changed

6 files changed

+52
-10
lines changed

.gitattributes

+5-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ ci export-ignore
6868
doc export-ignore
6969
gitpod export-ignore
7070
MANIFEST.in export-ignore
71-
scripts export-ignore
71+
scripts/** export-ignore
7272
typings export-ignore
7373
web export-ignore
7474
CITATION.cff export-ignore
@@ -82,3 +82,7 @@ setup.py export-ignore
8282
# csv_dir_path fixture checks the existence of the directory
8383
# exclude the whole directory to avoid running related tests in sdist
8484
pandas/tests/io/parser/data export-ignore
85+
86+
# Include cibw script in sdist since it's needed for building wheels
87+
scripts/cibw_before_build.sh -export-ignore
88+
scripts/cibw_before_test.sh -export-ignore

.github/workflows/wheels.yml

+21-7
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,25 @@ jobs:
9999
- [macos-14, macosx_arm64]
100100
- [windows-2022, win_amd64]
101101
# TODO: support PyPy?
102-
python: [["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"]]
103-
102+
python: [["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"], ["cp313", "3.13"], ["cp313t", "3.13"]]
103+
include:
104+
# TODO: Remove this plus installing build deps in cibw_before_build.sh
105+
# and test deps in cibw_before_test.sh after pandas can be built with a released NumPy/Cython
106+
- python: ["cp313", "3.13"]
107+
cibw_build_frontend: 'pip; args: --no-build-isolation'
108+
- python: ["cp313t", "3.13"]
109+
cibw_build_frontend: 'pip; args: --no-build-isolation'
104110
# Build Pyodide wheels and upload them to Anaconda.org
105111
# NOTE: this job is similar to the one in unit-tests.yml except for the fact
106112
# that it uses cibuildwheel instead of a standard Pyodide xbuildenv setup.
107-
include:
108-
- buildplat: [ubuntu-22.04, pyodide_wasm32]
109-
python: ["cp312", "3.12"]
113+
- buildplat: [ubuntu-22.04, pyodide_wasm32]
114+
python: ["cp312", "3.12"]
115+
cibw_build_frontend: 'build'
116+
# TODO: Build free-threaded wheels for Windows
117+
exclude:
118+
- buildplat: [windows-2022, win_amd64]
119+
python: ["cp313t", "3.13"]
120+
110121
env:
111122
IS_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
112123
IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
@@ -153,6 +164,7 @@ jobs:
153164
env:
154165
CIBW_PRERELEASE_PYTHONS: True
155166
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
167+
CIBW_BUILD_FRONTEND: ${{ matrix.cibw_build_frontend || 'pip' }}
156168
CIBW_PLATFORM: ${{ matrix.buildplat[1] == 'pyodide_wasm32' && 'pyodide' || 'auto' }}
157169

158170
- name: Set up Python
@@ -176,15 +188,17 @@ jobs:
176188
- name: Test Windows Wheels
177189
if: ${{ matrix.buildplat[1] == 'win_amd64' }}
178190
shell: pwsh
191+
# TODO: Remove NumPy nightly install when there's a 3.13 wheel on PyPI
179192
run: |
180193
$TST_CMD = @"
181194
python -m pip install hypothesis>=6.84.0 pytest>=7.3.2 pytest-xdist>=3.4.0;
195+
${{ matrix.python[1] == '3.13' && 'python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy;' }}
182196
python -m pip install `$(Get-Item pandas\wheelhouse\*.whl);
183197
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`\"])`';
184198
"@
185199
# add rc to the end of the image name if the Python version is unreleased
186-
docker pull python:${{ matrix.python[1] == '3.12' && '3.12-rc' || format('{0}-windowsservercore', matrix.python[1]) }}
187-
docker run --env PANDAS_CI='1' -v ${PWD}:C:\pandas python:${{ matrix.python[1] == '3.12' && '3.12-rc' || format('{0}-windowsservercore', matrix.python[1]) }} powershell -Command $TST_CMD
200+
docker pull python:${{ matrix.python[1] == '3.13' && '3.13-rc' || format('{0}-windowsservercore', matrix.python[1]) }}
201+
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
188202
189203
- uses: actions/upload-artifact@v4
190204
with:

MANIFEST.in

+4
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,7 @@ prune pandas/tests/io/parser/data
6262
# Selectively re-add *.cxx files that were excluded above
6363
graft pandas/_libs/src
6464
graft pandas/_libs/include
65+
66+
# Include cibw script in sdist since it's needed for building wheels
67+
include scripts/cibw_before_build.sh
68+
include scripts/cibw_before_test.sh

pyproject.toml

+5-2
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,17 @@ test-command = """
154154
pd.test(extra_args=["-m not clipboard and not single_cpu and not slow and not network and not db", "-n 2", "--no-strict-data-files"]); \
155155
pd.test(extra_args=["-m not clipboard and single_cpu and not slow and not network and not db", "--no-strict-data-files"]);' \
156156
"""
157+
free-threaded-support = true
158+
before-build = "bash {package}/scripts/cibw_before_build.sh"
159+
before-test = "bash {package}/scripts/cibw_before_test.sh"
157160

158161
[tool.cibuildwheel.windows]
159-
before-build = "pip install delvewheel"
162+
before-build = "pip install delvewheel && bash {package}/scripts/cibw_before_build.sh"
160163
repair-wheel-command = "delvewheel repair -w {dest_dir} {wheel}"
161164

162165
[[tool.cibuildwheel.overrides]]
163166
select = "*-musllinux*"
164-
before-test = "apk update && apk add musl-locales"
167+
before-test = "apk update && apk add musl-locales && bash {package}/scripts/cibw_before_test.sh"
165168

166169
[[tool.cibuildwheel.overrides]]
167170
select = "*-win*"

scripts/cibw_before_build.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# TODO: Delete when there's PyPI NumPy/Cython releases the support Python 3.13.
2+
# If free-threading support is not included in those releases, this script will have
3+
# to whether this runs for a free-threaded build instead.
4+
PYTHON_VERSION="$(python -c "import sys; print(f'{sys.version_info.major}{sys.version_info.minor}')")"
5+
if [[ $PYTHON_VERSION == "313" ]]; then
6+
python -m pip install -U pip
7+
python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy cython
8+
python -m pip install ninja meson-python versioneer[toml]
9+
fi

scripts/cibw_before_test.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# TODO: Delete when there's PyPI NumPy/Cython releases the support Python 3.13.
2+
# If free-threading support is not included in those releases, this script will have
3+
# to whether this runs for a free-threaded build instead.
4+
PYTHON_VERSION="$(python -c "import sys; print(f'{sys.version_info.major}{sys.version_info.minor}')")"
5+
if [[ $PYTHON_VERSION == "313" ]]; then
6+
python -m pip install -U pip
7+
python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
8+
fi

0 commit comments

Comments
 (0)