Python Performance, Pydantic V2 and Better Configs
Python 3.11 Performance Improvements
The Specialist Project
• The episode highlights specialist, a visualization tool by Brant Boucher that tracks how CPython 3.11’s new speculative specializing adaptive interpreter optimizes code.
• The interpreter gains speed through the quickening process, replacing slow, generic instructions with faster, type-specific ones.
• Specialist provides actionable insights by color-coding code regions: green indicates successful specialization, while red indicates missed opportunities for optimization.
Configuration and Data Tools
TOML and Tomli
• With PEP 680 introducing tomllib into the Python standard library for version 3.11, the ecosystem is rapidly adopting Tomli for configuration.
• The hosts discuss a Real Python article detailing how to leverage TOML for config files, noting its support for Unicode (including emojis) and human-readable table structures.
Pydantic Version 2 Roadmap
• Samuel Colvin released an ambitious roadmap for Pydantic V2, which includes a full rewrite of its internals in Rust.
• The update promises significant performance gains, with validation speeds projected to be 4 to 50 times faster than V1.
• Important changes include a new strict mode for data validation, the removal of legacy methods like parse_file, and a transition to a pure Python package wrapper around the Pydantic Core Rust binary.
PDF Management with PikePDF
• PikePDF is recommended for high-performance PDF reading and modification.
• Unlike libraries that shell out to external system tools, it is built on QPDF (C++), offering efficiency for merging, splitting, and extracting content from PDF files.
Community and Ecosystem
"Test your code where it counts, don't optimize everything—profile first."
• The discussion closes with a look at popular PyPI packages, emphasizing the prevalence of pytest plugins and the impact of the Microsoft for Startups Founders Hub program for early-stage developers.