Taking Asynchronous Python to the Next Level Using Trio
summary
Claims that Trio makes async code safer and easier to reason about through structured concurrency with nurseries and cancel scopes and demonstrates concrete tools and outcomes: nurseries for scoped task lifetimes, checkpoints for cooperative switching, cancel scopes for timeouts that reliably cancel work, and exception groups that aggregate simultaneous failures. Examples build an SSL stream chat server, async file and DB operations, and a web scraper using run_sync and trio-asyncio bridging. Demos show clean shutdown, predictable error propagation, and interop with existing asyncio code.
AI-written summary · about
chapters (24)
- 0:00Trio and async Python intro
- 1:30Trio design principles
- 3:15Nurseries and task spawning
- 5:00Checkpoints and multitasking
- 6:51Exception groups and errors
- 8:16Timeouts and cancellation
- 10:24Cancellation in Trio
- 12:31Semaphores and channels sync
- 14:25Stream and network I/O
- 16:33Trio vs asyncio
- 19:43Error handling differences
- 22:52Trio vs asyncio design
- 25:27Integrating Trio with code
- 26:55Trio-asyncio bridge
- 28:422023-2024 Trio updates
- 31:10Thread and task improvements
- 34:02Exception group testing
- 35:31TypeVar type checking
- 37:43Nursery exit behavior
- 39:49Thread and task context
- 41:57Guest run init refinements
- 44:06Named threads in Trio
- 44:50Key takeaways
- 45:53Q&A
related talks
37mTaking Asynchronous Python to the Next Level Using Trio
32mTrio: Async concurrency for mere mortals
15mEvent-Driven asyncio: A Case Study of Trio's API
30m"Asyncio by Example"
30mLet's get you started with asynchronous programming
26mWhy I reimplemented Trio in a game engine
01h 21mTUTORIAL: Async Python, Good it is
01h 00mCoroutine Concurrency in Python 3 with asyncio
