Skip to content

Commit 180b08c

Browse files
committed
PEP 783: Clarify that PyEmscripten platform is independent of Python
And of Python version. Also adjust wording: prefer "Platform" over "ABI" in most places.
1 parent 63c2676 commit 180b08c

File tree

1 file changed

+43
-37
lines changed

1 file changed

+43
-37
lines changed

peps/pep-0783.rst

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ benefit to being able to update the ABI.
7171

7272
In order to balance the ABI stability needs of package maintainers with the ABI
7373
flexibility to allow the platform to move forward, Pyodide plans to adopt a new
74-
ABI for each feature release of Python which we call
74+
Emscripten platform for each feature release of Python which we call
7575
``pyemscripten_${YEAR}_${PATCH}``.
7676

7777
The Pyodide team also coordinates the ABI flags that Pyodide uses with the
@@ -99,44 +99,48 @@ The platform tags will take the form:
9999
Each one of these will be used with a specified Python version. For example, the
100100
platform tag ``pyemscripten_2026_0`` will be used with Python 3.14.
101101

102-
Emscripten Wheel ABI
103-
--------------------
102+
The PyEmscripten Platform
103+
-------------------------
104104

105-
The specification of the ``pyemscripten_<abi>`` platform includes:
105+
The specification of the ``pyemscripten_${YEAR}_${PATCH}`` platform includes:
106106

107107
* Which version of the Emscripten compiler is used
108-
* What libraries are statically linked with the interpreter
108+
* What libraries are statically linked to the binary
109109
* What stack unwinding ABI is to be used
110110
* How the loader handles dependency lookup
111111
* That libraries cannot use ``-pthread``
112112
* That libraries should be linked with ``-sWASM_BIGINT``
113113

114-
The ABI is selected by choosing the appropriate version of the Emscripten
115-
compiler and passing appropriate compiler and linker flags. It is possible for
116-
other people to build their own Python interpreter that is compatible with the
117-
Pyodide ABI, it is not necessary to use the Pyodide distribution itself.
114+
The platform is selected by choosing the appropriate version of the Emscripten
115+
compiler and passing appropriate compiler and linker flags.
118116

119-
The Pyodide ABIs are fully specified in the `Pyodide Platform ABI
120-
<https://pyodide.org/en/stable/development/abi.html>`__ documentation.
117+
The platform definition does not include anything about Python and in particular
118+
it is agnostic to the Python version it is intended to be used with. However,
119+
for clarity we will note in the platform documentation which Python version we
120+
plan to use each platform with.
121121

122-
The ``pyodide build`` tool knows how to create wheels that match the Pyodide
123-
ABI. Unlike with manylinux wheels, there is no need for a Docker container to
124-
build the ``pyemscripten_<abi>`` wheels. All that is needed is a Linux machine and
125-
appropriate versions of Python, Node.js, and Emscripten.
122+
The PyEmscripten platforms are fully specified in
123+
`Pyodide's documentation on the PyEmscripten Platform <https://pyodide.org/en/stable/development/abi.html>`__.
126124

127-
It is possible to validate a wheel by installing and importing it into the
125+
The ``pyodide build`` tool knows how to create wheels that are compatible with the
126+
PyEmscripten platform. Unlike with manylinux wheels, there is no need for a
127+
Docker container to build ``pyemscripten`` wheels. All that is needed is a Linux
128+
machine and appropriate versions of Python, Node.js, and Emscripten.
129+
130+
It is possible to validate that a wheel is compatible with the PyEmscripten
131+
platform by installing and importing it into an appropriate version of the
128132
Pyodide runtime. Because Pyodide can run in an environment with strong
129133
sandboxing guarantees, doing this produces no security risks.
130134

131-
Determining the ABI version
132-
---------------------------
135+
Determining the PyEmscripten Platform Version
136+
---------------------------------------------
133137

134-
The ABI version is stored in the ``PYEMSCRIPTEN_ABI_VERSION`` config variable
135-
and can be determined via:
138+
The PyEmscripten platform version is stored in the
139+
``PYEMSCRIPTEN_PLATFORM_VERSION`` config variable and can be determined via:
136140

