Skip to content

kiwipiepy: Add version 0.23.2 (#2346) #3

kiwipiepy: Add version 0.23.2 (#2346)

kiwipiepy: Add version 0.23.2 (#2346) #3

# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on: https://github.com/bab2min/kiwipiepy/blob/v0.23.2/.github/workflows/deploy.yml
# and https://github.com/bab2min/kiwipiepy/blob/v0.23.2/.github/workflows/pull_request_test.yml
name: Build kiwipiepy wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/kiwipiepy.yaml not released yet'
required: false
default: ''
pull_request:
branches: [main]
paths:
- '.github/workflows/build-kiwipiepy.yml'
- 'docs/packages/kiwipiepy.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-kiwipiepy.yml'
- 'docs/packages/kiwipiepy.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: kiwipiepy
version: ${{ inputs.version }}
build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
tag: [cp39-abi3, cp314t]
include:
# cp39 first: Py_LIMITED_API=1 makes setup.py tag cp39-abi3 whatever the
# build interpreter (gotcha 96); the later entries only re-test that wheel.
- tag: cp39-abi3
build: >-
cp39-manylinux_riscv64 cp312-manylinux_riscv64
cp313-manylinux_riscv64 cp314-manylinux_riscv64
limited-api: '1'
- tag: cp314t
build: cp314t-manylinux_riscv64
limited-api: ''
name: Build kiwipiepy ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
env:
KIWIPIEPY_VERSION: ${{ matrix.version }}
steps:
- name: Checkout kiwipiepy v${{ env.KIWIPIEPY_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: bab2min/kiwipiepy
ref: v${{ env.KIWIPIEPY_VERSION }}
submodules: recursive
persist-credentials: false
# Compiled into _kiwipiepy but not carried by upstream's wheels; setuptools'
# default LICEN[CS]E* glob picks these up from the root.
- name: Stage vendored dependency licences
run: |
cp Kiwi/third_party/cpp-btree/LICENSE LICENSE.cpp-btree
cp Kiwi/third_party/cpuinfo/LICENSE LICENSE.cpuinfo
cp Kiwi/third_party/eigen/COPYING.MPL2 LICENSE.eigen
cp Kiwi/third_party/json/LICENSE.MIT LICENSE.nlohmann-json
cp Kiwi/third_party/mimalloc/LICENSE LICENSE.mimalloc
cp Kiwi/third_party/streamvbyte/LICENSE LICENSE.streamvbyte
- name: Build wheels
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
with:
output-dir: wheelhouse/
env:
CIBW_ARCHS: riscv64
CIBW_BUILD: ${{ matrix.build }}
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
CIBW_ENVIRONMENT: >-
USE_MIMALLOC=1
Py_LIMITED_API="${{ matrix.limited-api }}"
PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
# numpy, a runtime dependency, has no cp39 riscv64 wheel on either index (gotcha 216).
CIBW_TEST_SKIP: cp39-*
CIBW_TEST_REQUIRES: pytest
# The tests read Kiwi/ and kiwipiepy/ files relative to the project root;
# plain pytest keeps the checkout's kiwipiepy/ off sys.path. The
# transformers_addon suite upstream loops over 35 transformers releases is left out.
# The two deselected tests fail identically on x86_64 with upstream's own wheel under
# KIWI_ARCH_TYPE=none, the non-SIMD path riscv64 selects.
CIBW_TEST_COMMAND: >-
cd {project} &&
pytest -svv test/test_kiwipiepy.py test/test_nogil_safety.py
--deselect test/test_kiwipiepy.py::test_space_issue_189
--deselect test/test_kiwipiepy.py::test_template
- name: Check wheel contents
run: |
python3 - wheelhouse/*.whl <<'EOF'
import sys, zipfile
(path,) = sys.argv[1:]
assert path.split("-")[2:4] == "${{ matrix.tag }}".replace("cp314t", "cp314-cp314t").split("-"), path
names = zipfile.ZipFile(path).namelist()
assert any(n.startswith("_kiwipiepy.") and n.endswith(".so") for n in names), names
licences = {n.split(".dist-info/licenses/", 1)[1] for n in names
if ".dist-info/licenses/" in n and not n.endswith("/")}
expected = {"LICENSE.txt", "LICENSE.cpp-btree", "LICENSE.cpuinfo", "LICENSE.eigen",
"LICENSE.nlohmann-json", "LICENSE.mimalloc", "LICENSE.streamvbyte"}
assert licences == expected, licences
print(path, "ok")
EOF
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: kiwipiepy-${{ env.KIWIPIEPY_VERSION }}-${{ matrix.tag }}-manylinux_riscv64
path: wheelhouse/*.whl
if-no-files-found: error
publish:
name: Publish kiwipiepy ${{ 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: kiwipiepy-${{ matrix.version }}-*-manylinux_riscv64