Skip to main content
  • Book
  • © 2019

asyncio Recipes

A Problem-Solution Approach

Apress
  • A hands-on guide focused on explaining asyncio internals and developing working applications
  • Entry-level coverage of asyncio that presumes experience with Python fundamentals and ramps up quickly
  • Includes illustrative examples and full-chapter labs to challenge readers' understanding of concepts
  • 9427 Accesses

Buy it now

Buying options

eBook USD 29.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book USD 37.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Other ways to access

This is a preview of subscription content, log in via an institution to check for access.

Table of contents (10 chapters)

  1. Front Matter

    Pages i-xxvi
  2. Preparing for the Recipes

    • Mohamed Mustapha Tahrioui
    Pages 1-4
  3. Working with Event Loops

    • Mohamed Mustapha Tahrioui
    Pages 5-48
  4. Working with Coroutines and Async/Await

    • Mohamed Mustapha Tahrioui
    Pages 49-75
  5. Working with Async Generators

    • Mohamed Mustapha Tahrioui
    Pages 77-95
  6. Working with Async Context Manager

    • Mohamed Mustapha Tahrioui
    Pages 97-112
  7. Communication Between Asyncio Components

    • Mohamed Mustapha Tahrioui
    Pages 113-145
  8. Synchronization Between Asyncio Components

    • Mohamed Mustapha Tahrioui
    Pages 147-164
  9. Improving Asyncio Applications

    • Mohamed Mustapha Tahrioui
    Pages 165-205
  10. Working with Network Protocols

    • Mohamed Mustapha Tahrioui
    Pages 207-253
  11. Preventing Common Asyncio Mistakes

    • Mohamed Mustapha Tahrioui
    Pages 255-291
  12. Back Matter

    Pages 293-315

About this book

Get the most out of asyncio and find solutions to your most troubling Python programming problems. This book offers a pragmatic collection of recipes by going beyond online resources and docs to provide guidance on using this complex library. As such, you’ll see how to improve application performance and run computationally intensive programs faster.


asyncio Recipes starts with examples illustrating the primitives that come with the asyncio library, and explains how to determine if asyncio is the right choice for your application. It shows how to use asyncio to yield performance gains without multiple threads, and identifies common mistakes and how to prevent them. Later chapters cover error-handling, testing, and debugging. By the end of this book, you'll understand how asyncio runs behind the scenes, and be confident enough to contribute to asyncio-first projects.


What You Will Learn
  • Discover quirky APIs such as the event loop policies
  • Write asyncio code with native coroutines  
  • Use the ast module to find legacy asyncio code
  • Work with contextvars 
  • See what a async context manager is and why a lot of asyncio APIs use them



Who This Book Is For


Experienced Python developers or hobbyists who want to understand asyncio and speed up their applications by adding concurrency to their toolkit.


Authors and Affiliations

  • Darmstadt, Germany

    Mohamed Mustapha Tahrioui

About the author

Mohamed Mustapha Tahrioui has been a programmer for seven years and currently serves as a senior software engineer at axxessio, where he works as a team lead on asyncio heavy projects, utilizing his expertise for backward compatible architecture and implementation. He also offers full stack development via his IT consultancy Pi Intelligence, using Python, Java, JavaScript, Docker, PostgreSQL, MongoDB, and more.

Said El Mallouki is a textbook computer geek with decades of experience designing and developing enterprise IT systems. His early encounters with the internals of computers took place at IBM's production facility in Germany more than two decades ago. In his current occupation as a technology lead, he works on innovative, cutting edge projects.

The intricacies of complex distributed systems have always been on the top of his interest list. With three degrees in IT, business, and marketing, he combines a solid theoretical foundation with plenty ofreal-life experience.

He lives by the Rhine in Germany with his wife Andrea and their 18-month-old son, Felix. His current favorite leisure activity is to be a devoted father.


Bibliographic Information

Buy it now

Buying options

eBook USD 29.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book USD 37.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Other ways to access