Skip to content

Maturin uses outdated platform tag for Emscripten #3189

Description

@Viicos

Bug Description

When trying to build Emscripten wheels with maturin on Python 3.13, it produces wheels with the old pyodide_2025_0 platform tag, which isn't accepted by PyPI.

I was wondering if #3187 would be fixing this issue (unreleased as of today), but it seems to still be an issue (as can be seen in this workflow run where I've used before-script-linux from the maturin-action to override the installed maturin version).

I recently pushed an update to the pyodide documentation to reflect the change from PEP 783.

It seems that setting the right environment variable can work around this:

fn emscripten_platform_tag() -> Result<String> {
if let Some(ver) = first_non_empty_env(&[
"MATURIN_PYEMSCRIPTEN_PLATFORM_VERSION",
"PYEMSCRIPTEN_PLATFORM_VERSION",
])
.or_else(|| pyodide_config_get("pyemscripten_platform_version"))
{
return Ok(format!("pyemscripten_{ver}_wasm32"));
}
if let Some(ver) = first_non_empty_env(&["MATURIN_PYODIDE_ABI_VERSION", "PYODIDE_ABI_VERSION"])
.or_else(|| pyodide_config_get("pyodide_abi_version"))
{
let py = first_non_empty_env(&["PYTHON_VERSION"])
.or_else(|| pyodide_config_get("python_version"));
return Ok(if is_python_3_14_or_later(py.as_deref()) {
format!("pyemscripten_{ver}_wasm32")
} else {
format!("pyodide_{ver}_wasm32")
});
}
let release = emscripten_version()?.replace(['.', '-'], "_");
eprintln!(
"⚠️ Falling back to legacy `emscripten_{release}_wasm32` platform tag. \
This wheel will not be installable on PEP 783-compliant Pyodide runtimes. \
Set `MATURIN_PYEMSCRIPTEN_PLATFORM_VERSION` (PEP 783) or \
`MATURIN_PYODIDE_ABI_VERSION` (Pyodide 0.28+) to produce a portable tag."
);
Ok(format!("emscripten_{release}_wasm32"))
}

But I believe the is_python_3_14_or_later() should be dropped?

Your maturin version (maturin --version)

1.13.3 (from main)

Your Python version (python -V)

3.13

Your pip version (pip -V)

N/A

What bindings you're using

pyo3

Does cargo build work?

  • Yes, it works

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

  • Yes

Steps to Reproduce

See workflow run at https://github.com/pydantic/pydantic/actions/runs/25990049624/job/76394417822?pr=13199.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions