News for hackers. Stuff that matters.
Re:How to choose the right Python concurrency API by O5vYtytb on Wednesday August 10, 2022 @09:36AM (#32411671)
I will say that structured concurrency (coroutine based) via Trio/Anyio is, in my experience, so much better for most applications that can support it. Reasoning/testing threading code is so impossible once a project gets large enough. I'd highly recommend reading https://vorpus.org/blog/notes-on-structured-concurrency-or-g...

I work with trio/anyio on a daily basis for my job, and I'd always recommend people use it for their concurrency framework and then use await anyio.to_thread.run_sync() to spawn threads if needed.

I'll also add that if you need multi-processor execution, look at https://pypi.org/project/tractor/

Re:How to choose the right Python concurrency API by infinite8s on Wednesday August 10, 2022 @10:44AM (#32412855)
+1 for trio. I used it in a past job to proxy a socket-based API to websockets and it was easy to write and debug.

Tractor is also architected similar to Erlangs OTP system, which trio with it's structured concurrency makes easy to reason about.