Talk

The hitchhiker's guide to asyncio

Friday, May 26

16:05 - 16:35
RoomRisotto
LanguageEnglish
Audience levelIntermediate
Elevator pitch

Want to improve your understanding of asyncio? This talk is for you. We present the event loop, coroutines, tasks, async loops and context manager, describing their implementation in python and asyncio. Then, we provide practical tips about how to use async primitives in python applications.

Abstract

asyncio is the de-facto standard for asynchronous programming in Python and enables concurrent operations without using threads or processes.

In this talk, we will delve into the technical details of asyncio and show how it can be used to improve the performance of Python applications. We will start by discussing the difference between threading, multiprocessing and async programming. Then, we will introduce the basic building blocks of asyncio: Event loops and Coroutines. We will dive deep into the way Coroutines work, discussing their origins and how they are linked to Generators.

Next, we will look at Tasks, which are a higher-level abstraction built on top of Coroutines. Tasks make it easy to schedule and manage the execution of Coroutines. We will cover how to create and manage Tasks and how they can be used to write concurrent code.

Finally, we will also cover some more advanced topics such as Async Loops and Context Managers, and how to handle errors and cancellations in asyncio.

Whether you are new to asyncio or have experience with it, this talk will provide valuable insights and tips for leveraging its full potential. By the end of this talk, you will have a better understanding of how asyncio works, and how to use it to create efficient, high-performing Python applications.

TagsAsyncIO, Performance, Best Practice, Clean Code
participant photo

Fabbiani

Engineer by education, Data Scientist by choice, researcher and lecturer by passion.

During my PhD in ML, I got invited to EPFL Lausanne for a 6-month visit and published 9 papers in top journals.

I am co-founder of xtream, an ML boutique applying academic research to business problems - with the help of some Python magic.

Contributing to the community is part of our mission: I was a speaker and track organizer at eRum, AMLD and I lectured at Italian, Swiss, and Polish universities.