# Important links - [`os-wasi` label](https://github.com/python/cpython/labels/OS-wasi) - [WASI dev container definition](https://github.com/python/cpython-devcontainers/tree/main/wasicontainer) ([image](https://github.com/python/cpython-devcontainers/pkgs/container/wasicontainer)) - Buildbot [[builders](https://buildbot.python.org/#/builders?tags=%2Bwasi)ers](https://buildbot.python.org/#/builders?tags=%2Bwasi) # Legend - πŸ₯§ beginner-friendly ("as easy as pie") - πŸ”– Working on it (bookmark where I/someone left off) - πŸ›‘ Blocked by something (stop and check status before proceeding) # Plans - [ ] [Write down support](https://peps.python.org/pep-0816/#:~:text=The%20WASI%20version%20and%20WASI%20SDK%20version%20supported%20for%20a%20Python%20version%20MUST%20be%20recorded%20in%20PEP%2011%20as%20an%20official%20record.) for Python 3.15 as outlined in [PEP 816](https://peps.python.org/pep-0816/) - [ ] πŸ›‘ [Support `wasm32-wasip3`](https://github.com/python/cpython/issues/121634) (skipping p2; blocked on WASI 0.3 being released) - [x] Ability to specify host triple - [x] Find out if `wasip2` is compatible w/ preview1 hosts - [ ] buildbot - [ ] PEP 11 - [ ] PEP for a wheel tag ([discussion](https://bytecodealliance.zulipchat.com/#narrow/channel/219900-wasi/topic/Platform.20tags.20for.20packages.20targeting.20WASI/with/516694780)) - [ ] Expose WASI details in `sys` or `platform` ([changes in wasi-libc](https://github.com/WebAssembly/wasi-libc/issues/688)) - [ ] Draft PEP (thanks to PEP 816, might be able to do just `wasi_wasm32` and non-standard `wasi_N_N_sdk_N_wasm32` in `packaging` when not matching PEP 11) - [ ] Post to DPO - [ ] Submit for approval - [ ] `wasi package` - [x] Figure out file name (`python-3.25.0a3-wasm32-wasip1.tar.xz`; host triple from `config.toml`; [`platform.python_version()`](https://docs.python.org/3/library/platform.html#platform.python_version)) - [x] Research what should be shipped for building extensions - `--without-static-libpython` - Top-level stuff in `cross-build/wasm32-wasip1` accounted for (e.g. [`pyconfig.h`](https://github.com/python/cpython/blob/957f9fe162398fceeaa9ddba8b40046b8a03176d/Makefile.pre.in#L2964)) - [`build/lib.*` to the stdlib (sans `__pycache__`)](https://github.com/python/cpython/blob/957f9fe162398fceeaa9ddba8b40046b8a03176d/Makefile.pre.in#L2853-L2855) - [`LICENSE` to `LICENSE.txt`](https://github.com/python/cpython/blob/957f9fe162398fceeaa9ddba8b40046b8a03176d/Makefile.pre.in#L2856) - `include/pythonN.Nd` if debug, otherwise `lib/pythonN.N` - `python.wasm` renamed to `python3.NN.wasm` (although where to put it since it isn't a self-contained binary?) - Try to be generic so it works for any Python build so it can be used to compare against `make install` as well as be used for relocatable builds - [X] [Refactor](https://github.com/brettcannon/cpython/tree/wasi-refactor) `Platforms/WASI` to support other subcommands ([PR](https://github.com/python/cpython/pull/145404)) - [ ] Implement - [ ] All defaults - [ ] Specify the directory/file path - [ ] Specify build directory - [ ] Flag to allow for building if not done, else error out - [ ] Make [reproducible](https://sethmlarson.dev/security-developer-in-residence-weekly-report-14) - [ ] Provide some test script to compare what gets packaged against an install to some directory - [ ] Use the WASI dev container to [build and export the package](https://docs.docker.com/build/building/export/) - [ ] Have the RM release the binaries - [ ] [External dependencies](https://github.com/python/cpython-source-deps) via `wasi externals` - [ ] Figure out what version policy we want (i.e. always latest or freeze versions like Windows builds? If latter, make it an external config) - [ ] [zlib](https://github.com/python/cpython/issues/91246) (and potentially undoing part of https://github.com/python/cpython/pull/130297)/zlib-ng - `RANLIB=/opt/wasi-sdk-29.0-x86_64-linux/bin/ranlib CC=/opt/wasi-sdk-29.0-x86_64-linux/bin/clang CHOST=wasm32 ./configure --static --zlib-compat --prefix ... && make install` - Blank out `PKG_CONFIG_SYSROOT_DIR` and `PKG_CONFIG_PATH`, set `PKG_CONFIG_LIBDIR` to where `lib/pkgconfig` ended up from `--prefix` - [ ] bzip2 - [ ] xz - [`get_externals.bat`](https://github.com/python/cpython/blob/5592399313c963c110280a7c98de974889e1d353/PCbuild/get_externals.bat#L61) - [`python.props`](https://github.com/python/cpython/blob/5592399313c963c110280a7c98de974889e1d353/PCbuild/python.props#L73) - [`externals.spdx.json`](https://github.com/python/cpython/blob/5592399313c963c110280a7c98de974889e1d353/Misc/externals.spdx.json#L160) - [ ] sqlite - [ ] zstd - [ ] mpdecimal - [x] OpenSSL (not safe as WebAssembly doesn't have constant time ops) - [ ] πŸ›‘ Networking under WASI 0.3 (blocked on threading in WASI 0.3 being released) - [Joel's hack](https://github.com/dicej/cpython/commit/118e9d8eeabb6345d57295f6cec1616694eacbc2) - Any tests requiring threads probably won't work - See the [headers in wasi-libc](https://github.com/WebAssembly/wasi-libc/tree/main/libc-top-half/musl/include) for what can be turned on - Will probably require tweaking `config.site` - [ ] πŸ₯§ Make sure build details are still relevant - [ ] Check if all the flags set in `configure.ac` are necessary - [ ] Check what `__wasi__` usage can be removed - [x] [Check](https://github.com/python/cpython/issues/115982) that the [site config](https://github.com/python/cpython/blob/main/Tools/wasm/config.site-wasm32-wasi) is up-to-date - [ ] [[HTTP fetch API]] # Packaging notes ```shell ./configure --without-static-libpython --prefix (pwd)/builddir && make -s -j && make install ``` ## Release ```shell ➲ ls πŸ“‚ bin πŸ“‚ include πŸ“‚ lib πŸ“‚ share ``` ```shell ➲ ls bin/ πŸ”– idle3 πŸ— idle3.15 πŸ— pip3 πŸ— pip3.15 πŸ”– pydoc3 πŸ— pydoc3.15 πŸ”– python3 πŸ”– python3-config πŸ— python3.15 πŸ— python3.15-config ``` ```shell ➲ ls include/python3.15/ πŸ“„ abstract.h πŸ“„ codecs.h πŸ“„ dictobject.h πŸ“„ floatobject.h πŸ“„ listobject.h πŸ“„ object.h πŸ“„ py_curses.h πŸ“„ pyexpat.h πŸ“„ pymem.h πŸ“„ pythonrun.h πŸ“„ structmember.h πŸ“„ warnings.h πŸ“„ audit.h πŸ“„ compile.h πŸ“„ dynamic_annotations.h πŸ“„ frameobject.h πŸ“„ longobject.h πŸ“„ objimpl.h πŸ“„ pyatomic.h πŸ“„ pyframe.h πŸ“„ pyport.h πŸ“„ pythread.h πŸ“„ structseq.h πŸ“„ weakrefobject.h πŸ“„ bltinmodule.h πŸ“„ complexobject.h πŸ“„ enumobject.h πŸ“„ genericaliasobject.h πŸ“„ marshal.h πŸ“„ opcode.h πŸ“„ pybuffer.h πŸ“„ pyhash.h πŸ“„ pystate.h πŸ“„ pytypedefs.h πŸ“„ sysmodule.h πŸ“„ boolobject.h πŸ“‚ cpython πŸ“„ errcode.h πŸ“„ import.h πŸ“„ memoryobject.h πŸ“„ opcode_ids.h πŸ“„ pycapsule.h πŸ“„ pylifecycle.h πŸ“„ pystats.h πŸ“„ rangeobject.h πŸ“„ traceback.h πŸ“„ bytearrayobject.h πŸ“„ critical_section.h πŸ“„ exports.h πŸ“‚ internal πŸ“„ methodobject.h πŸ“„ osdefs.h πŸ“„ pyconfig.h πŸ“„ pymacconfig.h πŸ“„ pystrcmp.h πŸ“„ refcount.h πŸ“„ tupleobject.h πŸ“„ bytesobject.h πŸ“„ datetime.h πŸ“„ fileobject.h πŸ“„ intrcheck.h πŸ“„ modsupport.h πŸ“„ osmodule.h πŸ“„ pydtrace.h πŸ“„ pymacro.h πŸ“„ pystrtod.h πŸ“„ setobject.h πŸ“„ typeslots.h πŸ“„ ceval.h πŸ“„ descrobject.h πŸ“„ fileutils.h πŸ“„ iterobject.h πŸ“„ moduleobject.h πŸ“„ patchlevel.h πŸ“„ pyerrors.h πŸ“„ pymath.h πŸ“„ Python.h πŸ“„ sliceobject.h πŸ“„ unicodeobject.h ``` ```shell ➲ ls lib/ πŸ“‚ pkgconfig πŸ“‚ python3.15 ``` ```shell ➲ ls lib/pkgconfig/ πŸ“„ python-3.15-embed.pc πŸ“„ python-3.15.pc πŸ”– python3-embed.pc πŸ”– python3.pc ``` ```shell ➲ ls lib/python3.15/ πŸ“„ __future__.py πŸ“„ _pyio.py πŸ“„ calendar.py πŸ“„ dataclasses.py πŸ“„ gettext.py πŸ“„ locale.py πŸ“„ platform.py πŸ“„ sched.py πŸ“„ symtable.py πŸ“„ types.py πŸ“„ __hello__.py πŸ“„ _pylong.py πŸ“„ cmd.py πŸ“„ datetime.py πŸ“„ glob.py πŸ“‚ logging πŸ“„ plistlib.py πŸ“„ secrets.py πŸ“‚ sysconfig πŸ“„ typing.py πŸ“‚ __phello__ πŸ“‚ _pyrepl πŸ“„ code.py πŸ“‚ dbm πŸ“„ graphlib.py πŸ“„ lzma.py πŸ“„ poplib.py πŸ“„ selectors.py πŸ“„ tabnanny.py πŸ“‚ unittest πŸ“‚ __pycache__ πŸ“„ _sitebuiltins.py πŸ“„ codecs.py πŸ“„ decimal.py πŸ“„ gzip.py πŸ“„ mailbox.py πŸ“„ posixpath.py πŸ“„ shelve.py πŸ“„ tarfile.py πŸ“‚ urllib πŸ“„ _aix_support.py πŸ“„ _strptime.py πŸ“„ codeop.py πŸ“„ difflib.py πŸ“„ hashlib.py πŸ“„ mimetypes.py πŸ“„ pprint.py πŸ“„ shlex.py πŸ“„ tempfile.py πŸ“„ uuid.py πŸ“„ _android_support.py πŸ“„ _sysconfig_vars__linux_x86_64-linux-gnu.json πŸ“‚ collections πŸ“„ dis.py πŸ“„ heapq.py πŸ“„ modulefinder.py πŸ“„ profile.py πŸ“„ shutil.py πŸ“‚ test πŸ“‚ venv πŸ“„ _apple_support.py πŸ“„ _sysconfigdata__linux_x86_64-linux-gnu.py πŸ“„ colorsys.py πŸ“„ doctest.py πŸ“„ hmac.py πŸ“‚ multiprocessing πŸ“‚ profiling πŸ“„ signal.py πŸ“„ textwrap.py πŸ“„ warnings.py πŸ“„ _ast_unparse.py πŸ“„ _threading_local.py πŸ“„ compileall.py πŸ“‚ email πŸ“‚ html πŸ“„ netrc.py πŸ“„ pstats.py πŸ“‚ site-packages πŸ“„ this.py πŸ“„ wave.py πŸ“„ _collections_abc.py πŸ“„ _weakrefset.py πŸ“‚ compression πŸ“‚ encodings πŸ“‚ http πŸ“„ ntpath.py πŸ“„ pty.py πŸ“„ site.py πŸ“„ threading.py πŸ“„ weakref.py πŸ“„ _colorize.py πŸ“„ abc.py πŸ“‚ concurrent πŸ“‚ ensurepip πŸ“‚ idlelib πŸ“„ nturl2path.py πŸ“„ py_compile.py πŸ“„ smtplib.py πŸ“„ timeit.py πŸ“„ webbrowser.py πŸ“„ _compat_pickle.py πŸ“„ annotationlib.py πŸ“‚ config-3.15-x86_64-linux-gnu πŸ“„ enum.py πŸ“„ imaplib.py πŸ“„ numbers.py πŸ“„ pyclbr.py πŸ“„ socket.py πŸ“‚ tkinter πŸ“‚ wsgiref πŸ“„ _ios_support.py πŸ“„ antigravity.py πŸ“„ configparser.py πŸ“„ filecmp.py πŸ“‚ importlib πŸ“„ opcode.py πŸ“„ pydoc.py πŸ“„ socketserver.py πŸ“„ token.py πŸ“‚ xml πŸ“„ _markupbase.py πŸ“„ argparse.py πŸ“„ contextlib.py πŸ“„ fileinput.py πŸ“„ inspect.py πŸ“„ operator.py πŸ“‚ pydoc_data πŸ“‚ sqlite3 πŸ“„ tokenize.py πŸ“‚ xmlrpc πŸ“„ _missing_stdlib_info.py πŸ“„ ast.py πŸ“„ contextvars.py πŸ“„ fnmatch.py πŸ“„ io.py πŸ“„ optparse.py πŸ“„ queue.py πŸ“„ ssl.py πŸ“‚ tomllib πŸ“„ zipapp.py πŸ“„ _opcode_metadata.py πŸ“‚ asyncio πŸ“„ copy.py πŸ“„ fractions.py πŸ“„ ipaddress.py πŸ“„ os.py πŸ“„ quopri.py πŸ“„ stat.py πŸ“„ trace.py πŸ“‚ zipfile πŸ“„ _osx_support.py πŸ“„ base64.py πŸ“„ copyreg.py πŸ“„ ftplib.py πŸ“‚ json πŸ“‚ pathlib πŸ“„ random.py πŸ“„ statistics.py πŸ“„ traceback.py πŸ“„ zipimport.py πŸ“„ _py_abc.py πŸ“„ bdb.py πŸ“„ cProfile.py πŸ“„ functools.py πŸ“„ keyword.py πŸ“„ pdb.py πŸ“‚ re πŸ“‚ string πŸ“„ tracemalloc.py πŸ“‚ zoneinfo πŸ“„ _py_warnings.py πŸ“„ bisect.py πŸ“„ csv.py πŸ“„ genericpath.py πŸ“‚ lib-dynload πŸ“„ pickle.py πŸ“„ reprlib.py πŸ“„ stringprep.py πŸ“„ tty.py πŸ“„ _pydatetime.py πŸ“„ build-details.json πŸ“‚ ctypes πŸ“„ getopt.py πŸ“„ LICENSE.txt πŸ“„ pickletools.py πŸ“„ rlcompleter.py πŸ“„ struct.py πŸ“„ turtle.py πŸ“„ _pydecimal.py πŸ“„ bz2.py πŸ“‚ curses πŸ“„ getpass.py πŸ“„ linecache.py πŸ“„ pkgutil.py πŸ“„ runpy.py πŸ“„ subprocess.py πŸ“‚ turtledemo ``` ```shell /tmp/cp-install ➲ ls lib/python3.15/lib-dynload/ πŸ— _bisect.cpython-315-x86_64-linux-gnu.so πŸ— _heapq.cpython-315-x86_64-linux-gnu.so πŸ— _sha2.cpython-315-x86_64-linux-gnu.so πŸ— _zoneinfo.cpython-315-x86_64-linux-gnu.so πŸ— zlib.cpython-315-x86_64-linux-gnu.so πŸ— _blake2.cpython-315-x86_64-linux-gnu.so πŸ— _hmac.cpython-315-x86_64-linux-gnu.so πŸ— _sha3.cpython-315-x86_64-linux-gnu.so πŸ— _zstd.cpython-315-x86_64-linux-gnu.so πŸ— _bz2.cpython-315-x86_64-linux-gnu.so πŸ— _interpchannels.cpython-315-x86_64-linux-gnu.so πŸ— _socket.cpython-315-x86_64-linux-gnu.so πŸ— array.cpython-315-x86_64-linux-gnu.so πŸ— _codecs_cn.cpython-315-x86_64-linux-gnu.so πŸ— _interpqueues.cpython-315-x86_64-linux-gnu.so πŸ— _sqlite3.cpython-315-x86_64-linux-gnu.so πŸ— binascii.cpython-315-x86_64-linux-gnu.so πŸ— _codecs_hk.cpython-315-x86_64-linux-gnu.so πŸ— _interpreters.cpython-315-x86_64-linux-gnu.so πŸ— _ssl.cpython-315-x86_64-linux-gnu.so πŸ— cmath.cpython-315-x86_64-linux-gnu.so πŸ— _codecs_iso2022.cpython-315-x86_64-linux-gnu.so πŸ— _json.cpython-315-x86_64-linux-gnu.so πŸ— _statistics.cpython-315-x86_64-linux-gnu.so πŸ— fcntl.cpython-315-x86_64-linux-gnu.so πŸ— _codecs_jp.cpython-315-x86_64-linux-gnu.so πŸ— _lsprof.cpython-315-x86_64-linux-gnu.so πŸ— _struct.cpython-315-x86_64-linux-gnu.so πŸ— grp.cpython-315-x86_64-linux-gnu.so πŸ— _codecs_kr.cpython-315-x86_64-linux-gnu.so πŸ— _lzma.cpython-315-x86_64-linux-gnu.so πŸ— _testbuffer.cpython-315-x86_64-linux-gnu.so πŸ— math.cpython-315-x86_64-linux-gnu.so πŸ— _codecs_tw.cpython-315-x86_64-linux-gnu.so πŸ— _math_integer.cpython-315-x86_64-linux-gnu.so πŸ— _testcapi.cpython-315-x86_64-linux-gnu.so πŸ— mmap.cpython-315-x86_64-linux-gnu.so πŸ— _csv.cpython-315-x86_64-linux-gnu.so πŸ— _md5.cpython-315-x86_64-linux-gnu.so πŸ— _testclinic.cpython-315-x86_64-linux-gnu.so πŸ— pyexpat.cpython-315-x86_64-linux-gnu.so πŸ— _ctypes.cpython-315-x86_64-linux-gnu.so πŸ— _multibytecodec.cpython-315-x86_64-linux-gnu.so πŸ— _testclinic_limited.cpython-315-x86_64-linux-gnu.so πŸ— readline.cpython-315-x86_64-linux-gnu.so πŸ— _ctypes_test.cpython-315-x86_64-linux-gnu.so πŸ— _multiprocessing.cpython-315-x86_64-linux-gnu.so πŸ— _testimportmultiple.cpython-315-x86_64-linux-gnu.so πŸ— resource.cpython-315-x86_64-linux-gnu.so πŸ— _curses.cpython-315-x86_64-linux-gnu.so πŸ— _pickle.cpython-315-x86_64-linux-gnu.so πŸ— _testinternalcapi.cpython-315-x86_64-linux-gnu.so πŸ— select.cpython-315-x86_64-linux-gnu.so πŸ— _curses_panel.cpython-315-x86_64-linux-gnu.so πŸ— _posixshmem.cpython-315-x86_64-linux-gnu.so πŸ— _testlimitedcapi.cpython-315-x86_64-linux-gnu.so πŸ— syslog.cpython-315-x86_64-linux-gnu.so πŸ— _dbm.cpython-315-x86_64-linux-gnu.so πŸ— _posixsubprocess.cpython-315-x86_64-linux-gnu.so πŸ— _testmultiphase.cpython-315-x86_64-linux-gnu.so πŸ— termios.cpython-315-x86_64-linux-gnu.so πŸ— _decimal.cpython-315-x86_64-linux-gnu.so πŸ— _queue.cpython-315-x86_64-linux-gnu.so πŸ— _testsinglephase.cpython-315-x86_64-linux-gnu.so πŸ— unicodedata.cpython-315-x86_64-linux-gnu.so πŸ— _elementtree.cpython-315-x86_64-linux-gnu.so πŸ— _random.cpython-315-x86_64-linux-gnu.so πŸ— _tkinter.cpython-315-x86_64-linux-gnu.so πŸ— xxlimited.cpython-315-x86_64-linux-gnu.so πŸ— _gdbm.cpython-315-x86_64-linux-gnu.so πŸ— _remote_debugging.cpython-315-x86_64-linux-gnu.so πŸ— _uuid.cpython-315-x86_64-linux-gnu.so πŸ— xxlimited_35.cpython-315-x86_64-linux-gnu.so πŸ— _hashlib.cpython-315-x86_64-linux-gnu.so πŸ— _sha1.cpython-315-x86_64-linux-gnu.so πŸ— _xxtestfuzz.cpython-315-x86_64-linux-gnu.so πŸ— xxsubtype.cpython-315-x86_64-linux-gnu.so ``` ```shell ➲ ls share/man/man1/ πŸ”– python3.1 πŸ“„ python3.15.1 ``` ## Debug Only listing differences with a release build. ```shell ➲ ls bin/ idle3 pip3 pydoc3 python3 python3.15 python3.15d idle3.15 pip3.15 pydoc3.15 python3-config python3.15-config python3.15d-config ``` ```shell ➲ ls include/python3.15d/ abstract.h datetime.h import.h objimpl.h pyerrors.h pystrcmp.h sysmodule.h audit.h descrobject.h internal opcode.h pyexpat.h pystrtod.h traceback.h bltinmodule.h dictobject.h intrcheck.h opcode_ids.h pyframe.h Python.h tupleobject.h boolobject.h dynamic_annotations.h iterobject.h osdefs.h pyhash.h pythonrun.h typeslots.h bytearrayobject.h enumobject.h listobject.h osmodule.h pylifecycle.h pythread.h unicodeobject.h bytesobject.h errcode.h longobject.h patchlevel.h pymacconfig.h pytypedefs.h warnings.h ceval.h exports.h marshal.h py_curses.h pymacro.h rangeobject.h weakrefobject.h codecs.h fileobject.h memoryobject.h pyatomic.h pymath.h refcount.h compile.h fileutils.h methodobject.h pybuffer.h pymem.h setobject.h complexobject.h floatobject.h modsupport.h pycapsule.h pyport.h sliceobject.h cpython frameobject.h moduleobject.h pyconfig.h pystate.h structmember.h critical_section.h genericaliasobject.h object.h pydtrace.h pystats.h structseq.h ``` ``` ```shell ➲ ls lib/pkgconfig/ python-3.15-embed.pc python-3.15.pc python-3.15d-embed.pc python-3.15d.pc python3-embed.pc python3.pc ```