From e06bc60529200dfc1b02d68d9eb4b8cc8b40eef1 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Mon, 30 Mar 2026 15:37:23 +1300 Subject: [PATCH 01/14] :construction_worker: Build wheels for riscv64 Support RISC-V instruction set architecture. Build on manylinux 2_31. --- .github/workflows/ci.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f48350c..b0d152e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -# This file is autogenerated by maturin v1.8.7 +# This file is autogenerated by maturin v1.12.6 # To update, run # # maturin generate-ci --pytest github @@ -59,6 +59,9 @@ jobs: runner: ubuntu-24.04-arm arch: sbsa feat-flags: "cuda,pyo3" + - target: riscv64 + runner: ubuntu-24.04-arm + manylinux: "2_31" - target: armv7 - target: s390x - target: ppc64le @@ -78,7 +81,7 @@ jobs: target: ${{ matrix.platform.target }} args: --release --locked --compatibility pypi --features ${{ matrix.platform.feat-flags || 'pyo3' }} --out dist --interpreter python3.13 sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - manylinux: "2_28" + manylinux: ${{ matrix.platform.manylinux || '2_28' }} before-script-linux: | # Install nvTIFF and clang-devel if command -v dnf &> /dev/null; then @@ -102,7 +105,7 @@ jobs: target: ${{ matrix.platform.target }} args: --release --locked --compatibility pypi --features ${{ matrix.platform.feat-flags || 'pyo3' }} --out dist --interpreter python3.13t sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - manylinux: "2_28" + manylinux: ${{ matrix.platform.manylinux || '2_28' }} before-script-linux: | # Install nvTIFF and clang-devel if command -v dnf &> /dev/null; then @@ -127,7 +130,7 @@ jobs: path: dist/ - name: pytest - if: ${{ endswith(matrix.platform.target, '64') }} # x86_64 and aarch64 + if: ${{ contains(fromJSON('["x86_64", "aarch64"]'), matrix.platform.target) }} # x86_64, aarch64 shell: bash run: | set -e @@ -138,7 +141,7 @@ jobs: pytest --verbose - name: pytest - if: ${{ !endswith(matrix.platform.target, '64') && !startsWith(github.ref, 'refs/tags/') }} # armv7, s390x and ppc64le + if: ${{ !contains(fromJSON('["x86_64", "aarch64"]'), matrix.platform.target) && !startsWith(github.ref, 'refs/tags/') }} # armv7, s390x, ppc64le, and riscv64 uses: uraimo/run-on-arch-action@d94c13912ea685de38fccc1109385b83fd79427d # v3.0.1 with: arch: ${{ matrix.platform.target }} From a0c5c9b4cd565a3229b29ce25bcb1241f6824cdd Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Mon, 30 Mar 2026 19:11:18 +1300 Subject: [PATCH 02/14] :construction_worker: Run RISC-V job on ubuntu-24.04-riscv runner Courtesy of https://github.com/riseproject-dev/riscv-runner --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0d152e..1082d47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: arch: sbsa feat-flags: "cuda,pyo3" - target: riscv64 - runner: ubuntu-24.04-arm + runner: ubuntu-24.04-riscv manylinux: "2_31" - target: armv7 - target: s390x From c40e8afe21b4a18dc409edcb70533177e49025c8 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Mon, 30 Mar 2026 21:31:04 +1300 Subject: [PATCH 03/14] :alembic: Try using runner system Python for riscv64 --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1082d47..dc995f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,6 +72,12 @@ jobs: persist-credentials: false - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + if: ${{ matrix.platform.target != 'riscv64' }} + with: + python-version: "3.13" + + - uses: gounthar/setup-python@cb5cf223af5f1712fe2914b9c669d2008e051022 # https://github.com/actions/setup-python/pull/1289 + if: ${{ matrix.platform.target == 'riscv64' }} with: python-version: "3.13" From a9a6e420fbb1ca5673d101a5e7f3145aca9e5195 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Mon, 30 Mar 2026 21:40:59 +1300 Subject: [PATCH 04/14] :alembic: Try relax python minor version to 3.x --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc995f0..2538b38 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,7 +79,7 @@ jobs: - uses: gounthar/setup-python@cb5cf223af5f1712fe2914b9c669d2008e051022 # https://github.com/actions/setup-python/pull/1289 if: ${{ matrix.platform.target == 'riscv64' }} with: - python-version: "3.13" + python-version: "3.x" - name: Build wheels uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad # v1.50.1 From 571c7640fc4bab958107bd33a1fea908aa8e4fe7 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 31 Mar 2026 13:24:36 +1300 Subject: [PATCH 05/14] :alembic: Try maturin-action fork with DEFAULT_TARGET patch for riscv64 and also an updated versions-manifest.json file with riscv64 arch. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2538b38..ca176e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,7 +82,7 @@ jobs: python-version: "3.x" - name: Build wheels - uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad # v1.50.1 + uses: weiji14/maturin-action@f3e4c889d5c86978d70ec44f3faea956ea9963bd with: target: ${{ matrix.platform.target }} args: --release --locked --compatibility pypi --features ${{ matrix.platform.feat-flags || 'pyo3' }} --out dist --interpreter python3.13 From ce8b0211cfd297aab92723d71aca01fc970a38f1 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 31 Mar 2026 13:57:06 +1300 Subject: [PATCH 06/14] :building_construction: Do maturin build for riscv64 on manylinux_2_39 Specifically, the quay.io/repository/pypa/manylinux_2_39_riscv64 image which has linux/riscv64 docker builds. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca176e4..41b3bc0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,7 @@ jobs: feat-flags: "cuda,pyo3" - target: riscv64 runner: ubuntu-24.04-riscv - manylinux: "2_31" + manylinux: "2_39" - target: armv7 - target: s390x - target: ppc64le @@ -82,7 +82,7 @@ jobs: python-version: "3.x" - name: Build wheels - uses: weiji14/maturin-action@f3e4c889d5c86978d70ec44f3faea956ea9963bd + uses: weiji14/maturin-action@cd95c89b1d7a6b5d9377c6f26b76efdbaf516d8d with: target: ${{ matrix.platform.target }} args: --release --locked --compatibility pypi --features ${{ matrix.platform.feat-flags || 'pyo3' }} --out dist --interpreter python3.13 From 67ff8f5dc6bbf8fb460fecbe7c61c307a95398d1 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 31 Mar 2026 14:37:29 +1300 Subject: [PATCH 07/14] :green_heart: Limit nvTIFF install to x86_64 and aarch64 only Not much CUDA binaries for RISC-V yet. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41b3bc0..457a93f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,7 +90,7 @@ jobs: manylinux: ${{ matrix.platform.manylinux || '2_28' }} before-script-linux: | # Install nvTIFF and clang-devel - if command -v dnf &> /dev/null; then + if command -v dnf &> /dev/null && test $(uname -m) != "riscv64"; then # https://developer.nvidia.com/nvtiff-0-6-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Rocky&target_version=8&target_type=rpm_network dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/${{ matrix.platform.arch || 'x86_64' }}/cuda-rhel8.repo dnf clean all @@ -114,7 +114,7 @@ jobs: manylinux: ${{ matrix.platform.manylinux || '2_28' }} before-script-linux: | # Install nvTIFF and clang-devel - if command -v dnf &> /dev/null; then + if command -v dnf &> /dev/null && test $(uname -m) != "riscv64"; then # https://developer.nvidia.com/nvtiff-0-5-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Rocky&target_version=8&target_type=rpm_network dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/${{ matrix.platform.arch || 'x86_64' }}/cuda-rhel8.repo dnf clean all From 64c1f6ffff725a3dd22e42aeba3c9c9551dec9d5 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 31 Mar 2026 17:10:12 +1300 Subject: [PATCH 08/14] :green_heart: Install riscv64 build of maturin instead of x86_64 version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 457a93f..8edf1e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,7 +82,7 @@ jobs: python-version: "3.x" - name: Build wheels - uses: weiji14/maturin-action@cd95c89b1d7a6b5d9377c6f26b76efdbaf516d8d + uses: weiji14/maturin-action@e5aeb941d5e2aa7f56de9ee99057cd5b8119e2b6 with: target: ${{ matrix.platform.target }} args: --release --locked --compatibility pypi --features ${{ matrix.platform.feat-flags || 'pyo3' }} --out dist --interpreter python3.13 From bc063185aea4148565e35f48e40e348346b6e814 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 31 Mar 2026 18:28:44 +1300 Subject: [PATCH 09/14] :rewind: Revert to PyO3/maturin-action, see if free-threaded builds work Fork no longer needed since https://github.com/PyO3/maturin-action/pull/429 has been merged. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8edf1e3..e8515da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,7 +82,7 @@ jobs: python-version: "3.x" - name: Build wheels - uses: weiji14/maturin-action@e5aeb941d5e2aa7f56de9ee99057cd5b8119e2b6 + uses: PyO3/maturin-action@3f475a463fd27ce2440c13988f39fd1312dc9381 with: target: ${{ matrix.platform.target }} args: --release --locked --compatibility pypi --features ${{ matrix.platform.feat-flags || 'pyo3' }} --out dist --interpreter python3.13 @@ -106,7 +106,7 @@ jobs: fi - name: Build free-threaded wheels - uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad # v1.50.1 + uses: PyO3/maturin-action@3f475a463fd27ce2440c13988f39fd1312dc9381 with: target: ${{ matrix.platform.target }} args: --release --locked --compatibility pypi --features ${{ matrix.platform.feat-flags || 'pyo3' }} --out dist --interpreter python3.13t From 2bc61d1f3006ea2b31d838e40dfb6676da45267e Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 31 Mar 2026 19:09:47 +1300 Subject: [PATCH 10/14] :technologist: Install riscv64 python wheels from extra index and make the RISC-V pytest checks run natively without going through QEMU. --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8515da..e3e4671 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -136,7 +136,7 @@ jobs: path: dist/ - name: pytest - if: ${{ contains(fromJSON('["x86_64", "aarch64"]'), matrix.platform.target) }} # x86_64, aarch64 + if: ${{ endswith(matrix.platform.target, '64') }} # x86_64, aarch64, and riscv64 shell: bash run: | set -e @@ -145,9 +145,11 @@ jobs: pip install cog3pio --no-index --no-deps --find-links dist --force-reinstall -vv pip install cog3pio --group tests pytest --verbose + env: + PIP_EXTRA_INDEX_URL: ${{ 'https://gounthar.github.io/riscv64-python-wheels/simple/' && matrix.platform.target == 'riscv64' || '' }} - name: pytest - if: ${{ !contains(fromJSON('["x86_64", "aarch64"]'), matrix.platform.target) && !startsWith(github.ref, 'refs/tags/') }} # armv7, s390x, ppc64le, and riscv64 + if: ${{ !endswith(matrix.platform.target, '64') && !startsWith(github.ref, 'refs/tags/') }} # armv7, s390x and ppc64le uses: uraimo/run-on-arch-action@d94c13912ea685de38fccc1109385b83fd79427d # v3.0.1 with: arch: ${{ matrix.platform.target }} From 31831e0197c93a1182dae7d3707d3aa5533bf069 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 7 Apr 2026 16:30:56 +1200 Subject: [PATCH 11/14] :alien: Use riseproject-dev/setup-python to install Python 3.13 on riscv Get RISC-V builds of Python from https://github.com/riseproject-dev/python-versions, to get Python 3.13 instead of Python 3.12 system fallback on runner. --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3e4671..d753152 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,10 +76,11 @@ jobs: with: python-version: "3.13" - - uses: gounthar/setup-python@cb5cf223af5f1712fe2914b9c669d2008e051022 # https://github.com/actions/setup-python/pull/1289 + - uses: riseproject-dev/setup-python@8b57351c0f828145e2ac14bd328c731503361b7a # https://github.com/actions/setup-python/pull/1302 if: ${{ matrix.platform.target == 'riscv64' }} with: - python-version: "3.x" + python-version: "3.13" + mirror: "https://raw.githubusercontent.com/riseproject-dev/python-versions/main" - name: Build wheels uses: PyO3/maturin-action@3f475a463fd27ce2440c13988f39fd1312dc9381 From 31207a1927c3a12bbc1f65c22f1f046f6828b8ff Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 7 Apr 2026 17:54:02 +1200 Subject: [PATCH 12/14] :bug: Fix PIP_EXTRA_INDEX_URL, set PIP_PRE=1 for riscv64 matrix build Patches 2bc61d1f3006ea2b31d838e40dfb6676da45267e, got the order swapped. Also set PIP_PRE=1 to try and get `numpy-2.5.0.dev0-cp313-cp313-linux_riscv64.whl` from the extra-index-url. --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d753152..3883611 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -147,7 +147,8 @@ jobs: pip install cog3pio --group tests pytest --verbose env: - PIP_EXTRA_INDEX_URL: ${{ 'https://gounthar.github.io/riscv64-python-wheels/simple/' && matrix.platform.target == 'riscv64' || '' }} + PIP_EXTRA_INDEX_URL: ${{ matrix.platform.target == 'riscv64' && 'https://gounthar.github.io/riscv64-python-wheels/simple/' || '' }} + PIP_PRE: ${{ matrix.platform.target == 'riscv64' && '1' || '' }} - name: pytest if: ${{ !endswith(matrix.platform.target, '64') && !startsWith(github.ref, 'refs/tags/') }} # armv7, s390x and ppc64le From 2395f5f99181774d266be3e96a34c489e1023804 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Wed, 8 Apr 2026 09:44:09 +1200 Subject: [PATCH 13/14] :truck: Switch to alternative extra-index-url Find a source where libopenblas is packaged inside the numpy wheel. Xref https://riseproject.gitlab.io/python/wheel_builder/packages/numpy.html --- .github/workflows/ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3883611..768795a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -144,11 +144,10 @@ jobs: python3 -m venv .venv source .venv/bin/activate pip install cog3pio --no-index --no-deps --find-links dist --force-reinstall -vv - pip install cog3pio --group tests + pip install cog3pio --prefer-binary --group tests pytest --verbose env: - PIP_EXTRA_INDEX_URL: ${{ matrix.platform.target == 'riscv64' && 'https://gounthar.github.io/riscv64-python-wheels/simple/' || '' }} - PIP_PRE: ${{ matrix.platform.target == 'riscv64' && '1' || '' }} + PIP_EXTRA_INDEX_URL: ${{ matrix.platform.target == 'riscv64' && 'https://gitlab.com/api/v4/projects/56254198/packages/pypi/simple/' || '' }} - name: pytest if: ${{ !endswith(matrix.platform.target, '64') && !startsWith(github.ref, 'refs/tags/') }} # armv7, s390x and ppc64le From 39cbde3d7d270c29af255d232403c04e5d842265 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Wed, 8 Apr 2026 15:09:25 +1200 Subject: [PATCH 14/14] :lock: Fix a pedantic template expansion Xref https://docs.zizmor.sh/audits/#template-injection. --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 768795a..e151cbc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,9 @@ jobs: persist-credentials: false - name: Update Rust toolchain - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} + run: rustup update ${TOOLCHAIN} && rustup default ${TOOLCHAIN} + env: + TOOLCHAIN: ${{ matrix.toolchain }} - name: Build run: cargo build --verbose