Skip to content

Commit e9eeb5e

Browse files
authored
Add wasm wheels and sdist (#6)
1 parent b5be2ac commit e9eeb5e

File tree

3 files changed

+43
-14
lines changed

3 files changed

+43
-14
lines changed

.github/workflows/buildwheels.yml

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,31 +25,38 @@ jobs:
2525
import os
2626
import pprint
2727
28-
# Operating systems:
29-
oss = ["ubuntu", "macos", "windows"]
28+
# Platforms:
29+
platforms = ["linux", "macos", "windows", "pyodide"]
3030
31-
# For each OS, what arch to use with cibuildwheel:
32-
os_archs = {
33-
"ubuntu": ["x86_64", "i686", "aarch64"],
31+
# For each platform, what arch to use with cibuildwheel:
32+
platform_archs = {
33+
"linux": ["x86_64", "i686", "aarch64"],
3434
"macos": ["arm64", "x86_64"],
3535
"windows": ["x86", "AMD64", "ARM64"],
36+
"pyodide": ["wasm32"],
3637
}
3738
3839
# Available Python versions: https://pypi.org/project/cibuildwheel/
3940
# Note that cibuildwheel recommends not shipping wheels for pre-release versions
4041
# of Python: https://cibuildwheel.readthedocs.io/en/stable/options/#enable
4142
pys = ["cp39", "cp310", "cp311", "cp312", "cp313", "cp314"]
4243
43-
# Some OS/arch combinations are only suported on newer Python versions:
44-
os_arch_pys = {
44+
# Some plaform/arch combinations are only suported on newer Python versions:
45+
platform_arch_pys = {
4546
("windows", "ARM64"): ["cp311", "cp312", "cp313", "cp314"],
47+
("pyodide", "wasm32"): ["cp312", "cp313"],
4648
}
4749
50+
# Which OS to use for build (if different from platform name):
51+
platform_os = {"pyodide": "ubuntu", "linux": "ubuntu"}
52+
4853
all_them = []
49-
for the_os in oss:
50-
for the_arch in os_archs[the_os]:
51-
for the_py in os_arch_pys.get((the_os, the_arch), pys):
54+
for the_platform in platforms:
55+
for the_arch in platform_archs[the_platform]:
56+
for the_py in platform_arch_pys.get((the_platform, the_arch), pys):
57+
the_os = platform_os.get(the_platform, the_platform)
5258
them = {
59+
"platform": the_platform,
5360
"os": the_os,
5461
"py": the_py,
5562
"arch": the_arch,
@@ -69,11 +76,11 @@ jobs:
6976
f.write(f"include={json.dumps(all_them)}\n")
7077
7178
build_wheels:
72-
name: "${{ matrix.py }} ${{ matrix.os }} ${{ matrix.arch }} wheels"
79+
name: "${{ matrix.py }} ${{ matrix.platform }} ${{ matrix.arch }} wheels"
7380
needs: generate_wheels_matrix
7481
runs-on: "${{ matrix.os }}-${{ matrix.os-version || 'latest' }}"
7582
env:
76-
MATRIX_ID: "${{ matrix.py }}-${{ matrix.os }}-${{ matrix.arch }}"
83+
MATRIX_ID: "${{ matrix.py }}-${{ matrix.platform }}-${{ matrix.arch }}"
7784
strategy:
7885
matrix:
7986
include: ${{ fromJson(needs.generate_wheels_matrix.outputs.include) }}
@@ -93,16 +100,36 @@ jobs:
93100
env:
94101
CIBW_BUILD: ${{ matrix.py }}*-*
95102
CIBW_ARCHS: ${{ matrix.arch }}
103+
CIBW_PLATFORM: ${{ matrix.platform }}
96104

97105
- uses: actions/upload-artifact@v4
98106
with:
99107
name: dist-${{ env.MATRIX_ID }}
100108
path: ./wheelhouse/*.whl
101109
overwrite: true
102110

111+
build_sdist:
112+
name: Build source distribution
113+
runs-on: ubuntu-latest
114+
steps:
115+
- uses: actions/checkout@v5
116+
- uses: actions/setup-python@v5
117+
name: Install Python
118+
with:
119+
python-version: "3.9"
120+
- name: Build sdist
121+
run: |
122+
cp lib-rt/* .
123+
pip install --upgrade setuptools build
124+
python -m build --sdist
125+
- uses: actions/upload-artifact@v4
126+
with:
127+
name: dist-sdist
128+
path: dist/*.tar.gz
129+
103130
release:
104131
if: ${{ github.event_name == 'workflow_dispatch' }}
105-
needs: build_wheels
132+
needs: [build_wheels, build_sdist]
106133
runs-on: ubuntu-latest
107134
permissions:
108135
id-token: write

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Headers are not included by default.
2+
include *.h

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ authors = [
1919
{name = "Jukka Lehtosalo", email = "[email protected]"},
2020
{name = "Ivan Levkivskyi", email = "[email protected]"},
2121
]
22-
version = "0.1.0"
22+
version = "0.1.1"
2323
license = {text = "MIT"}
2424
classifiers = [
2525
"Development Status :: 3 - Alpha",

0 commit comments

Comments
 (0)