Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLD, CI: Use cibuildwheel to build Emscripten/Pyodide wheels, push nightlies to Anaconda.org #58647

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
1 change: 1 addition & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ jobs:
- name: Run Tests
uses: ./.github/actions/run-tests

# NOTE: this job must be kept in sync with the Pyodide build job in wheels.yml
emscripten:
# Note: the Python version, Emscripten toolchain version are determined
# by the Pyodide version. The appropriate versions can be found in the
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,58 @@ jobs:
source ci/upload_wheels.sh
set_upload_vars
upload_wheels

# 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.
build_pyodide_wheels:
name: Build wheel for cp312-pyodide_wasm32
# Run on schedule, manual (workflow dispatch), and push events
# Skip on PRs, because these are running in the unit tests job already

# TODO: Uncomment the following condition(s) when this PR is ready to be merged
# if: >-
# (github.event_name == 'schedule') ||
# (github.event_name == 'workflow_dispatch') &&
# (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0')))

runs-on: ubuntu-22.04
steps:
- name: Checkout pandas Repo
uses: actions/checkout@v4
with:
fetch-depth: 0

# Note: Pyodide 0.26.0 is supported with Python 3.12. For more information, see
# https://github.com/pyodide/pyodide/blob/main/Makefile.envs
- name: Set up Python for Pyodide
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Build WASM wheel for pandas
uses: pypa/cibuildwheel@v2.19.0
with:
output-dir: ./wheelhouse
env:
CIBW_PLATFORM: pyodide

- uses: actions/upload-artifact@v4
with:
name: pyodide_wheel
path: ./wheelhouse/*.whl

Comment on lines +238 to +243
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have included this step in case it is needed to inspect the binary and do some debugging – happy to remove it based on what is suggested.

- name: Upload Pyodide wheels
if: >-
success() &&
(github.event_name == 'schedule') ||
(github.event_name == 'workflow_dispatch') &&
(github.repository == 'pandas-dev/pandas')
shell: bash -el {0}
env:
PANDAS_NIGHTLY_UPLOAD_TOKEN: ${{ secrets.PANDAS_NIGHTLY_UPLOAD_TOKEN }}
run: |
source ci/upload_wheels.sh
set_upload_vars
upload_wheels
agriyakhetarpal marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions pandas/tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import numpy as np
import pytest

from pandas.compat import WASM

import pandas as pd
from pandas import Series
import pandas._testing as tm
Expand Down Expand Up @@ -234,6 +236,7 @@ def test_temp_setattr(with_exception):
assert ser.name == "first"


@pytest.mark.skipif(WASM, reason="Can't start subprocesses in WASM")
@pytest.mark.single_cpu
def test_str_size():
# GH#21758
Expand Down
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@ test-command = ""
select = "*-macosx*"
environment = {CFLAGS="-g0"}

[[tool.cibuildwheel.overrides]]
select = "*pyodide*"
test-requires = "pytest>=7.3.2 hypothesis>=6.46.1"
# Pyodide repairs wheels on its own, using auditwheel-emscripten
repair-wheel-command = ""
test-command = """
PANDAS_CI='1' python -c 'import pandas as pd; \
pd.test(extra_args=["-m not clipboard and not single_cpu and not slow and not network and not db", "--no-strict-data-files"]);' \
"""

[tool.ruff]
line-length = 88
target-version = "py310"
Expand Down