From a72c67073552ca813e8e202fe2d10f1ac2b5e248 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Thu, 1 Oct 2026 09:31:31 -0700 Subject: [PATCH 1/4] PEP 818: Add How to Teach and Change History, minor edits, new discuss post --- peps/pep-0818.rst | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/peps/pep-0818.rst b/peps/pep-0818.rst index 6eb478744f9..ff5514b1d64 100644 --- a/peps/pep-0818.rst +++ b/peps/pep-0818.rst @@ -2,11 +2,12 @@ PEP: 818 Title: Adding the Core of the Pyodide Foreign Function Interface to Python Author: Hood Chatham Sponsor: Ɓukasz Langa -Discussions-To: https://discuss.python.org/t/pep-818-upstreaming-the-pyodide-ffi/105530 +Discussions-To: https://discuss.python.org/t/pep-818-adding-the-core-of-the-pyodide-foreign-function-interface-to-python-2/109311 Status: Draft Type: Standards Track Created: 10-Dec-2025 Python-Version: 3.16 +Post-History: `05-Jan-2026 `__ Abstract ======== @@ -62,10 +63,8 @@ supporting ``urllib3``, ``aiohttp``, and ``httpx`` requires the foreign function interface. In order to keep the length of this PEP reasonable, we focus on the "core" of -the foreign function interface. The following areas are left to future PEPs: - -1. asyncio -2. a JavaScript interface for managing the Python runtime +the foreign function interface. The JavaScript interface for managing the Python +runtime is left to a future pep. Rationale @@ -1545,6 +1544,28 @@ run on. How to Teach This ================= +Pyodide has maintained a user guide for this foreign function interface for +several years, and the existing `Pyodide type translation documentation +`_ can be adapted to +form the basis of the CPython documentation. + +We have substantial experience in teaching users how to use Pyodide and for the +most part they find it very intuitive. The main area that trips up users is +memory management of ``PyProxy`` objects. For this reason, we have taken special +care to design the memory management error messages to be actionable. + + +Change History +============== + +- 30-Sept-2026 + + - Reduced the amount of detail in the specification section. + - Added support for proxying and conversion of buffers. + - Added asyncio support, including an event loop, conversion between Python + and JavaScript awaitables, and deferred destruction for arguments to an + asynchronous JavaScript function called from Python. + Reference Implementation ======================== @@ -1555,7 +1576,7 @@ Pyodide, https://github.com/hoodmane/cpython/tree/js-ffi Acknowledgments =============== -Mike Droettboom, Roman Yurchak, Gyeongjae Choi, Andrea Giammarchi +Mike Droettboom, Roman Yurchak, Gyeongjae Choi, Andrea Giammarchi, Thorsten Beier Copyright ========= From 124198f1dec533297d03b95dd7cf12152e49b23d Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Thu, 1 Oct 2026 11:44:50 -0700 Subject: [PATCH 2/4] stanfromireland edits --- peps/pep-0818.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/peps/pep-0818.rst b/peps/pep-0818.rst index ff5514b1d64..c3d87d35a93 100644 --- a/peps/pep-0818.rst +++ b/peps/pep-0818.rst @@ -9,6 +9,7 @@ Created: 10-Dec-2025 Python-Version: 3.16 Post-History: `05-Jan-2026 `__ + Abstract ======== @@ -1546,7 +1547,7 @@ How to Teach This Pyodide has maintained a user guide for this foreign function interface for several years, and the existing `Pyodide type translation documentation -`_ can be adapted to +`__ can be adapted to form the basis of the CPython documentation. We have substantial experience in teaching users how to use Pyodide and for the @@ -1576,7 +1577,7 @@ Pyodide, https://github.com/hoodmane/cpython/tree/js-ffi Acknowledgments =============== -Mike Droettboom, Roman Yurchak, Gyeongjae Choi, Andrea Giammarchi, Thorsten Beier +Mike Droettboom, Roman Yurchak, Gyeongjae Choi, Andrea Giammarchi, and Thorsten Beier. Copyright ========= From 5c2e4203b503de8ff113482511410bd00558bfef Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Thu, 1 Oct 2026 12:15:40 -0700 Subject: [PATCH 3/4] More stanfromireland nits --- peps/pep-0818.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/peps/pep-0818.rst b/peps/pep-0818.rst index c3d87d35a93..0f5840d0353 100644 --- a/peps/pep-0818.rst +++ b/peps/pep-0818.rst @@ -7,7 +7,8 @@ Status: Draft Type: Standards Track Created: 10-Dec-2025 Python-Version: 3.16 -Post-History: `05-Jan-2026 `__ +Post-History: `01-Oct-2026 `__, + `05-Jan-2026 `__ Abstract @@ -65,7 +66,7 @@ interface. In order to keep the length of this PEP reasonable, we focus on the "core" of the foreign function interface. The JavaScript interface for managing the Python -runtime is left to a future pep. +runtime is left to a future PEP. Rationale From 023007a7ca684c135c3f01ed297911156654f038 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Thu, 1 Oct 2026 12:22:31 -0700 Subject: [PATCH 4/4] Post history in chronological order --- peps/pep-0818.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/peps/pep-0818.rst b/peps/pep-0818.rst index 0f5840d0353..12fd5a6938a 100644 --- a/peps/pep-0818.rst +++ b/peps/pep-0818.rst @@ -7,8 +7,8 @@ Status: Draft Type: Standards Track Created: 10-Dec-2025 Python-Version: 3.16 -Post-History: `01-Oct-2026 `__, - `05-Jan-2026 `__ +Post-History: `05-Jan-2026 `__, + `01-Oct-2026 `__ Abstract