Skip to content

Commit 82f6e4c

Browse files
hoodmaneAA-Turner
andauthored
PEP 776: Remove all discussion of packaging (#4327)
Co-authored-by: Adam Turner <[email protected]>
1 parent 993df23 commit 82f6e4c

File tree

1 file changed

+16
-172
lines changed

1 file changed

+16
-172
lines changed

peps/pep-0776.rst

Lines changed: 16 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ PEP: 776
22
Title: Emscripten Support
33
Author: Hood Chatham <roberthoodchatham at gmail.com>
44
Sponsor: Łukasz Langa <lukasz at python.org>
5-
Discussions-To: https://discuss.python.org/t/84996
5+
Discussions-To: https://discuss.python.org/t/86276
66
Status: Draft
7-
Type: Standards Track
8-
Topic: Packaging
7+
Type: Informational
98
Created: 18-Mar-2025
109
Python-Version: 3.14
11-
Post-History: `18-Mar-2025 <https://discuss.python.org/t/84996>`__
10+
Post-History: `18-Mar-2025 <https://discuss.python.org/t/84996>`__,
11+
`28-Mar-2025 <https://discuss.python.org/t/86276>`__,
1212

1313
Abstract
1414
========
@@ -20,8 +20,17 @@ also maintains an Emscripten target.
2020

2121
This PEP formalizes the addition of Tier 3 for Emscripten support in Python 3.14
2222
which `was approved by the Steering Council on October 25, 2024
23-
<https://github.com/python/steering-council/issues/256>`__. The goal is to allow
24-
Pyodide wheels to be uploaded to PyPI.
23+
<https://github.com/python/steering-council/issues/256>`__. The goals are:
24+
25+
1. To describe the current state of the CPython Emscripten runtime
26+
2. To describe the current state of the Pyodide runtime
27+
3. To identify minor features to be upstreamed from the Pyodide runtime into the
28+
CPython Emscripten runtime
29+
30+
The minor features identified here are all features that could be implemented
31+
without a PEP. We discuss more significant runtime features that we would like
32+
to implement but we defer decisions on those features to subsequent PEPs.
33+
2534

2635
Motivation
2736
==========
@@ -41,33 +50,6 @@ Emscripten platform.
4150
Emscripten and WASI are also the only supported platforms that offer any
4251
meaningful sandboxing.
4352

44-
Goals
45-
=====
46-
47-
It is our long term goal to upstream the entire Pyodide runtime into CPython,
48-
but this is out of scope for the present PEP. This PEP only attempts to
49-
establish the foundation for future work.
50-
51-
Runtime Goals
52-
-------------
53-
54-
1. To describe the current state of the CPython Emscripten runtime
55-
2. To describe the current state of the Pyodide runtime
56-
3. To identify minor features to be upstreamed from the Pyodide runtime into the
57-
CPython Emscripten runtime
58-
59-
The minor features identified here are all features that could be implemented
60-
without a PEP. We discuss more significant runtime features that we would like
61-
to implement but we defer decisions on those features to subsequent PEPs.
62-
63-
Packaging Goals
64-
---------------
65-
66-
1. To describe Pyodide's packaging tooling
67-
2. To describe Pyodide's wheel abi to a similar level of detail as the manylinux
68-
PEPs
69-
3. For Pyodide wheels to be allowed for upload to PyPI
70-
7153

7254
Emscripten Platform Information
7355
===============================
@@ -142,30 +124,6 @@ Because of these limitations, Pyodide standardizes a no-pthreads build of
142124
Python. If there is sufficient demand, a pthreads build with no dynamic loader
143125
could be added later.
144126

145-
Emscripten ABI Compatibility
146-
----------------------------
147-
148-
The Emscripten compiler has no ABI stability guarantees between versions. Many
149-
Emscripten updates are ABI compatible by chance, and the Rust Emscripten target
150-
behaves as if the ABI were stable with only `occasional negative consequences
151-
<https://github.com/rust-lang/rust/issues/131467>`__.
152-
153-
There are several linker flags that adjust the Emscripten ABI, so Python
154-
packages built to run with Emscripten must make sure to match the ABI-sensitive
155-
linker flags used to compile the interpreter to avoid load-time or run-time
156-
errors. The Emscripten compiler continuously fixes bugs and adds support for new
157-
web platform features. Thus, there is significant benefit to being able to
158-
update the ABI.
159-
160-
In order to balance the ABI stability needs of package maintainers with the ABI
161-
flexibility to allow the platform to move forward, Pyodide plans to adopt a new
162-
ABI for each feature release of Python.
163-
164-
The Pyodide team also coordinates the ABI flags that Pyodide uses with the
165-
Emscripten ABI that Rust supports in order to ensure that we have support for
166-
the many popular Rust packages. Historically, most of the work for this has
167-
been related to unwinding ABIs. See for instance `this Rust Major Change
168-
Proposal <https://github.com/rust-lang/compiler-team/issues/801>`__.
169127

170128
Development Tools
171129
-----------------
@@ -520,7 +478,7 @@ The following modules can be imported, but are not functional:
520478
as well as any functionality that requires these.
521479

522480
The following are present but cannot be imported due to a dependency on the
523-
termios package which has been removed:
481+
termios module which has been removed:
524482

525483
- pty
526484
- tty
@@ -638,110 +596,6 @@ buildbots, maintained by Russell Keith-Magee.
638596
CPython does not currently test Tier 3 platforms on GitHub Actions, but if this
639597
ever changes, their Linux runners are able to build and test Emscripten Python.
640598

641-
Packaging
642-
---------
643-
644-
Existing Package Support
645-
~~~~~~~~~~~~~~~~~~~~~~~~
646-
647-
Pyodide currently maintains ports of 255 different packages at the time of this
648-
writing, including major scientific Python packages like NumPy, SciPy, pandas,
649-
Polars, scikit-learn, OpenCV, PyArrow, and Pillow as well as general purpose
650-
packages like aiohttp, Requests, Pydantic, cryptography, and orjson.
651-
652-
About 60 packages are also testing against Pyodide in their CI, including NumPy,
653-
pandas, awkward-cpp, scikit-image, statsmodels, PyArrow, Hypothesis, and PyO3.
654-
655-
Pyodide Wheel Tags
656-
~~~~~~~~~~~~~~~~~~
657-
658-
Pyodide wheels will use ``pyodide_<abi>_wasm32`` as the platform tag. For
659-
example, ``pyodide_2025_0_wasm32``.
660-
661-
With a fixed version of Emscripten, it is possible to link dynamic libraries
662-
that require a large number of distinct ABIs, depending on ABI-sensitive linker
663-
options and what versions of what static libraries are linked. It is our intent
664-
that the ``pyodide_2025_0`` specifies the particular ABI that will work with the
665-
Pyodide CPython runtime.
666-
667-
For example, wheels with the following tags are compatible with Python 3.13
668-
Pyodide:
669-
670-
- ``cp13-cp13-pyodide_2025_0_wasm32``
671-
- ``abi3-cp10-pyodide_2025_0_wasm32``
672-
673-
As well as all non-platformed tags. To generate the list of compatible tags, one
674-
can use the following code::
675-
676-
677-
from packaging.tags import cpython_tags, _generic_platforms
678-
679-
def _emscripten_platforms() -> Iterator[str]:
680-
pyodide_abi_version = sysconfig.get_config_var("PYODIDE_ABI_VERSION")
681-
if pyodide_abi_version:
682-
yield f"pyodide_{pyodide_abi_version}_wasm32"
683-
yield from _generic_platforms()
684-
685-
emscripten_tags = cpython_tags(platforms=_emscripten_platforms())
686-
687-
This code will be added to `pypa/packaging
688-
<https://github.com/pypa/packaging/pull/804>`__.
689-
690-
Emscripten Wheel ABI
691-
~~~~~~~~~~~~~~~~~~~~
692-
693-
The specification of the ``pyodide_<abi>`` ABI includes:
694-
695-
* Which version of the Emscripten compiler is used
696-
* What libraries are statically linked with the interpreter
697-
* What stack unwinding ABI is to be used
698-
* Which runtime platform features are required to be present
699-
700-
and a handful of other similar details that affect the ABI.
701-
702-
The ABI is selected by choosing the appropriate version of the Emscripten
703-
compiler and passing appropriate compiler and linker flags. It is possible for
704-
other people to build their own Python interpreter that is compatible with the
705-
Pyodide ABI, it is not necessary to use the Pyodide distribution itself.
706-
707-
The ``pyodide build`` tool knows how to create wheels that match our ABI. Unlike
708-
with manylinux wheels, there is no need for a Docker container to build the
709-
``pyodide_<abi>`` wheels. All that is needed is a Linux machine and appropriate
710-
versions of Python, Node.js, and Emscripten.
711-
712-
713-
Package Installers
714-
~~~~~~~~~~~~~~~~~~
715-
716-
Installers should use the ``_emscripten_platforms()`` function shown above to
717-
determine which platforms are compatible with an Emscripten build of CPython. In
718-
particular, the Pyodide ABI version is exposed via
719-
``sysconfig.get_config_var("PYODIDE_ABI_VERSION")``.
720-
721-
722-
Package indexes
723-
~~~~~~~~~~~~~~~
724-
725-
We recommend that package indexes accept any wheel whose platform tag matches
726-
``pyodide_[0-9]+_[0-9]+_wasm32``. We recommend that package indexes continue not
727-
accepting wheels that match ``emscripten_[0-9]+_[0-9]+_[0-9]+_wasm32``.
728-
729-
730-
Dependency Specifier Markers
731-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
732-
733-
To check for the Emscripten platform in a dependency specifier, one can use
734-
``sys_platform == 'emscripten'`` (or its negation). Such checks are already in use
735-
in the wild and seem to be sufficient for the needs of the community.
736-
737-
738-
Trove Classifier
739-
~~~~~~~~~~~~~~~~
740-
741-
Packages that build and test Emscripten wheels can declare this by adding the
742-
``Environment :: WebAssembly :: Emscripten``. PyPI already accepts uploads of
743-
packages with this classifier.
744-
745599

746600
PEP 11
747601
------
@@ -836,10 +690,6 @@ care to minimize backwards incompatibility. We will also need a way to disable
836690
partially-upstreamed features so that Pyodide can replace them with more
837691
complete versions downstream.
838692

839-
These backwards compatibility concerns impact not just the runtime but also the
840-
packaging system. Adding new platform tags should not affect existing packaging
841-
tools because tools ignore wheels with an unknown package tag.
842-
843693

844694
Security Implications
845695
=====================
@@ -861,12 +711,6 @@ to use them all at runtime. The documentation will cover this in a similar form
861711
to the existing Windows embeddable package. In the short term, we will encourage
862712
developers to use Pyodide if at all possible.
863713

864-
Second, maintainers of packages with binary components need to know how to
865-
build, test, label, and deploy them for Emscripten (see Packaging). The Pyodide
866-
documentation on `building and testing packages
867-
<https://pyodide.org/en/stable/development/building-and-testing-packages.html>`__
868-
is the best reference for this.
869-
870714

871715
Reference Implementation
872716
========================

0 commit comments

Comments
 (0)