Skip to content

Commit e1dfdfd

Browse files
lysnikolaoumroeschke
authored andcommitted
Upload 3.13 & free-threaded nightly wheels (pandas-dev#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]> (cherry picked from commit 7c0ee27)
1 parent c7d0aa8 commit e1dfdfd

File tree

6 files changed

+49
-11
lines changed

6 files changed

+49
-11
lines changed

.gitattributes

Lines changed: 5 additions & 1 deletion
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

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,19 @@ jobs:
9999
- [macos-14, macosx_arm64]
100100
- [windows-2022, win_amd64]
101101
# TODO: support PyPy?
102-
python: [["cp39", "3.9"], ["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"]]
102+
python: [["cp39", "3.9"], ["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'
110+
# TODO: Build free-threaded wheels for Windows
111+
exclude:
112+
- buildplat: [windows-2022, win_amd64]
113+
python: ["cp313t", "3.13"]
114+
103115
env:
104116
IS_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
105117
IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
@@ -146,6 +158,7 @@ jobs:
146158
env:
147159
CIBW_PRERELEASE_PYTHONS: True
148160
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
161+
CIBW_BUILD_FRONTEND: ${{ matrix.cibw_build_frontend || 'pip' }}
149162

150163
- name: Set up Python
151164
uses: mamba-org/setup-micromamba@v1
@@ -168,15 +181,17 @@ jobs:
168181
- name: Test Windows Wheels
169182
if: ${{ matrix.buildplat[1] == 'win_amd64' }}
170183
shell: pwsh
184+
# TODO: Remove NumPy nightly install when there's a 3.13 wheel on PyPI
171185
run: |
172186
$TST_CMD = @"
173187
python -m pip install hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0;
188+
${{ matrix.python[1] == '3.13' && 'python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy;' }}
174189
python -m pip install `$(Get-Item pandas\wheelhouse\*.whl);
175190
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`\"])`';
176191
"@
177192
# add rc to the end of the image name if the Python version is unreleased
178-
docker pull python:${{ matrix.python[1] == '3.12' && '3.12-rc' || format('{0}-windowsservercore', matrix.python[1]) }}
179-
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
193+
docker pull python:${{ matrix.python[1] == '3.13' && '3.13-rc' || format('{0}-windowsservercore', matrix.python[1]) }}
194+
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
180195
181196
- uses: actions/upload-artifact@v4
182197
with:

MANIFEST.in

Lines changed: 4 additions & 0 deletions
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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,25 +153,23 @@ setup = ['--vsenv'] # For Windows
153153
skip = "cp36-* cp37-* cp38-* pp* *_i686 *_ppc64le *_s390x"
154154
build-verbosity = "3"
155155
environment = {LDFLAGS="-Wl,--strip-all"}
156-
# TODO: remove this once numpy 2.0 proper releases
157-
# and specify numpy 2.0 as a dependency in [build-system] requires in pyproject.toml
158-
before-build = "pip install numpy==2.0.0rc1"
159156
test-requires = "hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0"
160157
test-command = """
161158
PANDAS_CI='1' python -c 'import pandas as pd; \
162159
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"]); \
163160
pd.test(extra_args=["-m not clipboard and single_cpu and not slow and not network and not db", "--no-strict-data-files"]);' \
164161
"""
162+
free-threaded-support = true
163+
before-build = "bash {package}/scripts/cibw_before_build.sh"
164+
before-test = "bash {package}/scripts/cibw_before_test.sh"
165165

166166
[tool.cibuildwheel.windows]
167-
# TODO: remove this once numpy 2.0 proper releases
168-
# and specify numpy 2.0 as a dependency in [build-system] requires in pyproject.toml
169-
before-build = "pip install delvewheel numpy==2.0.0rc1"
167+
before-build = "pip install delvewheel && bash {package}/scripts/cibw_before_build.sh"
170168
repair-wheel-command = "delvewheel repair -w {dest_dir} {wheel}"
171169

172170
[[tool.cibuildwheel.overrides]]
173171
select = "*-musllinux*"
174-
before-test = "apk update && apk add musl-locales"
172+
before-test = "apk update && apk add musl-locales && bash {package}/scripts/cibw_before_test.sh"
175173

176174
[[tool.cibuildwheel.overrides]]
177175
select = "*-win*"

scripts/cibw_before_build.sh

Lines changed: 9 additions & 0 deletions
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

Lines changed: 8 additions & 0 deletions
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)