Skip to content

Commit 084ac17

Browse files
committed
Take a PEP number
1 parent 410b19b commit 084ac17

File tree

2 files changed

+173
-137
lines changed

2 files changed

+173
-137
lines changed

peps/pep-8108.rst

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
PEP: 8108
2+
Title: WASI Support
3+
Author: Brett Cannon <brett@python.org>
4+
Discussions-To: Pending
5+
Status: Draft
6+
Type: Informational
7+
Created: 05-Nov-2025
8+
Post-History: Pending
9+
Resolution: <url>
10+
11+
12+
Abstract
13+
========
14+
15+
This PEP outlines the expected support for WASI_ by CPython. It contains enough
16+
details to know what WASI and WASI SDK version is expected to be supported for
17+
any release of CPython while official WASI support is specified in :pep:`11`.
18+
19+
20+
Motivation
21+
==========
22+
23+
CPython has supported WASI according to :pep:`11` since Python 3.11. As part of
24+
this support, CPython needs to target two different things: the WASI_ version
25+
and the `WASI SDK`_ version (both of whose development is driven by the
26+
`Bytecode Alliance`_). The former is the specification of WASI itself while the
27+
latter is a version of clang_ with a specific version of wasi-libc_ as the
28+
sysroot that allows for compiling CPython to WASI. There is roughly an annual
29+
release cadence for new WASI versions while there's no set release cadence for
30+
WASI SDK.
31+
32+
Agreeing on which WASI and WASI SDK versions to support allows for clear
33+
targeting of the CPython code base towards those versions. This also lets the
34+
community set appropriate expectations as to what will (not) be considered a
35+
bug if it only manifests itself under a certain WASI or WASI SDK version. It
36+
also provides the community an overall target for WASI and WASI SDK for any
37+
specific Python version when building other software like libraries. This is
38+
important as WASI SDK is NOT forwards- or backwards-compatible due to the ABI
39+
of wasi-libc not making any compatibility guarantees, making broad coordination
40+
important so code works together.
41+
42+
This coordination and recording around version targets can be important in
43+
situations where the selected versions is non-obvious. For example, WASI SDK 26
44+
and 27 have a `bug <https://github.com/WebAssembly/wasi-libc/issues/617>`__
45+
which cause CPython to hang in certain situations (including exiting the REPL).
46+
Because the bug is in thread support code it wouldn't necessarily be obvious to
47+
others in the community that CPython will not target those versions and thus
48+
3rd-party code should also avoid those versions.
49+
50+
51+
Rationale
52+
=========
53+
54+
While technically separate, CPython cannot support a version of WASI until WASI
55+
SDK supports it. WASI versions are considered backwards-compatible with each
56+
other, but WASI SDK is NOT compatible forwards or backwards thanks to wasi-libc
57+
not having ABI compatibility guarantees. As such, it's important to set support
58+
expectations for a specific WASI SDK version in CPython. Historically, the
59+
support difference between WASI SDK versions for CPython have involved settings
60+
in the ``config.site`` file that is maintained for WASI. Support issues have
61+
come up due to bugs in WASI SDK itself. Finally, new features being supported
62+
by WASI SDK can also cause code that wasn't previously used in a WASI build to
63+
suddenly be run which can require code updates to pass tests.
64+
65+
As for WASI version support, that typically translates into what stdlib modules
66+
are (potentially) usable with a WASI build. For example, WASI 0.2 added socket
67+
support and WASI 0.3.1 is scheduled to have some form of threading support.
68+
Knowing what WASI version is supported sets expectations for what stdlib
69+
modules should be supported.
70+
71+
Interpreter feature availability can be dependent on the WASI version. For
72+
instance, until there is threading support there can't be free-threading
73+
support in WASI. Once again, this helps set expectations of what should be
74+
working based on the target WASI version.
75+
76+
77+
Specification
78+
=============
79+
80+
The WASI and WASI SDK version supported by a CPython version in CI or its
81+
stable Buildbot builder when b1 is released MUST be the version to be supported
82+
for the lifetime of that Python version after this PEP is accepted. If there is
83+
a discrepancy between CI and the Buildbot builder for some reason, the WASI
84+
maintainers as specified by :pep:`11` will choose which sets of versions will
85+
be designated as the versions to support.
86+
87+
The WASI version and WASI SDK version supported for a Python version MUST be
88+
recorded in :pep:`11` as an official record.
89+
90+
If for some reason a supported WASI SDK version needs to change after being
91+
recorded, a note will be made in :pep:`11` as to when and why the change was
92+
made. Such a change is at the discretion of the maintainers of WASI support as
93+
listed in :pep:`11` and does not require steering council approval. The
94+
expectation, though, is that such a change SHOULD NOT occur.
95+
96+
Changing the WASI version after it has been recorded MUST NOT occur UNLESS the
97+
steering council approves it. This is due to the increased support burden for
98+
new WASI versions and the shift in expectations of what CPython would support
99+
when support expectations have already been set.
100+
101+
Any updates to :pep:`11` to reflect the appropriate WASI version for the target
102+
triple for the main branch MUST be made as needed, but it does NOT require
103+
steering council approval to update. The steering council is spared needing to
104+
approve such an update as it does not constitute a new platform and is more in
105+
line with a new OS release which currently does not require steering council
106+
approval.
107+
108+
109+
Designated Support
110+
==================
111+
112+
Note that while WASI SDK in some places lists both a major and minor version,
113+
in actuality the minor version has never been set to anything other than ``0``
114+
and there's an expectation that
115+
`any minor version will be ABI compatible with the overall major version <https://bytecodealliance.zulipchat.com/#narrow/channel/219900-wasi/topic/Platform.20tags.20for.20packages.20targeting.20WASI/near/516771862>`__.
116+
As well, the WASI community only refers to WASI SDK versions by their major
117+
version due to there having never been a minor release. Subsequently, this PEP
118+
only records the major version of WASI SDK until such time that there's a need
119+
to record a minor version.
120+
121+
====== ==== ========
122+
Python WASI WASI SDK
123+
====== ==== ========
124+
3.14 0.1 24
125+
3.13 0.1 24
126+
3.12 0.1 16
127+
3.11 0.1 16
128+
====== ==== ========
129+
130+
131+
Notes
132+
-----
133+
134+
All versions prior to Python 3.15 predate this PEP. The version support for
135+
those versions is based on what was supported when this PEP was written.
136+
137+
WASI was a tier 3 platform according to :pep:`11` for Python 3.11 and 3.12.
138+
WASI became a tier 2 platform starting with Python 3.13.
139+
140+
WASI 0.2 support has been skipped due to lack of time, to the point that it was
141+
deemed better to go straight to WASI 0.3 instead. This is based on a
142+
recommendation from the `Bytecode Alliance`_.
143+
144+
WASI SDK 26 and 27 have a
145+
`bug <https://github.com/WebAssembly/wasi-libc/issues/617>`__ which causes
146+
CPython to hang in certain situations, and so they have been skipped.
147+
148+
149+
Acknowledgements
150+
================
151+
152+
Thanks to Joel Dice and Ben Brandt of the Python
153+
`sub-group <https://github.com/bytecodealliance/SIG-Guest-Languages/blob/main/docs/subgroups.md>`__
154+
of the
155+
`guest languages SIG <https://github.com/bytecodealliance/SIG-Guest-Languages>`__
156+
of the `Bytecode Alliance`_ for discussing the specification of this PEP.
157+
158+
159+
Footnotes
160+
=========
161+
162+
.. _WASI: https://wasi.dev
163+
.. _WASI SDK: https://github.com/WebAssembly/wasi-sdk
164+
.. _wasi-libc: https://github.com/WebAssembly/wasi-libc
165+
.. _clang: https://clang.llvm.org
166+
.. _Bytecode Alliance: https://bytecodealliance.org
167+
168+
169+
Copyright
170+
=========
171+
172+
This document is placed in the public domain or under the
173+
CC0-1.0-Universal license, whichever is more permissive.

peps/pep-NNNN.rst

Lines changed: 0 additions & 137 deletions
This file was deleted.

0 commit comments

Comments
 (0)