r/Python • u/CongZhangZH • Mar 01 '26
Discussion Seeking a CPython internals expert to land asyncio Guest Mode (PR #145343) together
Hi everyone,
I’ve put significant research into building a Guest Mode for asyncio to natively integrate with any OS or GUI event loop.
The architecture is solid and my PR is open. I really want to contribute this to the community because it solves a major integration pain point.
However, I’ve hit a bottleneck: CPython core devs are asking deep questions that exceed my current knowledge of Python internals.
I'm looking for an expert in CPython internals to team up, help answer these specific questions, and get this merged.
PR: github.com/python/cpython/pull/145343
POC: github.com/congzhangzh/asyncio-guest
Ref: https://www.electronjs.org/blog/electron-internals-node-integration
Please DM me if you can help push this over the finish line!
View all comments
Show parent comment
-4
u/CongZhangZH Mar 01 '26 edited Mar 01 '26
It worked well in my past tests: https://github.com/congzhangzh/webview_python/tree/main/examples/async_with_asyncio_guest_run
Initially, I tried hooking directly into libuv or another event loop, but I later realized the event loop model is transparent to my solution.
Rather than relying on a standalone
_run_oncetick, the abstraction my solution actually depends on isselect. For instance, the Windows IOCP proactor just relies on its internal implementation under the hood."https://github.com/python/cpython/blob/6c417e44c995eb57e8266e18eb8aeeb2ba0e61ac/Lib/asyncio/base_events.py#L1977 asyncio design just depend on the base High level _run_once?
https://github.com/python/cpython/blob/6c417e44c995eb57e8266e18eb8aeeb2ba0e61ac/Lib/asyncio/base_events.py#L2019 _run_once just depend on _select.select which is transparent for different implementation like select or IOCP
https://github.com/python/cpython/blob/6c417e44c995eb57e8266e18eb8aeeb2ba0e61ac/Lib/asyncio/windows_events.py#L444 Iocp select which depend on it's internal _poll
https://github.com/python/cpython/blob/6c417e44c995eb57e8266e18eb8aeeb2ba0e61ac/Lib/asyncio/windows_events.py#L762 _poll which depend on I/O completion ports