This is an attempt at building an asyncio compatible event loop that is multithreaded. I.e. you will finally be able to use asyncio and actually have it be multithreaded ! I've written a blog post explaining more about the why and how of this project.
The goal here isn’t to create a production-ready or high-performance multithreaded alternative to asyncio. This is just a chance to explore the idea, share what I learn, and get a basic FastAPI server running with this multithreaded async setup.
The only thing you'll need is the free threaded Python 3.13 release. I recommend using pyenv to get it.
pyenv install 3.13t-dev
Then you can just install this package by running the following from the top level of the git repo:
pip install -e .
I have a couple of scripts in the tests folder that you can use to test out basic functionality as well as a basic fastapi server. Feel free to submit more interesting tests as PR's and open issues that you come across. I won't commit to fixing them, but it'll be useful to others looking at this.
tests/basic.py
: contains a simple async function, with sleeping andasyncio.gather
tests/get_request.py
: contains an example async GET request withhttpx
tests/listen.py
: contains sample code for listening for incoming connections in an async manner