Skip to content

Commit

Permalink
Upload 3.13 & free-threaded nightly wheels (#59136)
Browse files Browse the repository at this point in the history
* 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 <10647082+mroeschke@users.noreply.github.com>
  • Loading branch information
lysnikolaou and mroeschke authored Jul 22, 2024
1 parent efb99be commit 7c0ee27
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 10 deletions.
6 changes: 5 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ci export-ignore
doc export-ignore
gitpod export-ignore
MANIFEST.in export-ignore
scripts export-ignore
scripts/** export-ignore
typings export-ignore
web export-ignore
CITATION.cff export-ignore
Expand All @@ -82,3 +82,7 @@ setup.py export-ignore
# csv_dir_path fixture checks the existence of the directory
# exclude the whole directory to avoid running related tests in sdist
pandas/tests/io/parser/data export-ignore

# Include cibw script in sdist since it's needed for building wheels
scripts/cibw_before_build.sh -export-ignore
scripts/cibw_before_test.sh -export-ignore
28 changes: 21 additions & 7 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,25 @@ jobs:
- [macos-14, macosx_arm64]
- [windows-2022, win_amd64]
# TODO: support PyPy?
python: [["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"]]

python: [["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"], ["cp313", "3.13"], ["cp313t", "3.13"]]
include:
# TODO: Remove this plus installing build deps in cibw_before_build.sh
# and test deps in cibw_before_test.sh after pandas can be built with a released NumPy/Cython
- python: ["cp313", "3.13"]
cibw_build_frontend: 'pip; args: --no-build-isolation'
- python: ["cp313t", "3.13"]
cibw_build_frontend: 'pip; args: --no-build-isolation'
# Build Pyodide wheels and upload them to Anaconda.org
# NOTE: this job is similar to the one in unit-tests.yml except for the fact
# that it uses cibuildwheel instead of a standard Pyodide xbuildenv setup.
include:
- buildplat: [ubuntu-22.04, pyodide_wasm32]
python: ["cp312", "3.12"]
- buildplat: [ubuntu-22.04, pyodide_wasm32]
python: ["cp312", "3.12"]
cibw_build_frontend: 'build'
# TODO: Build free-threaded wheels for Windows
exclude:
- buildplat: [windows-2022, win_amd64]
python: ["cp313t", "3.13"]

env:
IS_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
Expand Down Expand Up @@ -153,6 +164,7 @@ jobs:
env:
CIBW_PRERELEASE_PYTHONS: True
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
CIBW_BUILD_FRONTEND: ${{ matrix.cibw_build_frontend || 'pip' }}
CIBW_PLATFORM: ${{ matrix.buildplat[1] == 'pyodide_wasm32' && 'pyodide' || 'auto' }}

- name: Set up Python
Expand All @@ -176,15 +188,17 @@ jobs:
- name: Test Windows Wheels
if: ${{ matrix.buildplat[1] == 'win_amd64' }}
shell: pwsh
# TODO: Remove NumPy nightly install when there's a 3.13 wheel on PyPI
run: |
$TST_CMD = @"
python -m pip install hypothesis>=6.84.0 pytest>=7.3.2 pytest-xdist>=3.4.0;
${{ matrix.python[1] == '3.13' && 'python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy;' }}
python -m pip install `$(Get-Item pandas\wheelhouse\*.whl);
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`\"])`';
"@
# add rc to the end of the image name if the Python version is unreleased
docker pull python:${{ matrix.python[1] == '3.12' && '3.12-rc' || format('{0}-windowsservercore', matrix.python[1]) }}
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
docker pull python:${{ matrix.python[1] == '3.13' && '3.13-rc' || format('{0}-windowsservercore', matrix.python[1]) }}
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
- uses: actions/upload-artifact@v4
with:
Expand Down
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@ prune pandas/tests/io/parser/data
# Selectively re-add *.cxx files that were excluded above
graft pandas/_libs/src
graft pandas/_libs/include

# Include cibw script in sdist since it's needed for building wheels
include scripts/cibw_before_build.sh
include scripts/cibw_before_test.sh
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,17 @@ test-command = """
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"]); \
pd.test(extra_args=["-m not clipboard and single_cpu and not slow and not network and not db", "--no-strict-data-files"]);' \
"""
free-threaded-support = true
before-build = "bash {package}/scripts/cibw_before_build.sh"
before-test = "bash {package}/scripts/cibw_before_test.sh"

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

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

[[tool.cibuildwheel.overrides]]
select = "*-win*"
Expand Down
9 changes: 9 additions & 0 deletions scripts/cibw_before_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# TODO: Delete when there's PyPI NumPy/Cython releases the support Python 3.13.
# If free-threading support is not included in those releases, this script will have
# to whether this runs for a free-threaded build instead.
PYTHON_VERSION="$(python -c "import sys; print(f'{sys.version_info.major}{sys.version_info.minor}')")"
if [[ $PYTHON_VERSION == "313" ]]; then
python -m pip install -U pip
python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy cython
python -m pip install ninja meson-python versioneer[toml]
fi
8 changes: 8 additions & 0 deletions scripts/cibw_before_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# TODO: Delete when there's PyPI NumPy/Cython releases the support Python 3.13.
# If free-threading support is not included in those releases, this script will have
# to whether this runs for a free-threaded build instead.
PYTHON_VERSION="$(python -c "import sys; print(f'{sys.version_info.major}{sys.version_info.minor}')")"
if [[ $PYTHON_VERSION == "313" ]]; then
python -m pip install -U pip
python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
fi

0 comments on commit 7c0ee27

Please sign in to comment.