Async and Modern Python
A three-day training focused on modern Python features and asynchronous programming. Learn to leverage type hints, modern tooling, and asyncio to build high-performance applications.
Duration
3 days (21 hours)
Format
50 percent presentation, 50 percent exercises
Prerequisites
Solid Python fundamentals required
Materials
Virtual machines provided, electronic course materials
Day 1 — Modern Python Essentials
Type Hints and Modern Syntax
- Type annotations: basic types, Optional, Union, generics
- The typing module: TypeVar, Protocol, TypeAlias, ParamSpec
- Dataclasses: fields, post_init, frozen, slots
- Protocols and structural subtyping
- Structural pattern matching: match/case statements, guards, patterns
Modern Tooling
- uv: fast package management and virtual environments
- ruff: lightning-fast linting and formatting
- mypy: static type checking in practice
- pytest: modern testing patterns and fixtures
- Virtual environments and dependency management best practices
Day 2 — Async Fundamentals
The asyncio Event Loop
- Understanding the event loop: how asyncio works under the hood
- Coroutines: async def, await, creating and running coroutines
- Tasks: creating tasks, gathering results, cancellation
- Futures: low-level awaitable objects, callbacks
ASGI and Advanced Async Patterns
- ASGI concepts: the protocol, lifespan events, middleware
- Async context managers: async with, resource management
- Async iterators and generators: async for, yield in async code
- Error handling in async code: exception groups, task groups
- Synchronization primitives: locks, semaphores, events, queues
Day 3 — Real-World Async Applications
Async Libraries and Integration
- HTTP clients: aiohttp and httpx for concurrent requests
- Async database access: asyncpg, aiosqlite, SQLAlchemy async
- Message queues and event-driven patterns
Performance and Debugging
- Performance profiling: identifying bottlenecks in async code
- Debugging async applications: common pitfalls and solutions
- When to use async vs threading vs multiprocessing
Practical Exercises
- Building an async web scraper with rate limiting
- Creating an async API client with retry logic
- Integrating async code with synchronous libraries
