v2.13.0b3 2026-03-31
Pre-release
Pre-release
What's Changed
Packaging
New Features
- Add
ascii_onlyoption toStringConstraintsby @ai-man-codes in #12907 - Support
exclude_ifin computed fields by @andresliszt in #12748 - Push down constraints in unions involving
MISSINGsentinel by @Viicos in #12908
Changes
- Track extra fields set after init in
model_fields_setby @navalprakhar in #12817 - Do not include annotations that are not part of named tuple fields by @galuszkak in #12951
- No longer fall back to trying all union members when the variant selected by discriminator fails to serialize by @navalprakhar in #12825
Fixes
- Support discriminator metadata outside union type alias by @Viicos in #12785
- Respect
extras_schemawhen onlyextra_fields_behavioris set on the config in JSON Schema generation for typed dictionaries by @Viicos in #12810 - Ensure
__pydantic_private__is set inmodel_construct()with user-definedmodel_post_init()by @nightcityblade in #12816 - Handle all schema generation errors in
InstanceOfby @Viicos in #12705 - Allow dynamic models created with
create_model()to be used as annotations in the Mypy plugin by @Br1an67 in #12879 - Check for
PlaceholderNodein Mypy plugin by @Viicos in #12929 - Try other branches in smart union in case of omit errors by @mikeedjones in #12758
- Patch unset attributes with
MISSINGduring model serialization withexclude_unsetby @davidhewitt in #12905 - Ensure custom
__init__()is called when usingmodel_validate_strings()by @siewcapital in #12897
New Contributors
- @kelsonbrito50 made their first contribution in #12860
- @boosterl made their first contribution in #12723
- @adityagiri3600 made their first contribution in #12868
- @navalprakhar made their first contribution in #12817
- @Br1an67 made their first contribution in #12879
- @rmorshea made their first contribution in #12910
- @N3XT3R1337 made their first contribution in #12922
- @ai-man-codes made their first contribution in #12907
- @Yume05-dev made their first contribution in #12953
- @galuszkak made their first contribution in #12951
- @siewcapital made their first contribution in #12897
Full Changelog: v2.13.0b2...v2.13.0b3