Posted by willm 9/2/2025
The bug has been open for 2 years, with zero fucks given. The workaround is "just use libuv": https://github.com/encode/uvicorn/issues/2167
I've seen other such cases, and I just gave up on trying to use async.
async is popular in JS because the browser is often waiting on many requests.
command-line tools are commonly computing something. even grep has to process the pattern matching so concurrent IO doesn't help a single-threaded pattern match.
Sure there are applications where async would help a CLI app, but there are fewer than JS.
Plus JS devs love rewriting code very 3 months.
The vast majority of the Python code I wrote in the last 5-6 years uses asyncio, and most of the complaints I see about it (hard to debug, getting stuck, etc.) were -- at least in my case -- because there were some other libraries doing unexpected things (like threading or hard sleep()).
Coming from a networking background, the way I can deal with I/O has been massively simplified, and coroutines are quite useful.
But as always in HN, I'm prepared for that to be an unpopular opinion.
asyncio is easier than threads or multiprocess: less locking issue, easier to run small chunks of code in // (easier to await something than to create a thread that run some method)
I would just rather write JS where everything is async by default.
In JS you can do:
async function foo(){...}
function bar(){foo().then(...);}
In python though async and sync code runs in a fundamentally different way as far as I understand it.Anyway I think the main difference is that in Python you control the event loop whereas in JS there's one fixed event loop and you have no choice about it.