
Modern Python: Async, Type Hints, and Pyright in Practice
How async/await, structured typing, and a strict type checker turn Python from scripting glue into a serious application platform.
Python today barely resembles the language most engineers first learned. Native coroutines, structural pattern matching, parameterised generics, and a thriving static analysis ecosystem have pushed it well beyond its scripting origins. The trick is using those tools consistently rather than as a sprinkle on top of legacy code.
Async rewards services that spend most of their time on the network. Database drivers, HTTP clients, and message queues all have first-class async implementations now, and a properly structured asyncio service can hold thousands of concurrent connections on a single process without the overhead of threads.
Type hints are not optional in a serious codebase. Pyright in strict mode catches the entire class of bugs that integration tests historically had to chase. Treat the type checker as a compiler — green pull requests must pass it, and any 'type: ignore' should come with a comment explaining why.
Lean into the standard library before reaching for dependencies. dataclasses, pathlib, contextlib, and the new tomllib cover most of what teams used to install third-party packages for. Smaller dependency graphs mean fewer supply-chain risks and shorter cold starts.
Finally, package the runtime. uv and pip-tools have made reproducible environments boring, which is exactly what production deserves. A pinned lockfile and a small base image will outperform clever optimisation tricks every time.