What's Changed
This is the first beta release of the 2.14 version, providing some new features and performance improvements for model builds.
This release is the first to provide initial support for Python 3.15, although not all 3.15 specific features are supported yet.
Packaging
New Features
- Add support for
EllipsisTypeby @Viicos in #13484 - Add initial support for Python 3.15 by @Viicos in #13587
Changes
- Populate
__slots__from generic class during parameterization by @Viicos in #13243 - Avoid using explicit
Anyin the Mypy plugin by @Viicos in #13196 - Support
Fractiontype inpydantic-coreby @Viicos in #13339 - Use constant-time comparison for
SecretStrandSecretBytestypes by @Viicos in #13518 - Fix application of constraints in pipeline API by @Viicos in #13516
- Optimize type lookup logic in core schema generation by @Viicos in #13573
- Add a
named-tuplecore schema by @Viicos in #13505 - Raise explicit
TypeErroron invalidindex_keyserialization wrap handler by @Viicos in #13506
Performance
- Cache
ModelPrivateAttr.default_factory_takes_validated_dataproperty by @Viicos in #13390 - Introduce micro-optimizations for model class building by @dmontagu in #13540
- Try
Format.VALUEbeforeFORWARDREFwhen evaluating annotations inModelMetaclassby @Viicos in #13584 - Optimize type lookup logic in core schema generation by @Viicos in #13573
- Avoid exponential core schema traversal in
gather_schemas_for_cleaning()by @dmontagu in #13523
Fixes
- Validate falsy
AliasGeneratoroutputs by @jiyujie2006 in #13248 - Do not resolve recursive
'definitions-ref'schemas in schema cleaning by @Viicos in #13276 - Fix missing
max_lengthcheck on lazy iteration validation by @davidhewitt in #13278 - Handle missing errors with default factories taking validated data by @Viicos in #13291
- Recognise
WindowsPathas a schema type by @davidhewitt in #13326 - Fix application of nested operators in pipeline API by @Viicos in #13363
- Fix type variable substitution in
__pydantic_extra__by @Viicos in #13391 - Fix
json_schema_extradict being dropped when a callable follows it inAnnotatedby @Srivatsa03 in #13374 - Skip
RootModel.__init__()in Mypy plugin by @Viicos in #13441 - Defer placeholders in Mypy plugin by @Viicos in #13442
- Do not ignore timezone offset when using
'seconds'/'milliseconds'temporal_modeby @Viicos in #13436 - Make model rebuilding logic thread safe by @Viicos in #13438
- Fix
Intervalzero bounds silently dropped in pipeline API by @pctablet505 in #13452 - Sync
RootModel.model_dump()signature with its parent by @Viicos in #13456 - Return
NotImplementedfrom URL ordering comparisons with foreign types by @chinesepowered in #13495 - Don't error on unhashable generic arguments on generic Pydantic models by @Viicos in #13515
- Fix population of
SerializationInfo.exclude_computed_fieldsby @Viicos in #13560 - Fix serialization of
ValidateAsby @Viicos in #13487 - Allow reuse of validators when plugins are set by @Viicos in #13535
- Avoid double-wrapping polymorphism trampoline for model serializers by @davidhewitt in #13552
- Add
AllowInfNantype to the field metadata gathering by @mberdyshev in #13586
New Contributors
- @jiyujie2006 made their first contribution in #13248
- @pctablet505 made their first contribution in #13452
- @LuShadowX made their first contribution in #13503
- @mberdyshev made their first contribution in #13586
Full Changelog: v2.14.0a1...v2.14.0b1