Python Byte 330: Pydantic V2, MicroDot and Python Speed

·34m 25s
Shared point

Episode Overview

This episode of Python Bytes, hosted by Michael Kennedy and Brian Akin, dives into the latest developments in the Python ecosystem. From significant performance upgrades in core libraries to new tools for small-scale web applications and improvements in CI/CD workflows, this episode covers essential updates for developers.

Key Technical Highlights

Pydantic V2

• The highly anticipated Pydantic V2 has reached its alpha-1 release stage.
• Key technical changes include the migration of logic to Pydantic Core, a module primarily written in Rust, leading to performance improvements of 5 to 50 times.
• This update introduces more flexibility in base model interactions, better support for strict modes, and refined data validation.

"The big news is alpha one's available... One of the big changes was to move a lot of Pydantic and the rules and everything into a different module called Pydantic Core. That one's mostly written in Rust."

MicroDot: The Lightweight Web Framework

• Created by Miguel Grinberg, MicroDot is an extremely lightweight web framework for MicroPython and CircuitPython.
• It mimics the Flask API but remains efficient enough to run on tiny hardware devices.
• It supports async/await concurrency natively and can even run on CPython, which opens doors for memory-efficient deployments in Docker containers.

GitHub Actions Improvements

• The hosts discussed three tools to enhance automation:
WatchGHA: A CLI tool by Ned Batchelder to monitor workflow progress.
Enix Build & Inspect: Simplifies linting and artifact validation for Python packages.
PyTest GitHub Actions Annotate Failures: Automatically annotates failing tests within the GitHub Actions interface.

The Future of Comprehensions (PEP 709)

PEP 709 proposes inlining list, dictionary, and set comprehensions.
• Currently, these are compiled as nested functions, creating overhead. Inlining them promises up to 2x faster execution by removing the need for extra stack frames and function call objects.

Topics

Chapters

5 chapters
Python Bytes
AI chat — answers grounded in episodes