Company
Date Published
Author
Sydney Runkle
Word count
1365
Language
English
Hacker News points
None

Summary

Pydantic v2.7 introduces significant updates, focusing on performance enhancements and new features, with contributions from over 30 new contributors. Key features include partial JSON parsing, which allows processing of incomplete JSON objects, particularly beneficial for handling outputs from Large Language Models, and the introduction of a generic Secret base type for creating custom secret types. Additionally, a long-requested feature to mark fields as deprecated has been added, alongside the reintroduction of duck typing for serialization as an opt-in feature via the new serialize_as_any flag. Another notable enhancement is the ability to pass context during serialization, allowing for dynamic data transformations such as unit conversion. Performance improvements are achieved through the integration of PyO3 0.21, SIMD instructions for ARM platforms, optimized enum validation and serialization, faster ASCII Python string creation, and configurable caching for Python strings during JSON parsing, collectively making this release the fastest and most feature-rich version of Pydantic to date.