Skip to content

build(python): Add build for riscv64 wheels#27149

Draft
threexc wants to merge 4 commits intopola-rs:mainfrom
threexc:tgamblin/riscv64
Draft

build(python): Add build for riscv64 wheels#27149
threexc wants to merge 4 commits intopola-rs:mainfrom
threexc:tgamblin/riscv64

Conversation

@threexc
Copy link
Copy Markdown

@threexc threexc commented Apr 1, 2026

As part of the RISE Project, we are helping to build riscv64 binary wheels for a variety Python modules. Add support for both standard and musl-based builds by using official RISE RISC-V GitHub Actions Runners. Note that they have to be enabled for the project to use them - instructions for doing so are here.

I've tried testing the CI ahead of time on my fork, but only the linter and PR checks ran. I also didn't see make test available locally, so I ran make check after make build. Here's the end of that output:

polars

@github-actions github-actions bot added build Changes that affect the build system or external dependencies python Related to Python Polars first-contribution First contribution by user labels Apr 1, 2026
@threexc threexc force-pushed the tgamblin/riscv64 branch 2 times, most recently from a08456f to f47f9a7 Compare April 1, 2026 18:28
@threexc
Copy link
Copy Markdown
Author

threexc commented Apr 1, 2026

I've added a setup step to account for riscv64 Python, but it seems there are no Pythons available at any version yet in the GitHub manifests - I'll have to look further into it...

@threexc threexc force-pushed the tgamblin/riscv64 branch 2 times, most recently from 39af252 to 63b31c8 Compare April 1, 2026 18:41
@orlp
Copy link
Copy Markdown
Member

orlp commented Apr 2, 2026

This is blocked on upstream actions/setup-python#1288 right?

@threexc
Copy link
Copy Markdown
Author

threexc commented Apr 2, 2026

This is blocked on upstream actions/setup-python#1288 right?

Right. As soon as I have word there I'll update it again.

@orlp orlp marked this pull request as draft April 2, 2026 13:30
@orlp
Copy link
Copy Markdown
Member

orlp commented Apr 2, 2026

I've converted this PR to a draft for the moment.

- job_config: linux-riscv64
os: ubuntu-24.04-riscv
architecture: riscv64
target: riscv64gc-unknown-linux-gnu
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason to be this pessimistic when it comes to extensions? These are Linux only anyway, and I would guess that for high-performance applications you would want to, definitely, have B (Bit Manipulation) and V (Vector). In general, I would just follow RVA23 for now since that is what most Linux-capable SBCs are targeting.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not opposed to advancing the spec that we build wheels against, but for now I think this is the right place to start - it's consistent with most other projects building for riscv64, including uv and maturin itself.

I think it would be better to start with riscv64gc and follow up with another change to riscv64a23 once more RVA23-based platforms are actually available to users.

@threexc threexc force-pushed the tgamblin/riscv64 branch from 63b31c8 to 735cbe9 Compare April 7, 2026 13:42

- name: Set up Python (RISCV64 Linux)
if: matrix.os == 'ubuntu-24.04-riscv'
uses: actions/setup-python@v6
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you feel so inclined, you can use riseproject-dev/setup-python@8b57351c0f828145e2ac14bd328c731503361b7a, it will work on riscv64. I would NOT recommend to ship that as the expectation is that actions/setup-python#1302 gets merged and actions/setup-python can work OOTB.

You would use it like the following:

   - name: Set up Python (RISCV64 Linux)
        if: matrix.os == 'ubuntu-24.04-riscv'
        uses: riseproject-dev/setup-python@8b57351c0f828145e2ac14bd328c731503361b7a
        with:
          python-version: ${{ env.PYTHON_VERSION_LINUX_RISCV64 }}
          mirror: https://raw.githubusercontent.com/riseproject-dev/python-versions/main

threexc added 4 commits April 7, 2026 14:31
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Build polars Python modules for riscv64 platforms by using the
riscv64gc-unknown-linux-gnu target. Use a RISE riscv native runner as the
'os'.

See: https://riseproject-dev.github.io/riscv-runner/

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Build polars Python modules for riscv64 platforms with musl by using the
riscv64gc-unknown-linux-musl target. Use a RISE riscv native runner as
the 'os'.

See: https://riseproject-dev.github.io/riscv-runner/

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
@threexc threexc force-pushed the tgamblin/riscv64 branch from 735cbe9 to 3c4c4bf Compare April 7, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Changes that affect the build system or external dependencies first-contribution First contribution by user python Related to Python Polars

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants