Skip to content

Commit 151fc09

Browse files
authored
plotext: add build-plotext.yml for riscv64 wheels (#1102)
* **Package**: `plotext` * **Version**: `6.0.0` * **Source**: https://github.com/piccolomo/plotext * **Docs**: https://github.com/piccolomo/plotext Compiles a small C++ kernel (`plotext/_kernel/cpp/kernel.cpp`) that plotext loads with ctypes at runtime; the `py3-none-<platform>` tag is real per-arch compiled content, not a pure-Python wheel, and upstream ships none for riscv64. Mirrors [upstream's `wheels.yml`](https://github.com/piccolomo/plotext/blob/6.0.0/.github/workflows/wheels.yml). **Differs from upstream** - Test command runs `windows.yml`'s fuller unit test modules - the Linux job only smoke-tests the import. **Matrix**: single `cp312` build - `setup.py`'s `get_tag()` forces `py3-none-<platform>`, so one build serves every interpreter. **Testing** - Runs upstream's own unit tests (primitives, plots, dates, fixed_bugs, hashes, prettydoc) instead of pyproject.toml's one-line import check. **License**: OK Built on cp312; 61 passed.
1 parent 8b16831 commit 151fc09

1 file changed

Lines changed: 91 additions & 0 deletions

File tree

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# SPDX-FileCopyrightText: 2026 The RISE Project
2+
# SPDX-License-Identifier: MIT
3+
---
4+
# This workflow is based on: https://github.com/piccolomo/plotext/blob/6.0.0/.github/workflows/wheels.yml
5+
name: Build plotext wheels (riscv64)
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
version:
11+
description: 'plotext version to build (git tag, e.g. 6.0.0)'
12+
required: true
13+
default: '6.0.0'
14+
pull_request:
15+
paths:
16+
- '.github/workflows/build-plotext.yml'
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ inputs.version || '6.0.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+
PLOTEXT_VERSION: ${{ inputs.version || '6.0.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 plotext ${{ inputs.version || '6.0.0' }} py3-none-manylinux_riscv64
36+
runs-on: ubuntu-24.04-riscv
37+
38+
steps:
39+
- name: Checkout plotext ${{ env.PLOTEXT_VERSION }}
40+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
41+
with:
42+
repository: piccolomo/plotext
43+
ref: ${{ env.PLOTEXT_VERSION }}
44+
persist-credentials: false
45+
46+
- name: Build wheel
47+
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
48+
with:
49+
output-dir: wheelhouse/
50+
# setup.py's wheel_of_this_system.get_tag() tags the wheel py3-none-<platform>: the
51+
# C++ kernel it compiles is loaded by ctypes, not tied to any interpreter, so one
52+
# build serves every Python.
53+
only: cp312-manylinux_riscv64
54+
env:
55+
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
56+
# Mirrors upstream's own windows.yml unit-test invocation (the Linux wheels.yml
57+
# job only runs pyproject.toml's one-line import smoke test).
58+
CIBW_TEST_COMMAND: >-
59+
python -m unittest plotext._tests.primitives plotext._tests.plots
60+
plotext._tests.dates plotext._tests.fixed_bugs plotext._tests.hashes
61+
plotext.prettydoc._tests.docs plotext.prettydoc._tests.hashes -v
62+
63+
- name: Check the wheel carries a riscv64 kernel.so
64+
run: |
65+
whl=$(ls wheelhouse/*.whl)
66+
python3 - "$whl" <<'EOF'
67+
import sys, zipfile
68+
whl = sys.argv[1]
69+
target = "plotext/_kernel/cpp/kernel.so"
70+
names = zipfile.ZipFile(whl).namelist()
71+
if target not in names:
72+
raise SystemExit(f"error: {target} missing from {whl}")
73+
zipfile.ZipFile(whl).extract(target, "kernel_check")
74+
EOF
75+
file kernel_check/plotext/_kernel/cpp/kernel.so | tee /dev/stderr | grep -q 'RISC-V'
76+
77+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
78+
with:
79+
name: plotext-${{ env.PLOTEXT_VERSION }}-py3-none-manylinux_riscv64
80+
path: wheelhouse/*.whl
81+
if-no-files-found: error
82+
83+
publish:
84+
name: Publish plotext ${{ inputs.version || '6.0.0' }}
85+
needs: [setup, build_wheels]
86+
permissions:
87+
contents: write
88+
pull-requests: write
89+
uses: $/.github/workflows/_publish-wheel.yml
90+
with:
91+
artifact-pattern: plotext-${{ inputs.version || '6.0.0' }}-*-manylinux_riscv64

0 commit comments

Comments
 (0)