From e7c19dc23e08b7fd6d194bbf5f815bf71426b94e Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Mon, 28 Sep 2026 07:46:53 +0000 Subject: [PATCH 1/4] spacy-transformers: Add version 1.4.0 Cython align extension plus torch/transformers glue for spaCy's transformer pipelines. Upstream publishes no riscv64 wheel. --- .../workflows/build-spacy-transformers.yml | 133 ++++++++++++++++++ docs/packages/spacy-transformers.yaml | 5 + 2 files changed, 138 insertions(+) create mode 100644 .github/workflows/build-spacy-transformers.yml create mode 100644 docs/packages/spacy-transformers.yaml diff --git a/.github/workflows/build-spacy-transformers.yml b/.github/workflows/build-spacy-transformers.yml new file mode 100644 index 00000000000..a9d34ab2c8f --- /dev/null +++ b/.github/workflows/build-spacy-transformers.yml @@ -0,0 +1,133 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on the `setup.py`/`pyproject.toml` cibuildwheel config of +# https://github.com/explosion/spacy-transformers/blob/release-v1.4.0/pyproject.toml +# and the test invocation of +# https://github.com/explosion/spacy-transformers/blob/release-v1.4.0/.github/workflows/tests.yml +name: Build spacy-transformers wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/spacy-transformers.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-spacy-transformers.yml' + - 'docs/packages/spacy-transformers.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-spacy-transformers.yml' + - 'docs/packages/spacy-transformers.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + with: + package: spacy-transformers + version: ${{ inputs.version }} + + build_wheels: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + name: Build spacy-transformers ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 360 + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + # Upstream's [tool.cibuildwheel] skips `cp3??t-*` (no free-threaded + # wheels) and builds cp310/cp311 too, but torch - a hard runtime + # dependency - has no riscv64 wheel on our registry or public PyPI for + # cp310/cp311, only cp312-cp314t. + python: + - "cp312" + - "cp313" + - "cp314" + + env: + SPACY_TRANSFORMERS_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout spacy-transformers ${{ env.SPACY_TRANSFORMERS_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: explosion/spacy-transformers + ref: release-v${{ env.SPACY_TRANSFORMERS_VERSION }} + persist-credentials: false + + - name: Build wheels + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + output-dir: wheelhouse/ + only: ${{ matrix.python }}-manylinux_riscv64 + env: + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + # numpy (build and runtime) and spacy/srsly/torch (runtime) have no + # riscv64 wheels on public PyPI; both environments resolve them from + # our registry. spacy-alignments (runtime) has no riscv64 wheel + # anywhere yet, so its sdist is compiled instead - it needs a Rust + # toolchain, installed below, but is never actually imported by this + # package or its tests. + CIBW_ENVIRONMENT: >- + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + PATH=$PATH:$HOME/.cargo/bin + CIBW_BEFORE_ALL_LINUX: >- + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + # Upstream leaves cibuildwheel's test-command empty and runs the + # suite from tests.yml instead; this is that invocation, minus the + # sdist build/mypy steps, which check packaging and typing, not the + # wheel. + CIBW_TEST_REQUIRES: pytest pytest-cov + CIBW_TEST_COMMAND: python -m pytest --pyargs spacy_transformers + + - name: Check the extension modules made it into the wheel + run: | + python3 - wheelhouse/*.whl <<'EOF' + import sys, zipfile + expected = {"spacy_transformers/align"} + for whl in sys.argv[1:]: + found = {n.split(".", 1)[0] for n in zipfile.ZipFile(whl).namelist() + if n.endswith(".so")} + assert found == expected, (whl, found) + print(whl, "ok") + EOF + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: spacy-transformers-${{ env.SPACY_TRANSFORMERS_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish spacy-transformers ${{ matrix.version }} + needs: [setup, build_wheels] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + secrets: + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} + with: + artifact-pattern: spacy-transformers-${{ matrix.version }}-*-manylinux_riscv64 diff --git a/docs/packages/spacy-transformers.yaml b/docs/packages/spacy-transformers.yaml new file mode 100644 index 00000000000..017f2345f35 --- /dev/null +++ b/docs/packages/spacy-transformers.yaml @@ -0,0 +1,5 @@ +package-name: spacy-transformers +source-code: https://github.com/explosion/spacy-transformers +license: MIT +versions: +- version: 1.4.0 From 49742e408d3eb5a35e9738a50f3965588a7f2af7 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Mon, 28 Sep 2026 10:48:26 +0000 Subject: [PATCH 2/4] spacy-transformers: add sentencepiece to CIBW_TEST_REQUIRES test_transformer_sentencepiece_IO needs the sentencepiece backend that requirements.txt's transformers[sentencepiece] extra provides upstream, but setup.cfg's install_requires (what the wheel actually pulls in) omits it, so the test fails with ImportError in the built wheel's test run. sentencepiece has a riscv64 wheel on our registry already. --- .github/workflows/build-spacy-transformers.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-spacy-transformers.yml b/.github/workflows/build-spacy-transformers.yml index a9d34ab2c8f..c81e0cd95f2 100644 --- a/.github/workflows/build-spacy-transformers.yml +++ b/.github/workflows/build-spacy-transformers.yml @@ -93,8 +93,10 @@ jobs: # Upstream leaves cibuildwheel's test-command empty and runs the # suite from tests.yml instead; this is that invocation, minus the # sdist build/mypy steps, which check packaging and typing, not the - # wheel. - CIBW_TEST_REQUIRES: pytest pytest-cov + # wheel. tests.yml installs requirements.txt's + # transformers[sentencepiece], an extra setup.cfg's install_requires + # omits; one test needs that backend, so it's added explicitly here. + CIBW_TEST_REQUIRES: pytest pytest-cov sentencepiece CIBW_TEST_COMMAND: python -m pytest --pyargs spacy_transformers - name: Check the extension modules made it into the wheel From ba103b5fdb38ade7e219a6d6b08d7153d4494257 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Mon, 28 Sep 2026 13:34:26 +0000 Subject: [PATCH 3/4] spacy-transformers: force binary tokenizers to avoid rustc SIGABRT on test install --- .github/workflows/build-spacy-transformers.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build-spacy-transformers.yml b/.github/workflows/build-spacy-transformers.yml index c81e0cd95f2..41806635daf 100644 --- a/.github/workflows/build-spacy-transformers.yml +++ b/.github/workflows/build-spacy-transformers.yml @@ -98,6 +98,13 @@ jobs: # omits; one test needs that backend, so it's added explicitly here. CIBW_TEST_REQUIRES: pytest pytest-cov sentencepiece CIBW_TEST_COMMAND: python -m pytest --pyargs spacy_transformers + # transformers<4.53.3 (spacy-transformers' own pin) requires + # tokenizers>=0.21,<0.22; unconstrained, pip picks the highest + # matching point release (0.21.2/0.21.4), which has no riscv64 + # wheel anywhere, and source-builds it, where rustc SIGABRTs on + # these runners (gotcha 228). Forcing binary-only makes pip fall + # back to our registry's 0.21.1 wheel instead. + CIBW_TEST_ENVIRONMENT: PIP_ONLY_BINARY=tokenizers - name: Check the extension modules made it into the wheel run: | From 32e57cf08fb998705946e5ffceb381cc5677d509 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Mon, 28 Sep 2026 19:13:24 +0000 Subject: [PATCH 4/4] spacy-transformers: raise container shm-size to fix test_multiprocessing ENOSPC cp314's test_multiprocessing failed with "unable to allocate shared memory(shm) ... No space left on device (28)": Language.pipe(n_process=2) pickles the roberta-base transformer's tensors through /dev/shm for each worker, overrunning Docker's 64MB default. Bump it via CIBW_CONTAINER_ENGINE's create_args, which applies to both the build and test phases since cibuildwheel reuses the same container for both. --- .github/workflows/build-spacy-transformers.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-spacy-transformers.yml b/.github/workflows/build-spacy-transformers.yml index 41806635daf..7eb5ecff8f6 100644 --- a/.github/workflows/build-spacy-transformers.yml +++ b/.github/workflows/build-spacy-transformers.yml @@ -79,6 +79,9 @@ jobs: only: ${{ matrix.python }}-manylinux_riscv64 env: CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + # test_multiprocessing's Language.pipe(n_process=2) pickles the transformer's + # tensors through /dev/shm, overrunning Docker's 64MB default (gotcha 613). + CIBW_CONTAINER_ENGINE: "docker; create_args: --shm-size=2g" # numpy (build and runtime) and spacy/srsly/torch (runtime) have no # riscv64 wheels on public PyPI; both environments resolve them from # our registry. spacy-alignments (runtime) has no riscv64 wheel