Contribute Media
A thank you to everyone who makes this possible: Read More

Async the Easy Way: scaling structured concurrency with static and dynamic analysis

Description

Async python is a relatively recent addition to Python’s longstanding concurrency options of processes and threads - and offers a very different programming experience. Where processes run independently and threads switch at the whim of the kernel scheduler, async tasks take a different tradeoff: managing shared state is as easy as in single-threaded synchronous Python, but it’s on you to ensure that there are enough await, async for, and async with statements where tasks can switch to make steady progress.

In this talk, we’ll explore the advantages of structured concurrency - especially error handling, timeouts, cancellation, and readable code - and both convenient and reliable ways to mitigate the problems of cooperative concurrency (when one uncooperative slow task can bring your whole program to a halt). I’ll introduce you to static analysis with flake8-trio and explain how to write your own AST-based tools, and show how dynamic analysis can help us catch anything that slips past that quick and convenient check.

With a system like this in place, you don’t have to be an experienced or paranoid software engineer to write beautiful async code - to serve or scrape a website, control a bundle of processes, or write a game - it just reads like normal Python, and your tools will catch you if you fall.

Details

Improve this page