Promoting Emscripten/Pyodide to a Tier 2 platform: supplementary information
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 20/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- python
- Domaine
- build-system, release
Piste de recherche
Start with NEP 57’s Tier 2 requirements and the issue’s “Current status and implementation plan” section to identify the release and wheel publishing changes requested. Review the existing Emscripten/Pyodide release CI and wheel build configuration mentioned in the proposal. Done means NumPy publishes the requested pyemscripten wheel to PyPI and the platform’s ongoing build and maintenance responsibilities are established.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
[!NOTE]
This is a companion writeup for my proposal with the above title on the NumPy mailing list: https://mail.python.org/archives/list/[email protected]/thread/N644Y4IP7ZT5T4U7L5FFXIPAVUGA6SKU, which I have opened in the form of an issue here.
As noted in the email, I have laid out a proposal for the NumPy Steering Council to move the Emscripten/Pyodide platform, currently listed at Tier 3 as per the provisions of the NumPy Enhancement Proposal (NEP) 57 – NumPy platform support, up a tier, to Tier 2. I have described my rationale for this proposal below. This repeats some of the points in the email as written.
Concretely, our request is for NumPy to publish one "pyemscripten" wheel to PyPI, starting with NumPy 2.6.0 soon, or, perhaps within the 2.6.x release cycle, if not the former. This would be a cp314 wheel, for the pyemscripten_2026_0 platform. This platform is already currently tested by NumPy in its release infrastructure. A cp315 wheel, for the pyemscripten_2026_5 platform and an updated ABI, should follow later. Our details about this are documented in the "Current status and implementation plan" section below.
Support for Emscripten/Pyodide in NumPy
At the outset, NumPy has been one of the most fundamental packages in the Pyodide ecosystem, and has been well supported throughout the project's history, and especially with our positioning in the last few years towards better supporting the scientific Python stack in browser-native environments and JS runtimes.
A wide majority of these efforts in the NumPy repository can be attributed to the work of @hoodmane and active Pyodide maintainers/core contributors at the time (please see search results for "emscripten" and search results for "pyodide" for more). This led NumPy to gain fixes for compilation and packaging issues at the intersection of build systems and Pyodide's build tooling, and gain better testing by virtue of a Pyodide CI job. The job was disabled for a portion of time during NumPy's transition to the Meson build system, during which contemporary efforts were underway in pyodide-build, Pyodide's quasi-build-frontend, to build WASM wheels for packages that relied on meson-python as a build backend – including NumPy, SciPy, and others. The CI job was re-enabled by me soon after that transitory phase via gh-25894, and has been more or less running on PRs since February 2024 besides a few hiccups here and there.
Outside the NumPy repository, i.e., in the Pyodide project's repositories, NumPy will always remain one of our primary targets. NumPy is built/used, validated, and tested across:
- The Pyodide core runtime, where CPython is ported to compile and run in WebAssembly environments via a specific version of the Emscripten compiler toolchain and the greater Pyodide ABI (a.k.a., the PyEmscripten platform), which provides a formal definition for the CPython version, Emscripten toolchain version, and various compiler flags. This ensures its reliability across tip-of-tree Pyodide development routines.
- The pyodide-recipes repository, where it exists as a recipe (similar to but not the same as the conda-forge format) and is built in CI on every PR, as a dependency for other packages to rely on, and for distribution. We consider NumPy to be one of many important recipes built into both repositories, if not the most important. Upstream NumPy builds for WASM as-is and does not require any patches. The Pyodide core repository subsequently distributes the wheels built from these recipes. We also term NumPy as a "cross-build" package (sometimes and often also called a "Frankenstein package" for the sake of humour), which means that we distribute it as part of a cross-build environment, commonly shortened as an "xbuildenv". The Pyodide xbuildenvs contain cross-built packages, NumPy being one of them, in which we build the package, replace specific headers, and add Emscripten-compiled static libraries during build time. These are utilised by other packages when they are being built for WASM – akin to Android builds, which also have exactly the same set of cross-built files.
Making the case for Tier 2, and a path forward
Beyond the commonalities of (i) the presence of a CI job, and (ii) maintainers/regular contributors taking responsibility for CI on the main branch to be working, the main difference between both tiers is about where the wheels are published (and subsequently whether it's considered a blocker if they are not being built successfully when being published). As per the NEP, one of the requirements stated for Tier 2 is that platform maintainers are expected to take primary and long-term responsibility for keeping the main branch and wheel builds working. While none of us Pyodide maintainers is a NumPy maintainer at the time of writing, we are committed to volunteering for said responsibility as platform experts, in the same way as was discussed for our Android and iOS friends and counterparts earlier this month.
Based on point 1 of the "General principles" of NEP 57: I would like to disclose that I am paid to contribute to Pyodide by Quansight as part of employer-sponsored time, and Hood Chatham and Gyeongjae Choi are paid to do so by Cloudflare. All of us also contribute to the Pyodide ecosystem to some extent beyond paid time by our employers as well. This is documented on this webpage of our website: https://pyodide.org/en/stable/project/about.html#institutional-and-financial-support.
Back when NEP 57 was being drafted and went live, @hoodmane and the rest of us Pyodide maintainers were waiting to hear a decision on PEP 783. This arrived in April, and the first few Pyodide "pyemscripten" wheels started being published to PyPI for the Pyodide 2025_0 ABI. This was soon followed by our Pyodide 314.0.0 release in June, which introduced a new, refined 2026_0 ABI, also available for publishing to PyPI. The 2026_5 ABI for CPython 3.15 was released in August as part of our alpha release cycle, which I have described below.
Considering the facts that the Emscripten/Pyodide platform has:
- (i) a fast and native (actually quasi-native, since the WASM runtime runs as part of a native Linux/macOS environment via Node.js) CI job running on every PR as described above;
- (ii) three Pyodide maintainers who have built enough camaraderie with the NumPy team over various points in time – who are willing to take up maintenance of fixing build issues and numerical problems wherever applicable to ensure that the lights are kept on;
- (iii) increasing support across the ecosystem with the adoption of PEP 783 for publishing pyemscripten wheels to PyPI; and
- (iv) PEP 776, which is currently active and makes Emscripten a Tier 3 platform for CPython;
we believe that we now stand in an appropriate position to make this request.
One concern that was raised to me about this request was how Pyodide releases and versions would proceed. This was discussed internally at Quansight, between @rgommers and me, and then between @rgommers and @hoodmane at the EuroPython-EuroSciPy 2026 joint sprints in mid-July (where @ryanking13 and I were also present). The consensus reached here—please feel free to correct me if I am wrong or misremember, or if there is additional context I am unaware of—was that it would be great for the Pyodide team to align on when Pyodide releases are created. Following this request, we have stabilised the Pyodide ABI much earlier than before, in order to align Pyodide with the CPython 3.15 release schedule. Our slightly newer 2026_5 ABI is available via the Pyodide 315.0.0a1 alpha release, which came out on 1st August, and in 315.0.0a2 on 4th August, which was the same day as CPython 3.15.0rc1 – where the CPython ABI gets frozen. This translates to roughly two months before the CPython 3.15.0 final release. For comparison, the 2026_0 ABI for CPython 3.14 had first shipped in April 2026, six months after the CPython 3.14.0 final release. On the packaging tooling side, Pyodide, post https://github.com/pypa/cibuildwheel/pull/2958, has now been tied to the cpython-prerelease flag in cibuildwheel going forward, so that projects proactively building and testing for CPython early can also test for Pyodide.
I would like to be upfront about the fact that the Pyodide 315.0.0 runtime is not out yet. However, it is highly unlikely that our new ABI is going to change, and it will remain stable w.r.t. the final release. cibuildwheel, since v4.2.0, has built cp315-pyodide_wasm32 wheels against the new ABI, released on 5th August, and at least nine projects already publish pyemscripten_2026_5 wheels to PyPI at this time. Even so, we would like to ask for cp314-pyodide_wasm32 (pyemscripten_2026_0) wheels first, and the cp315-pyodide_wasm32 (pyemscripten_2026_5) wheels can simply be added in later follow-ups.
Use cases and payoffs of moving to Tier 2
My belief is that the presence of pyemscripten wheels for NumPy on PyPI will have long-reaching benefits overall:
- Up-to-date NumPy releases for Pyodide users: the current stable Pyodide release, 314.0.8, ships NumPy 2.4.6, while the latest NumPy release is 2.5.5. With wheels on PyPI, a new NumPy release can be installed in Pyodide on the day it comes out, through micropip in the browser or through
pipin a Pyodide virtual environment, in the same way as on any other platform. It will no longer have to wait for us to update a recipe and make a Pyodide release. - Packaging for Pyodide: we can get rid of a lot of code in the Pyodide ecosystem, over time. This will be pretty useful in two places (and counting): for micropip, Pyodide's in-browser package manager, to not query a custom index to install NumPy. pyodide-build will not need to include NumPy to be installed as part of its xbuildenv, nor will it need to perform the current complicated steps to make it available when compiling a project that depends on NumPy at build time, or, at least, perform them at the same level of complexity. Out-of-tree builds for our packages will thus be more straightforward and easier for us to maintain.
- Security: using the numpy-release repository infrastructure automatically improves the security posture of building distributions for Emscripten/Pyodide for free, which benefits NumPy and downstream users of NumPy at build-time and runtime in the Pyodide ecosystem.
- Posterity: we can go to other packages and say, "Hey, NumPy does it now – so should you!" and hopefully be able to convince them to publish pyemscripten wheels in a similar manner :D
- Interactive documentation: it will be far easier for NumPy to integrate versioned WASM NumPy wheels as part of its interactive documentation needs. Currently, the version of NumPy is coupled with the version of the Pyodide kernel that JupyterLite ships, and it is difficult to support a nightly pyemscripten wheel without jumping through hoops, or to match it with the version of the NumPy documentation that is being viewed, such that interactive examples for NumPy 2.6 run a WASM build of NumPy 2.6.
There is also an extremely rising demand for our platform. For example, some projects that have been empowered with Pyodide include the following: JupyterLite, PyScript, marimo, and Cloudflare's Python Workers. I tried to find some numbers, and noted that the pyodide npm package was downloaded ~3.5 million times in the last 30 days and about 25 million times in the last year at the time of writing. These numbers do not include browsers that load Pyodide from the jsDelivr CDN. @ryanking13 has said in the past that we have exceeded a billion requests on jsDelivr.
Current status and implementation plan
Describing this in as concise a manner as possible:
- NumPy's CI currently builds and tests a
cp314Pyodide wheel on every PR (emscripten.yml). - numpy-release builds the same wheel (without BLAS) in every run, tests it, and uploads it to the nightly index. It is then deleted before the upload to PyPI.
- For
cp314, all we need to do is to delete that step. - For
cp315, later: NumPy can start testing with the Pyodide 315 alphas and run the full test suite.
Of course, I would be happy to open any PRs as necessary and investigate build issues and test failures that may arise.
Challenges, considerations, and remediations
The Emscripten compiler toolchain, unlike glibc, does not publish a backwards-compatible ABI. This is a fairly well-known fact among us who are proponents in the web ecosystem. However, I find it prudent to mention that @hoodmane is an Emscripten maintainer, and @ryanking13 is an adept Emscripten contributor – which means the locus of control over the stack is closer to us when it comes to fixing build issues and identifying problems in advance. According to Hood, Emscripten updates across the CPython runtime and our supported packages have gotten slightly easier over the years, as a result of cross-repository work and better testing in the ecosystem. Since Emscripten releases have a high cadence, it also means that NumPy should not have to follow them. Each pyemscripten platform pins exactly one Emscripten version (5.0.3 for 2026_0, and 6.0.5 for 2026_5), so NumPy sees one Emscripten upgrade per CPython feature release, at the same time as the new CPython version, and never in the middle of a release cycle. That upgrade is the only change between 2026_0 and 2026_5.
On the size of the wheel build matrix: I noticed that this point came up in the discussion for the case for Android and iOS moving to Tier 2. In our case, since the "pyemscripten" platform is used with just one CPython version, there is one wheel per supported CPython version by construction. This deems us moving to, say, the Limited API as not necessarily needed and those prospects are best discussed elsewhere. Also, we do not currently support threading, and there are no free-threaded Python wheels to be built. This means that we would need only two wheels, or a maximum of three, at a time, more or less.
On backward compatibility: such a structure also grants every pyemscripten wheel a natural EoL period. NumPy can build wheels for a platform for as long as it supports the matching CPython version, and stop doing so when it drops that version, as has been done in the past for any other wheel.
If it so happens that the Pyodide CI job blocks a release, we will attempt to respond as quickly as possible. If the cause for failure is in Pyodide build tooling, or Emscripten, or cibuildwheel, we will investigate that to the best effort necessary and create releases or push for them to be created at a priority. We will also aim to craft and provide suitable workarounds, such that NumPy releases incur only minimal delays or no delays at all against their proposed release timelines.
I would suggest that it only helps this proposal that we are tied well to and are friends with all the ecosystems at play here; Hood and Gyeongjae are maintainers for the Pyodide platform in cibuildwheel, and I am a full cibuildwheel maintainer: https://github.com/pypa/cibuildwheel#maintainers. We, of course, maintain pyodide-build in the Pyodide ecosystem and are well-versed with the release process for Pyodide and its tooling.
Additional context
- Status of pyemscripten wheels on PyPI: 18 of the 163 packages that we build from source in pyodide-recipes now publish their own pyemscripten wheels (https://github.com/pyodide/pyodide-recipes/issues/599). Some of them depend on NumPy, such as pandas, contourpy, statsmodels, boost-histogram, and iminuit.
- Are we PEP 783 yet? A pyemscripten wheels tracker: https://pyodide.github.io/are-we-pep783-yet
- A similar proposal from us was made to the scikit-learn project, where it has a +1 from a maintainer: https://github.com/scikit-learn/scikit-learn/issues/34278
- A similar proposal from our Android and iOS friends for them to bump up to Tier 2: https://mail.python.org/archives/list/[email protected]/thread/SQPBDNOJKMUPII2WUAQFD4P2NMB3Q54J and gh-33334
Thank you for your time!
cc: my co-listed NEP 57 point of contact for the Emscripten/Pyodide platform, Gyeongjae Choi (@ryanking13) – as well as @hoodmane and @rgommers.
- Langage dominant
- Python
- Étoiles
- 33.5k
- Forks
- 13.1k
- Merge moyen
- 1 j 19 h
- PR mergées (30 j)
- 143
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de numpy/numpy
-
00 - Bug component: numpy.linalg
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Les mainteneurs répondent en général sous 1 jour
-
00 - Bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
00 - Bug
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
numpy/numpy#33422 · 6 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
BUG: f2py treats a backslash as an escape inside character literalsPeut-être pris @HaoZeke l’a pris il y a 17 jours. Ouverte00 - Bug component: numpy.f2py
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
numpy/numpy#33220 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
DOC: use CITATION.cff file format for citation informationPeut-être pris @JaroCamphuijsen l’a pris il y a 58 jours. Ouverte04 - Documentation
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
numpy/numpy#32817 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de numpy/numpy
Issues similaires
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 72/100
521xueweihan/HelloGitHub#4543 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
emeryberger/CSrankings#15700 ·
Les mainteneurs répondent en général sous 2 jours
-
Bug | 工作不正常 Triage | 待检查
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
OneDragon-Anything/ZenlessZoneZero-OneDragon#3084 ·
Les mainteneurs répondent en général sous 1 jour
-
Task select patterns with uppercase letters never matchPeut-être pris @manobhisriram l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour