Python Asyncio Jump-Start
Asynchronous Programming And Non-Blocking I/O With Coroutines
Asyncio is an exciting new addition to Python.
It allows regular Python programs to be developed using the asynchronous programming paradigm.
It includes changes to the language to support coroutines as first-class objects, such as the
async def and
await expressions, and the lesser discussed
async for and
async with expressions for asynchronous iterators and context managers respectively.
Asyncio is the way to rapidly develop scalable Python programs capable of tens or hundreds of thousands of concurrent tasks.
Developing concurrent programs using coroutines and the
asyncio module API can be very challenging for beginners, especially those new to asynchronous programming.
Introducing: "Python Asyncio Jump-Start". A new book designed to teach you asyncio in Python, super fast!
You will get a rapid-paced, 7-part course focused on getting you started and make you awesome at using asyncio.
- How to define, schedule, and execute asynchronous tasks as coroutines.
- How to manage groups of asynchronous tasks, including waiting for all tasks, the first that, or the first task to fail.
- How to define, create, and use asynchronous iterators, generators, and context manages
- How to share data between coroutines with quests and how to synchronize coroutines to make code coroutine-safe.
- How to run commands as subprocesses and how to implement asynchronous socket programming with streams.
- How to develop a port scanner that is nearly 1,000 times faster than the sequential version.
Each of the 7 lessons was carefully designed to teach one critical aspect of asyncio, with explanations, code snippets, and complete examples.
Each lesson ends with an exercise for you to complete to confirm you understood the topic, a summary of what was learned, and links for further reading if you want to go deeper.
Table of Contents:
Lesson 01: Asyncio Concurrency
- What are Coroutines
- What is Asynchronous Programming
- Welcome to Asyncio
- Asyncio Hello World Example
- When to Use Asyncio
Lesson 02: Coroutines and Tasks
- How to Create and Run Coroutines
- How to Create and Run Tasks
- How to Use Asyncio Tasks
Lesson 03: Collections of Tasks
- How to Run Many Tasks as a Group
- How to Wait for Many Tasks
- How to Wait for a Task With a Timeout
- How to Handle Tasks in Completion Order
- How to Run Blocking Tasks
Lesson 04: Iterators, Generators, and Context Managers
- How to Use Asynchronous Iterators
- How to Use Asynchronous Generators
- How to Use Asynchronous Context Managers
Lesson 05: Queues and Synchronization Primitives
- What is Coroutine-Safe
- How to Share DataBetweek Coroutines with Queues
- How to Protect Critical Sections with a Mutex Lock
- How to Limit Access to a Resource with a Semaphore
- How to Signal Between Coroutines Using an Event
- How to Coordinate Using a Condition Variable
Lesson 06: Subprocesses and Streams
- How to Run Commands in Subprocesses
- How to Use Non-Blocking I/O Steams
Lesson 07: Port Scanner Case Study
- Develop an Asyncio Port Scanner
- How to Open a Socket Connection on a Port
- How to Scan a Range of Ports on a Server (slow)
- How to Scan Ports Concurrently (fast)
- How to Report Scan Results Dynamically
Stop copy-pasting code from StackOverflow answers.
Learn Python concurrency correctly, step-by-step.
Learn more about this book here:
How to Buy
- Click the "I want this!" button (in the upper right)
- Choose Credit Card or PayPal and complete the order form then click the "Pay" button.
- You will be redirected to a webpage where you can download your bundle immediately (you will also get an email with the download link, just in case you need it).
About the Author
Jason Brownlee, Ph.D. helps Python developers bring modern concurrency methods to their projects with hands-on tutorials.
Jason loves Python Concurrency. It's all he does. It’s his main thing.
- Read all the books on Python concurrency.
- Used all of the Python concurrency APIs in the standard library.
- Written 500+ tutorials and 12+ books on Python concurrency.
Learn more at SuperFastPython.com
Jason is a software engineer and research scientist with a background in artificial intelligence and high-performance computing. He has authored more than 20 technical books on machine learning and has built, operated, and exited online businesses.
See his linkedin profile here:
- Jason Brownlee on LinkedIn (follow him!)
Hi, Jason here, do you have any questions?
Contact me directly at any time about this product or Python concurrency generally. I'm here to help as best I can.
You can send an email directly to my inbox via:
You'll get a .zip download containing both ebook formats (pdf and epub) and all .py code files.