Skip to content

Commit 4b79fa3

Browse files
authored
connected-components-3d: add build-connected-components-3d.yml for riscv64 wheels (#1450)
* **Package**: `connected-components-3d` * **Version**: `4.1.0` * **Source**: https://github.com/seung-lab/connected-components-3d/ * **Docs**: https://github.com/seung-lab/connected-components-3d/ Compiles a Cython/C++ extension for connected-component labeling on 2D/3D images (26/18/6-connected variants). Upstream publishes no riscv64 wheel. Mirrors [upstream's `build_wheel.yml`](https://github.com/seung-lab/connected-components-3d/blob/4.1.0/.github/workflows/build_wheel.yml). **Differs from upstream** - Nothing beyond the riscv64 image. **Testing** - `fastremap` (a hard test import) has no riscv64 wheel on either index, so pip builds it from sdist. - `scipy` has no cp314t wheel anywhere, so that leg drops it and deselects the two tests that need it. **License**: OK Built on cp312; ran locally off the checkout to confirm the extension compiles and imports cleanly before pushing.
1 parent 171fd28 commit 4b79fa3

1 file changed

Lines changed: 120 additions & 0 deletions

File tree

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# SPDX-FileCopyrightText: 2026 The RISE Project
2+
# SPDX-License-Identifier: MIT
3+
---
4+
# Based on: https://github.com/seung-lab/connected-components-3d/blob/4.1.0/.github/workflows/build_wheel.yml
5+
name: Build connected-components-3d wheels (riscv64)
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
version:
11+
description: 'connected-components-3d version to build (git tag, e.g. 4.1.0)'
12+
required: true
13+
default: '4.1.0'
14+
pull_request:
15+
paths:
16+
- '.github/workflows/build-connected-components-3d.yml'
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ inputs.version || '4.1.0' }}-${{ github.head_ref || github.run_id }}
20+
cancel-in-progress: true
21+
22+
permissions:
23+
contents: read # to fetch code (actions/checkout)
24+
25+
env:
26+
CC3D_VERSION: ${{ inputs.version || '4.1.0' }}
27+
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
28+
29+
jobs:
30+
setup:
31+
uses: $/.github/workflows/_setup.yml
32+
33+
build_wheels:
34+
needs: [setup]
35+
name: Build connected-components-3d ${{ inputs.version || '4.1.0' }} ${{ matrix.python }}-manylinux_riscv64
36+
runs-on: ubuntu-24.04-riscv
37+
timeout-minutes: 60
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
include:
42+
- python: cp312
43+
scipy: scipy
44+
k: not test_connected_components_stack
45+
- python: cp313
46+
scipy: scipy
47+
k: not test_connected_components_stack
48+
- python: cp314
49+
scipy: scipy
50+
k: not test_connected_components_stack
51+
- python: cp314t
52+
scipy: ''
53+
k: not test_connected_components_stack and not test_compare_scipy
54+
55+
steps:
56+
- name: Checkout connected-components-3d ${{ env.CC3D_VERSION }}
57+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
58+
with:
59+
repository: seung-lab/connected-components-3d
60+
ref: ${{ env.CC3D_VERSION }}
61+
persist-credentials: false
62+
63+
- uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
64+
with:
65+
output-dir: wheelhouse/
66+
only: ${{ matrix.python }}-manylinux_riscv64
67+
env:
68+
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
69+
# numpy is a build-time requirement (headers, via pyproject.toml's
70+
# build-system.requires) and, despite not being declared as a
71+
# runtime dependency by name in pyproject.toml, an implicit one too
72+
# (the compiled extension calls numpy's C API at import time; it is
73+
# declared in install_requires in setup.py). Only our registry has
74+
# it for riscv64; only-binary keeps a newer PyPI release from
75+
# winning the resolution and then compiling from sdist.
76+
CIBW_ENVIRONMENT: >-
77+
PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
78+
PIP_ONLY_BINARY=numpy
79+
# fastremap has no riscv64 wheel on either index, so pip builds it
80+
# from sdist; scipy has no cp314t wheel on any index/platform yet,
81+
# so it and its tests are dropped on that leg only (gotcha 149).
82+
CIBW_TEST_REQUIRES: pytest numpy fastremap ${{ matrix.scipy }}
83+
# automated_test.py sits next to the unbuilt cc3d/ source package;
84+
# staging only the test file keeps that directory out of test_cwd
85+
# so `import cc3d` resolves to the installed wheel (gotcha 25).
86+
CIBW_TEST_SOURCES: automated_test.py
87+
# crackle-codec (the optional "stack" extra's codec) has no riscv64
88+
# wheel anywhere, so test_connected_components_stack is deselected
89+
# on every leg rather than building its pybind11/google_crc32c
90+
# dependency chain from source for one optional extra.
91+
CIBW_TEST_COMMAND: >-
92+
python -m pytest -v automated_test.py -k "${{ matrix.k }}"
93+
94+
- name: Check wheel contents
95+
run: |
96+
python3 - wheelhouse/*.whl <<'EOF'
97+
import sys, zipfile
98+
names = zipfile.ZipFile(sys.argv[1]).namelist()
99+
exts = {n.split("/")[-1].split(".")[0] for n in names if n.endswith(".so")}
100+
assert exts == {"fastcc3d"}, exts
101+
licences = {n.rsplit("/", 1)[-1] for n in names if ".dist-info/licenses/" in n} - {""}
102+
assert licences == {"AUTHORS", "COPYING", "COPYING.LESSER"}, licences
103+
EOF
104+
105+
- name: Store wheels
106+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
107+
with:
108+
name: connected-components-3d-${{ env.CC3D_VERSION }}-${{ matrix.python }}-manylinux_riscv64
109+
path: ./wheelhouse/*.whl
110+
if-no-files-found: error
111+
112+
publish:
113+
name: Publish connected-components-3d ${{ inputs.version || '4.1.0' }}
114+
needs: [setup, build_wheels]
115+
permissions:
116+
contents: write
117+
pull-requests: write
118+
uses: $/.github/workflows/_publish-wheel.yml
119+
with:
120+
artifact-pattern: connected-components-3d-${{ inputs.version || '4.1.0' }}-*-manylinux_riscv64

0 commit comments

Comments
 (0)