Skip to content

Commit dddd9e8

Browse files
committed
Add almost unchanged cibw
1 parent 24104ff commit dddd9e8

File tree

3 files changed

+82
-23
lines changed

3 files changed

+82
-23
lines changed

.github/workflows/publish.yml

Lines changed: 63 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,77 @@
1-
# This workflow will upload a Python Package using Twine when a release is created
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
1+
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
2+
# https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml
33

4-
# This workflow uses actions that are not certified by GitHub.
5-
# They are provided by a third-party and are governed by
6-
# separate terms of service, privacy policy, and support
7-
# documentation.
8-
9-
name: Upload Python Package
4+
name: Build and upload to PyPI
105

116
on:
7+
workflow_dispatch:
8+
pull_request:
9+
push:
10+
branches: [main]
1211
release:
1312
types: [published]
1413

1514
jobs:
16-
deploy:
15+
build_wheels:
16+
name: Build wheels for ${{ matrix.os }}
17+
runs-on: ${{ matrix.runs-on }}
18+
strategy:
19+
matrix:
20+
include:
21+
- os: linux-intel
22+
runs-on: ubuntu-latest
23+
- os: linux-arm
24+
runs-on: ubuntu-24.04-arm
25+
- os: windows-intel
26+
runs-on: windows-latest
27+
- os: windows-arm
28+
runs-on: windows-11-arm
29+
- os: macos-intel
30+
# macos-13 was the last x86_64 runner
31+
runs-on: macos-13
32+
- os: macos-arm
33+
# macos-14+ (including latest) are ARM64 runners
34+
runs-on: macos-latest
35+
36+
steps:
37+
- uses: actions/checkout@v5
38+
- name: Build wheels
39+
uses: pypa/[email protected]
40+
- uses: actions/upload-artifact@v4
41+
with:
42+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
43+
path: ./wheelhouse/*.whl
1744

45+
build_sdist:
46+
name: Build source distribution
1847
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v5
50+
- name: Build sdist
51+
run: pipx run build --sdist
52+
- uses: actions/upload-artifact@v4
53+
with:
54+
name: cibw-sdist
55+
path: dist/*.tar.gz
1956

57+
upload_pypi:
58+
needs: [build_wheels, build_sdist]
59+
runs-on: ubuntu-latest
2060
environment: publish
21-
2261
permissions:
2362
id-token: write
24-
63+
if: github.event_name == 'release' && github.event.action == 'published'
64+
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
65+
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
2566
steps:
26-
- uses: actions/checkout@v4
27-
- name: Set up Python
28-
uses: actions/setup-python@v5
29-
with:
30-
python-version: '3.x'
31-
- name: Install CLI tool
32-
run: pip install build
33-
- name: Build package
34-
run: python -m build
35-
- name: Publish package
36-
uses: pypa/gh-action-pypi-publish@release/v1
67+
- uses: actions/download-artifact@v5
68+
with:
69+
# unpacks all CIBW artifacts into dist/
70+
pattern: cibw-*
71+
path: dist
72+
merge-multiple: true
73+
74+
- uses: pypa/gh-action-pypi-publish@release/v1
75+
# To test uploads to TestPyPI, uncomment the following:
76+
# with:
77+
# repository-url: https://test.pypi.org/legacy/

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
1111

1212
if (RSC_BUILD_EXTENSIONS)
1313
enable_language(CUDA)
14-
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
14+
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module ${SKBUILD_SABI_COMPONENT})
1515
find_package(nanobind CONFIG REQUIRED)
1616
find_package(CUDAToolkit REQUIRED)
1717
else()

pyproject.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ version_scheme = "guess-next-dev"
119119
local_scheme = "node-and-date"
120120

121121
[tool.scikit-build]
122+
# Use limited ABI wheels (one wheel for all Python minor versions on one platform)
123+
wheel.py-api = "cp311"
122124
wheel.packages = [ "src/rapids_singlecell", "src/testing" ]
123125
cmake.version = ">=3.24"
124126
cmake.build-type = "Release"
@@ -128,6 +130,22 @@ cmake.args = [ "-DCMAKE_CUDA_ARCHITECTURES=75;80;86;89;90;100" ]
128130
build-dir = "build"
129131
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
130132

133+
# Use abi3audit to catch issues with Limited API wheels
134+
[tool.cibuildwheel.linux]
135+
repair-wheel-command = [
136+
"auditwheel repair -w {dest_dir} {wheel}",
137+
"uvx abi3audit --strict --report {wheel}",
138+
]
139+
[tool.cibuildwheel.macos]
140+
repair-wheel-command = [
141+
"delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}",
142+
"uvx abi3audit --strict --report {wheel}",
143+
]
144+
[tool.cibuildwheel.windows]
145+
repair-wheel-command = [
146+
"copy {wheel} {dest_dir}",
147+
"uvx abi3audit --strict --report {wheel}",
148+
]
131149

132150
[tool.codespell]
133151
skip = '*.ipynb,*.csv'

0 commit comments

Comments
 (0)