Skip to content

Commit c6cfe94

Browse files
committed
Address some of pfmoore's comments
This attempts to address most of pfmoore's comments here: https://discuss.python.org/t/pep-776-emscripten-support/84996/11 * Clarify that we are speaking of _platform_ tags. * List some examples of full tags that are Pyodide-compatible * Include code to generate compatible tag list * Reference PR to add this code to pypa/packaging and specify that it will be merged. * Add section about dependency specifier markers * Add section on trove classifier * Add note that adding platform tags should have no backwards compatibility implications * Add link to Pyodide's documentation on building, testing, and ci for package maintainers
1 parent 1dc7469 commit c6cfe94

File tree

1 file changed

+53
-7
lines changed

1 file changed

+53
-7
lines changed

peps/pep-0776.rst

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -635,11 +635,11 @@ packages like aiohttp, Requests, Pydantic, cryptography, and orjson.
635635
About 60 packages are also testing against Pyodide in their CI, including NumPy,
636636
pandas, awkward-cpp, scikit-image, statsmodels, PyArrow, Hypothesis, and PyO3.
637637

638-
Emscripten Wheel Format
639-
~~~~~~~~~~~~~~~~~~~~~~~
638+
Emscripten Wheel Tags
639+
~~~~~~~~~~~~~~~~~~~~~
640640

641-
Emscripten wheels will use either the format ``emscripten_<version>_wasm32`` or
642-
``pyodide_<abi>_wasm32``. For example:
641+
Emscripten wheels will use as the platform tag either
642+
``emscripten_<version>_wasm32`` or ``pyodide_<abi>_wasm32``. For example:
643643

644644
* ``emscripten_3_1_58_wasm32``
645645
* ``pyodide_2025_0_wasm32``
@@ -651,6 +651,34 @@ depending on linker and compiler options. It is our intent that the
651651
``pyodide_<abi>`` and ``emscripten_<version>`` is intended to be the same as the
652652
relationship between ``manylinux<version>`` and ``linux``.
653653

654+
For example, wheels with the following tags are compatible with Python 3.13
655+
Pyodide:
656+
657+
- ``cp13-cp13-emscripten_3_1_58_wasm32``
658+
- ``cp13-cp13-pyodide_2025_0_wasm32``
659+
- ``abi3-cp10-pyodide_2025_0_wasm32``
660+
661+
As well as all non platformed tags. To generate the list of compatible tags, one
662+
can use the following code:
663+
664+
.. code-block:: Python
665+
666+
from packaging.tags import cpython_tags, _generic_platforms
667+
668+
def _emscripten_platforms() -> Iterator[str]:
669+
pyodide_abi_version = sysconfig.get_config_var("PYODIDE_ABI_VERSION")
670+
if pyodide_abi_version:
671+
yield f"pyodide_{pyodide_abi_version}_wasm32"
672+
yield from _generic_platforms()
673+
674+
emscripten_tags = cpython_tags(platforms=_emscripten_platforms())
675+
676+
`This code will be added to pypa/packaging
677+
<https://github.com/pypa/packaging/pull/804>`__.
678+
679+
Emscripten Wheel ABI
680+
~~~~~~~~~~~~~~~~~~~~
681+
654682
The specification of the ``pyodide_<abi>`` ABI includes:
655683

656684
* Which version of the Emscripten compiler is used
@@ -674,6 +702,20 @@ with manylinux, there is no need for a Docker container to build the
674702
``pyodide_<abi>`` wheels. All that is needed is a Linux machine and appropriate
675703
versions of Python, Node.js, and Emscripten.
676704

705+
Dependency Specifier Markers
706+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
707+
708+
To check for the Emscripten platform in a dependency specifier, one can use
709+
`sys_platform == 'emscripten'` (or its negation). Such checks are already in use
710+
in the wild and seem to be sufficient for the needs of the community.
711+
712+
Trove Classifier
713+
~~~~~~~~~~~~~~~~
714+
715+
Packages that build and test Emscripten wheels can declare this by adding the
716+
``Environment :: WebAssembly :: Emscripten``. PyPI already accepts uploads of
717+
packages with this classifier.
718+
677719

678720
PEP 11
679721
------
@@ -767,7 +809,8 @@ partially-upstreamed features so that Pyodide can replace them with more
767809
complete versions downstream.
768810

769811
These backwards compatibility concerns impact not just the runtime but also the
770-
packaging system.
812+
packaging system. Adding new platform tags should not affect existing packaging
813+
tools because tools ignore wheels with an unknown package tag.
771814

772815

773816
Security Implications
@@ -790,8 +833,11 @@ to use them all at runtime. The documentation will cover this in a similar form
790833
to the existing Windows embeddable package. In the short term, we will encourage
791834
developers to use Pyodide if at all possible.
792835

793-
Second, developers of packages with binary components need to know how to build
794-
and release them for Emscripten (see Packaging).
836+
Second, maintainers of packages with binary components need to know how to
837+
build, test, label, and deploy them for Emscripten (see Packaging). The Pyodide
838+
documentation on `building and testing packages
839+
<https://pyodide.org/en/stable/development/building-and-testing-packages.html>`__
840+
is the best reference for this.
795841

796842

797843
Reference Implementation

0 commit comments

Comments
 (0)