Skip to content

Commit 120962d

Browse files
committed
mjml-python: Add version 1.4.1
MRML-based MJML compiler with a PyO3/maturin abi3 extension; the riscv64 image ships no cp38 to match its declared abi3-py38 floor, so patches/ bumps it to abi3-py39.
1 parent 4972a60 commit 120962d

3 files changed

Lines changed: 161 additions & 0 deletions

File tree

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# SPDX-FileCopyrightText: 2026 The RISE Project
2+
# SPDX-License-Identifier: MIT
3+
---
4+
# This workflow is based on the `linux` job of
5+
# https://github.com/mgd020/mjml-python/blob/v1.4.1/.github/workflows/_build-wheels.yml
6+
name: Build mjml-python wheels (riscv64)
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: 'Version glob to (re)build; empty builds every version of docs/packages/mjml-python.yaml not released yet'
13+
required: false
14+
default: ''
15+
pull_request:
16+
branches: [main]
17+
paths:
18+
- '.github/workflows/build-mjml-python.yml'
19+
- 'docs/packages/mjml-python.yaml'
20+
- 'patches/mjml-python/**'
21+
push:
22+
branches: [main]
23+
paths:
24+
- '.github/workflows/build-mjml-python.yml'
25+
- 'docs/packages/mjml-python.yaml'
26+
- 'patches/mjml-python/**'
27+
28+
concurrency:
29+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
30+
cancel-in-progress: true
31+
32+
permissions:
33+
contents: read # to fetch code (actions/checkout)
34+
35+
env:
36+
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
37+
38+
jobs:
39+
setup:
40+
uses: $/.github/workflows/_setup.yml
41+
with:
42+
package: mjml-python
43+
version: ${{ inputs.version }}
44+
45+
build_wheels:
46+
needs: [setup]
47+
if: needs.setup.outputs.versions != '[]'
48+
name: Build mjml-python ${{ matrix.version }} ${{ matrix.tag }}-manylinux_riscv64
49+
runs-on: ubuntu-24.04-riscv
50+
timeout-minutes: 60
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
version: ${{ fromJSON(needs.setup.outputs.versions) }}
55+
include:
56+
# Cargo.toml hardcodes pyo3's abi3-py38 feature unconditionally;
57+
# the riscv64 manylinux image's oldest interpreter is cp39 (no
58+
# cp38), so patches/ bumps it to abi3-py39 -- gotcha 96. Built on
59+
# cp39 and re-tested on the newer ones via find_compatible_wheel.
60+
- tag: cp39-abi3
61+
build: >-
62+
cp39-manylinux_riscv64 cp310-manylinux_riscv64
63+
cp311-manylinux_riscv64 cp312-manylinux_riscv64
64+
cp313-manylinux_riscv64 cp314-manylinux_riscv64
65+
- tag: cp314t
66+
build: cp314t-manylinux_riscv64
67+
68+
env:
69+
MJML_PYTHON_VERSION: ${{ matrix.version }}
70+
71+
steps:
72+
- name: Checkout mjml-python v${{ env.MJML_PYTHON_VERSION }}
73+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
74+
with:
75+
repository: mgd020/mjml-python
76+
ref: v${{ env.MJML_PYTHON_VERSION }}
77+
persist-credentials: false
78+
79+
- name: Checkout python-wheels
80+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
81+
with:
82+
path: python-wheels
83+
persist-credentials: false
84+
85+
- name: Patch mjml-python source
86+
run: git apply python-wheels/patches/mjml-python/${{ env.MJML_PYTHON_VERSION }}/00*.patch
87+
88+
- name: Build wheels
89+
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
90+
with:
91+
output-dir: wheelhouse/
92+
env:
93+
# musllinux is dropped: rustup.rs ships no riscv64 musl toolchain.
94+
CIBW_BUILD: ${{ matrix.build }}
95+
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
96+
# mjml-python ships no [tool.cibuildwheel], so the Rust toolchain
97+
# its maturin backend needs is installed in-container here.
98+
CIBW_BEFORE_ALL_LINUX: >-
99+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
100+
CIBW_ENVIRONMENT_LINUX: PATH="$PATH:$HOME/.cargo/bin"
101+
CIBW_TEST_SOURCES: tests
102+
CIBW_TEST_COMMAND: >-
103+
python -c "import mjml.mjml as m; assert m.__file__.endswith('.so'), m.__file__" &&
104+
python -m unittest -v
105+
106+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
107+
with:
108+
name: mjml-python-${{ env.MJML_PYTHON_VERSION }}-${{ matrix.tag }}-manylinux_riscv64
109+
path: wheelhouse/*.whl
110+
if-no-files-found: error
111+
112+
publish:
113+
name: Publish mjml-python ${{ matrix.version }}
114+
needs: [setup, build_wheels]
115+
if: needs.setup.outputs.versions != '[]'
116+
strategy:
117+
fail-fast: false
118+
matrix:
119+
version: ${{ fromJSON(needs.setup.outputs.versions) }}
120+
permissions:
121+
contents: write
122+
pull-requests: write
123+
uses: $/.github/workflows/_publish-wheel.yml
124+
secrets:
125+
app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }}
126+
with:
127+
artifact-pattern: mjml-python-${{ matrix.version }}-*-manylinux_riscv64

‎docs/packages/mjml-python.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package-name: mjml-python
2+
source-code: https://github.com/mgd020/mjml-python
3+
license: MIT
4+
versions:
5+
- version: 1.4.1
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Ludovic Henry <git@ludovic.dev>
3+
Date: Fri, 25 Sep 2026 00:00:00 +0000
4+
Subject: [PATCH] Cargo: bump abi3 floor to py39
5+
6+
Upstream-Status: Inappropriate [manylinux_2_39_riscv64 ships no cp38 interpreter]
7+
8+
The riscv64 manylinux image's oldest available CPython is cp39 (no cp38),
9+
so a wheel built here and tagged cp38-abi3 (this crate's abi3-py38
10+
feature) would never actually be compiled or tested against its own
11+
declared floor -- gotcha 96. Bump the pyo3 abi3 feature to abi3-py39 to
12+
make the riscv64 wheel's tag match the oldest interpreter this repo can
13+
build and test it on; every other platform's wheel is unaffected.
14+
15+
Signed-off-by: Ludovic Henry <git@ludovic.dev>
16+
---
17+
Cargo.toml | 2 +-
18+
1 file changed, 1 insertion(+), 1 deletion(-)
19+
20+
diff --git a/Cargo.toml b/Cargo.toml
21+
index c3f55b0..26e8f79 100644
22+
--- a/Cargo.toml
23+
+++ b/Cargo.toml
24+
@@ -10,4 +10,4 @@ crate-type = ["cdylib"]
25+
26+
[dependencies]
27+
mrml = "5.0.0"
28+
-pyo3 = { version = "~0.29.0", features = ["abi3-py38", "extension-module"] }
29+
+pyo3 = { version = "~0.29.0", features = ["abi3-py39", "extension-module"] }

0 commit comments

Comments
 (0)