Skip to content

amazon-ion: add build-amazon-ion.yml for riscv64 wheels - #524

Merged
luhenry merged 2 commits into
mainfrom
amazon-ion
Aug 27, 2026
Merged

amazon-ion: add build-amazon-ion.yml for riscv64 wheels#524
luhenry merged 2 commits into
mainfrom
amazon-ion

Conversation

@luhenry

@luhenry luhenry commented Aug 27, 2026

Copy link
Copy Markdown
Member

Adds .github/workflows/build-amazon-ion.yml, building riscv64 wheels for amazon-ion 0.14.6 (amazon-ion/ion-python). PyPI ships manylinux/musllinux wheels for x86_64, i686 and aarch64 but nothing for riscv64, so pip install amazon-ion on riscv64 falls back to compiling ion-c from the sdist.

Shape

Build-from-checkout, mirroring the build-wheels job of upstream's release.yml narrowed to riscv64. The project builds through py-build-cmake, which drives CMake over src/ioncmodule.c plus the whole of the src/ion-c submodule (ion-c + IBM decNumber, statically linked into amazon/_ioncmodule.so). cmake and ninja both publish riscv64 wheels on PyPI, so the isolated build env provisions its own toolchain and no dnf step is needed.

Matrix is per-interpreter cp312/cp313/cp314/cp314t — the extension is a plain (non-abi3) CPython module, so each interpreter needs its own wheel. Upstream builds cp39–cp313; cp314 and cp314t compile and pass the full suite unchanged (verified locally on macOS/arm64 before pushing).

Upstream's Fetch ion-c tags step is carried as-is: ion-c derives its version macros from git describe --match "v*", and a submodule checkout fetches no tags.

Testing

CIBW_TEST_COMMAND runs upstream's own invocation, py.test --ignore tests/test_benchmark_cli.py --ignore tests/test_benchmark_spec.py (the benchmark tests need the benchmarking extra, which upstream also skips in CI), with CIBW_TEST_EXTRAS: test so pytest comes from the project's own pin. CIBW_TEST_SOURCES: tests vectors pyproject.toml stages the ion-tests vectors submodule at its original relative path, because tests/test_vectors.py resolves its data as <rootdir>/vectors/iontestdata. PIP_EXTRA_INDEX_URL points at our registry so jsonconversion's numpy dependency resolves to the riscv64 wheel we already publish.

Two assertions run ahead of the suite, because it would otherwise pass without the extension: from amazon.ion.simpleion import c_ext; assert c_ext (the suite branches on c_ext and silently exercises only the pure-Python reader when the .so is missing), and a check that the patched licence files are present in the installed metadata. A post-build step also asserts the .so is in the wheel. Locally, 29163 tests pass on cp314t against the built wheel.

Patches

patches/amazon-ion/0.14.6/0001-Package-the-NOTICE-and-vendored-ion-c-decNumber-lice.patch — the wheel statically links ion-c (Apache-2.0, with its own NOTICE) and decNumber (ICU licence) but ships only ion-python's LICENSE; ion-python's own NOTICE is missing too. Apache-2.0 §4(d) requires the NOTICE of the redistributed work to travel with the binary, and the ICU licence requires its copyright notice to accompany binary redistributions. The patch declares license = "Apache-2.0" plus a PEP 639 license-files list; py-build-cmake copies those into .dist-info/licenses/ but rejects the key unless license is an SPDX expression, hence both halves. The gap affects every amazon-ion wheel on PyPI, not just riscv64, so it is tagged To upstream pending a maintainer discussion rather than a drive-by PR.

patches/amazon-ion/0.14.6/0002-Require-CMake-3.30-so-free-threaded-builds-configure.patch — sets [tool.py-build-cmake.cmake] minimum_version = "3.30". py-build-cmake only adds the t flag to Python3_FIND_ABI when that key allows it to assume CMake 3.30 (the first release whose FindPython understands the free-threaded ABI); left at its 3.15 default, the cp314t job logged CMake version 3.15 does not support the free-threaded ABI and then died on Could NOT find Python3 (missing: Development.Module). The key gates nothing else, so the GIL-ful builds are byte-for-byte unaffected — they already resolve to an all-OFF ABI tuple that is never passed to CMake. Arch-independent: it reproduces and fixes identically in quay.io/pypa/manylinux_2_39_aarch64.

CI

All four matrix jobs green on ubuntu-24.04-riscv, 29163 tests passed per interpreter, and the publish job dry-ran listing the four wheels (amazon_ion-0.14.6-{cp312-cp312,cp313-cp313,cp314-cp314,cp314-cp314t}-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl).

Mirrors the `build-wheels` job of upstream's release.yml, narrowed to
riscv64: a build-from-checkout cibuildwheel run over cp312/cp313/cp314/
cp314t, with upstream's own `py.test --ignore tests/test_benchmark_*`
command as the wheel test.

The extension statically links ion-c and IBM's decNumber but the wheel
carries only ion-python's LICENSE, so carry a patch adding the missing
NOTICE and vendored licence files, and assert from the test command that
they land in the wheel.
The cp314t job failed to configure with `Could NOT find Python3 (missing:
Development.Module)`: py-build-cmake only passes the `t` flag in
`Python3_FIND_ABI` when `cmake.minimum_version` is at least 3.30, and the
project leaves that key at its 3.15 default.

Reproduced and fixed against quay.io/pypa/manylinux_2_39_aarch64, where a
cp314t build fails identically without the patch and succeeds with it; a
cp312 build is unaffected either way.
@luhenry
luhenry merged commit 20c0f39 into main Aug 27, 2026
9 checks passed
@luhenry
luhenry deleted the amazon-ion branch August 27, 2026 09:13
@luhenry luhenry linked an issue Aug 27, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

amazon-ion riscv64 support

1 participant