Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Python Asyncio: High-level API
Rating: 4.2 out of 5(93 ratings)
403 students

Python Asyncio: High-level API

Python asynchronous programming using AsyncIO module
Last updated 3/2024
English

What you'll learn

  • How to use Python Asyncio module
  • Understanding of Python asynchronous programming base tools
  • Understanding of Python async with, async for, async/await syntax, etc.
  • How to use Queues, synchronization tools, etc.

Course content

1 section18 lectures3h 12m total length
  • Introduction7:36

    What is asynchronous programming and what issues it solves. What is async/await keywords.

  • Coroutines7:48

    What are coroutines, how to create, and call them

  • Tasks: creating and cancelling12:41

    What are tasks, how to create, use, and cancel them

  • Non-obvious issues, how the run() works4:36

    Demonstration of some non-obvious issues of how the run() function works.

  • Asynchronous Context Managers and async with syntax8:33

    We will look at implementation of context managers, and we will write an Asynchronous Context manager

  • Using the .gather() function to run groups of tasks11:34

    How to use the gather() to run coroutines, and gather their results

  • Non-obvious issues #2 - understanding of await6:27

    Demonstration of non-obvious issues when using await keyword.

  • Using TaskGroup() class to run groups of tasks, and except* syntax11:29

    The TaskGroup() class was introduced in Python 3.11 how to use it, and its features.

  • Tasks cancelling: gather() vs TaskGroup()12:30

    In this video, we'll explore the differences in task cancellation when using the gather() function versus the TaskGroup() class.

  • Asynchronous iterators and async for syntax9:38

    How to create a class which implements the iteration protocol to use with async for syntax.

  • Asynchronous comprehensions (list, dict, set)4:33

    How to use asynchronous comprehensions to generate lists, dicts, sets

  • Asynchronous Generators and Context Managers (again)7:15

    Main use case of generators is creating of context managers using the contextlib module, and @contexmanager decorator. In this video we'll look at creating of async context managers using the @asynccontexmanager decorator

  • Queues and Producer-Consumer pattern22:53

    What is Queue as a data structure, how to use queues, and what is the Producer-Consumer pattern

  • Queues: practical example of async crawler27:51

    In this video we will write an asynchronous crawler that will download images.
    This crawler will use 3 different queues to store intermediate results.

  • Coroutine synchronization and Lock()14:49

    What is the synchronization of coroutines and why do we need sometimes to use it.
    The first synchronization primitive - Lock() class

  • Semaphore() class and the requests rate limiter example8:29

    The second synchronization primitive in AsyncIO - Semaphore() class.
    In this video we will write a requests rate limiting decorator function.

  • Event() class3:56

    Event() - the way to build a notification system for your app, if you need to notify some part of your program about some events.

  • Condition() class10:00

    The last synchronization class - Condition() class, and how to use it

Requirements

  • You need to be quite fluent in basics of Python
  • Basics of OOP, decorators
  • Some experience of using Django/Flask

Description

Dive deep into the realm of asynchronous programming in Python with our comprehensive course on the high-level API of Asyncio. Asynchronous programming is crucial for building efficient, concurrent, and scalable applications, and this course equips you with the knowledge and skills to leverage Asyncio effectively.


You'll start by exploring the fundamentals of asynchronous programming, including coroutines and tasks. Learn how coroutines enable non-blocking operations and how tasks help manage concurrent operations efficiently.


Next, discover the power of asynchronous context managers and the async with syntax for resource management in asynchronous code. Understand how to handle groups of tasks seamlessly using the TaskGroup() class and the gather() function, enabling you to coordinate and execute multiple asynchronous operations concurrently.


Gain proficiency in working with asynchronous iterators and the async for syntax, allowing you to iterate over asynchronous sequences effortlessly. Explore the capabilities of asynchronous comprehensions for creating asynchronous sequences efficiently.


Delve into asynchronous generators to create asynchronous context managers easily. Learn how to utilize asynchronous queues for communication and data exchange between asynchronous tasks in a thread-safe manner.


Finally, understand the importance of synchronization mechanisms such as Lock, Semaphore, Event, and Condition for coordinating access to shared resources and ensuring thread-safe execution of coroutines.


By the end of this course, you'll be equipped with the expertise to design and implement robust, concurrent Python applications using the high-level API of Asyncio. Take your asynchronous programming skills to the next level and unlock new possibilities in Python development.



Topics

- what are coroutines and tasks

- asynchronous context managers, async with syntax

- groups of tasks using TaskGroup() class and gather() function.

- asynchronous iterators and async for syntax

- asynchronous comprehensions

- asynchronous generators

- asynchronous queues

- synchronization of coroutines using Lock, Semaphore, Event, Condition

Who this course is for:

  • Intermediate or Advanced Python developers