137141
.. code-block:: python
138142
139-
pyemscripten_abi_version = sysconfig.get_config_var("PYEMSCRIPTEN_ABI_VERSION")
143+
pyemscripten_platform_version = sysconfig.get_config_var("PYEMSCRIPTEN_PLATFORM_VERSION")
140144
141145
142146
To generate the list of compatible tags, one can use the following code:
@@ -146,9 +150,9 @@ To generate the list of compatible tags, one can use the following code:
146150
from packaging.tags import cpython_tags, _generic_platforms
147151
148152
def _emscripten_platforms() -> Iterator[str]:
149-
pyemscripten_abi_version = sysconfig.get_config_var("PYEMSCRIPTEN_ABI_VERSION")
150-
if pyemscripten_abi_version:
151-
yield f"pyemscripten_{pyemscripten_abi_version}_wasm32"
153+
pyemscripten_platform_version = sysconfig.get_config_var("PYEMSCRIPTEN_PLATFORM_VERSION")
154+
if pyemscripten_platform_version:
155+
yield f"pyemscripten_{pyemscripten_platform_version}_wasm32"
152156
yield from _generic_platforms()
153157
154158
emscripten_tags = cpython_tags(platforms=_emscripten_platforms())
@@ -162,8 +166,8 @@ Package Installers
162166

163167
Installers should use the ``_emscripten_platforms()`` function shown above to
164168
determine which platforms are compatible with an Emscripten build of CPython. In
165-
particular, the ABI version is exposed via
166-
``sysconfig.get_config_var(" PYEMSCRIPTEN_ABI_VERSION")``.
169+
particular, the PyEmscripten platform version is exposed via
170+
``sysconfig.get_config_var("PYEMSCRIPTEN_PLATFORM_VERSION")``.
167171

168172
Package Indexes
169173
---------------
@@ -219,20 +223,21 @@ Alternative Options for the Platform Tag
219223
``pyemscripten`` platform has nothing specifically to do with Python and
220224
indeed can be used by any program that uses the appropriate version of
221225
Emscripten and the appropriate link flags. But
222-
``emscripten_${EMSCRIPTEN_VERSION}`` is too vague by itself because the ABI
226+
``emscripten_${EMSCRIPTEN_VERSION}`` is too vague by itself because the platform
223227
also depends on various linker flags.
224228

225-
There are other communities which have similar problems and would also benefit
226-
from a centralized standard for "Long Term Service" ABIs that the whole
227-
ecosystem could use. However, the Emscripten team have so far not been willing
228-
to provide a this standard since they consider dynamic linking an unusual use
229-
case. Thus it is left for our ecosystem to solve the problem itself. The
230-
platform tag should contains some indication of this.
229+
There are other communities which have similar problems and would also
230+
benefit from a centralized standard for "Long Term Service" Emscripten
231+
platforms that the whole ecosystem could use. However, the Emscripten team
232+
have so far not been willing to provide a this standard since they consider
233+
dynamic linking an unusual use case. Thus it is left for our ecosystem to
234+
solve the problem itself. The platform tag should contains some indication
235+
of this.
231236

232237
``pyemscripten_${PYTHON_MAJOR_MINOR}_${PATCH}``
233238
This would make it clearer which Python version is meant for use with each
234-
ABI, but it leads to conceptual confusion since the platform has nothing to do
235-
with Python.
239+
platform, but it leads to conceptual confusion since the platform has
240+
nothing to do with Python.
236241

237242
``pyodide_...``
238243
For now the platform is defined by Pyodide so this connection would be made
@@ -242,7 +247,7 @@ Alternative Options for the Platform Tag
242247
also more forwards compatible to a future where the definition of the platform
243248
moves upstream of Pyodide.
244249

245-
No ABI patch version
250+
No patch version
246251
We hope never to need the patch version, but it's good to be prepared for
247252
unforseen problems.
248253

@@ -253,7 +258,8 @@ Fo Pyodide Users
253258
----------------
254259
We recommend the `Pyodide documentation on installing packages
255260
<https://pyodide.org/en/stable/usage/loading-packages.html>`__. We will make a
256-
table showing which ``pyemscripten`` ABI each Pyodide version is compatible with.
261+
table showing which ``pyemscripten`` platform version each Pyodide version is
262+
compatible with.
257263

258264
For Package Maintainers
259265
-----------------------

0 commit comments

Comments
 (0)