pact-python-ffi: add build-pact-python-ffi.yml for riscv64 wheels - #1683
Merged
Conversation
luhenry
added a commit
that referenced
this pull request
Sep 10, 2026
luhenry
force-pushed
the
pact-python-ffi
branch
2 times, most recently
from
September 10, 2026 08:03
5b470a9 to
5966860
Compare
hatch_build.py's build hook downloads a prebuilt libpact_ffi from
pact-foundation/pact-reference's GitHub releases and compiles a CFFI
extension against it. pact-reference publishes no riscv64 asset, so
CIBW_BEFORE_ALL_LINUX builds libpact_ffi from the pact-reference source at
the matching libpact_ffi-v tag and stages it at the path the build hook
already caches downloads to. A small patch teaches the hook's platform
detection to recognize riscv64.
Builds only cp312-abi3 (our registry's floor), matching upstream's own
release job which builds a single interpreter and relies on the abi3 tag
for forward compatibility; cp313/cp314 reuse that wheel via cibuildwheel's
find_compatible_wheel. musllinux is dropped: rustup.rs ships no riscv64
musl toolchain.
The first attempt at the platform-detection patch only widened the
`manylinux`-prefixed branch of `_lib_url`, which turned out to be
unreachable: `packaging` 26.3 (an unpinned build dependency, resolved
fresh in the isolated build env) reordered `sys_tags()` to yield the
generic `linux_<arch>` tag before any `manylinux_*`/`musllinux_*` tag,
so `_sys_tag_platform()` returns `linux_riscv64` and none of
`_lib_url`'s `startswith("manylinux")` branches ever match - confirmed
from CI job 102765101921's log (Rust build finishes in 39m24s, then
`python -m build` still raises `UnsupportedPlatformError: Unsupported
platform linux_riscv64`) and from packaging's own 26.3 changelog/source
(`_linux_platforms` in tags.py yields `linux_{arch}` before
`_manylinux.platform_tags(archs)`). The patch now also accepts the
generic `linux` prefix in that branch.
The CIBW_TEST_COMMAND smoke-check also needed a fix: `pact_ffi/__init__.py`
does `from pact_ffi.ffi import ffi, lib`, which - because the submodule and
the symbol it imports are both named `ffi` - shadows the `pact_ffi.ffi`
package attribute with the imported `ffi` object (a cffi.FFI instance with
no `__file__`) once `pact_ffi` finishes initializing. `import pact_ffi.ffi
as m` therefore binds `m` to that FFI instance, not the compiled extension
module, so `m.__file__` raised AttributeError (job 102778776915, run
34448554573). Go through `sys.modules['pact_ffi.ffi']` instead, which holds
the actual compiled module regardless of the attribute shadowing.
That fix then surfaced a second, independent test-step failure: upstream's
own pyproject.toml unconditionally enables coverage in pytest's addopts
(--cov-config, --cov-report, --cov=pact_ffi), which needs the pytest-cov
plugin - not installed by CIBW_TEST_REQUIRES: pytest alone (job
102793239322, run 34453121784). Add pytest-cov to CIBW_TEST_REQUIRES.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Az13NcXsVZzzxXmaxxUEy7
luhenry
force-pushed
the
pact-python-ffi
branch
from
September 10, 2026 08:55
5966860 to
f3fb37a
Compare
luhenry
added a commit
that referenced
this pull request
Sep 10, 2026
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Az13NcXsVZzzxXmaxxUEy7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pact-python-ffi0.5.4.1Compiles the
pact_ffiCFFI extension bound tolibpact_ffi, the Rust core shared library published by pact-foundation/pact-reference. Upstream publishes no riscv64 wheel.Mirrors upstream's
release-ffi.yml.Differs from upstream
libpact_ffifrom pact-reference source instead of downloading it - pact-reference ships no riscv64 release asset.Matrix: cp312-abi3 only, matching upstream's own single-interpreter release job; abi3 covers cp313/cp314, and upstream ships no free-threaded wheel for this package.
Testing
License: OK
Patches
0001-recognize-riscv64-in-the-hatch-build-hook.patch- To upstream [blocked: pact-reference has no riscv64 libpact_ffi release yet]. Without it,_lib_urlraisesUnsupportedPlatformErroron every architecture oncepackaging>=26.3reorderssys_tags(), and has no riscv64 case regardless. Reproduces on any architecture.