Preface
Python is a versatile and popular programming language. Its adoption has been underpinned by the community-led development of a large number of powerful and well-documented libraries, with the result that it is now widely used across a variety of domains including data science, data engineering, scientific computing, artificial intelligence and more.
In many application domains, the scalability and performance of Python-based solutions can be significantly boosted by applying asynchronous programming techniques – so much so that it could be argued that asynchronous programming is now essential for modern Python development. By allowing multiple operations to run simultaneously it can dramatically reduce execution time, especially for I/O-bound tasks, enabling solutions to handle increasing demands efficiently.
Nevertheless, not all workloads lend themselves to processing by asynchronous methods; for some tasks performance penalties may be incurred, or solutions just become more complicated than necessary. The effective application of asynchronous programming techniques therefore requires the developer to possess a secure understanding of the basic underlying concepts, and knowledge of how constraints on the application of asynchronous approaches come about. The aim of this book is to give you, the reader, that knowledge and understanding, so that you can make effective use of the power of asynchronous programming in your own projects.
The book effectively consists of two blocks of chapters. In Chapters 1 to 6 we look at asynchronous programming fundamentals and core mechanisms like asyncio and Trio, and also consider various pitfalls and their avoidance, and how to measure and test our asynchronous solutions. Then in Chapters 7 to 10 asynchronous techniques are applied to real-world scenarios involving web frameworks, databases, data pipelines, and simulations.