Pydantic V2 Launch, Tox Benchmarks, and Python CLIs

·35m 51s
Shared point

Pydantic Version 2 Released

The most significant announcement in this episode is the release of Pydantic V2. After a year-long rewrite with internals converted to Rust for enhanced performance, the library is now officially available. Key highlights include:

Significant Speed Boosts: Pydantic V2 delivers substantial performance improvements over version 1.
Migration Tools: A bump-pydantic tool has been released to help automate the upgrade process, such as converting older methods like .dict() to .model_dump().
New Capabilities: The introduction of a TypeAdapter allows for improved validation and serialization of non-base model types.
Ecosystem Integration: FastAPI has already been updated to support Pydantic V2, and other projects like Beanie are following suit quickly.

Optimizing Development Workflows

Tox Performance

Brian discussed how to optimize Tox for faster test runs:
Avoid Redundant Builds: Instead of building source distributions for every environment, build a single wheel and reuse it across all test environments.
Parallel Test Execution: Utilizing plugins like pytest-xdist to run tests in parallel, especially for CPU-intensive suites (e.g., those using hypothesis), can lead to nearly 5x speed improvements.

Hidden CLI Tools

Exploring hidden gems within the Python Standard Library, the hosts discussed:

"There are a whole bunch of other things that you can do with it, but it's pretty neat, kind of fun."

Standard Library CLI Utilities: Using python -m <module> allows users to access powerful tools like gzip for decompressing files, http.server for quick static sites, and json.tool for pretty-printing data without installing third-party packages.

Additional News and Community Updates

Security: Congratulations to Seth Larson, who has been named the new Python Security Developer in Residence.
Meta's Commitment: Meta has pledged significant engineering resources over the next three years to help remove the Global Interpreter Lock (GIL) from CPython.
New Podcast: Brian introduced Python People, a new show dedicated to exploring the lives and stories of individuals within the Python community rather than just technical content.

Topics

Chapters

6 chapters
Python Bytes
AI chat — answers grounded in episodes