Releases: pydantic/pydantic
v2.12.5 2025-11-26
v2.12.5 (2025-11-26)
This is the fifth 2.12 patch release, addressing an issue with the MISSING sentinel and providing several documentation improvements.
The next 2.13 minor release will be published in a couple weeks, and will include a new polymorphic serialization feature addressing
the remaining unexpected changes to the serialize as any behavior.
- Fix pickle error when using
model_construct()on a model withMISSINGas a default value by @ornariece in #12522. - Several updates to the documentation by @Viicos.
Full Changelog: v2.12.4...v2.12.5
v2.12.4 2025-11-05
v2.12.4 (2025-11-05)
This is the fourth 2.12 patch release, fixing more regressions, and reverting a change in the build() method
of the AnyUrl and Dsn types.
This patch release also fixes an issue with the serialization of IP address types, when serialize_as_any is used. The next patch release
will try to address the remaining issues with serialize as any behavior by introducing a new polymorphic serialization feature, that
should be used in most cases in place of serialize as any.
-
Fix issue with forward references in parent
TypedDictclasses by @Viicos in #12427.This issue is only relevant on Python 3.14 and greater.
-
Exclude fields with
exclude_iffrom JSON Schema required fields by @Viicos in #12430 -
Revert URL percent-encoding of credentials in the
build()method of theAnyUrland Dsn types by @davidhewitt in pydantic-core#1833.This was initially considered as a bugfix, but caused regressions and as such was fully reverted. The next release will include
an opt-in option to percent-encode components of the URL. -
Add type inference for IP address types by @davidhewitt in pydantic-core#1868.
The 2.12 changes to the
serialize_as_anybehavior made it so that IP address types could not properly serialize to JSON. -
Avoid getting default values from defaultdict by @davidhewitt in pydantic-core#1853.
This fixes a subtle regression in the validation behavior of the
collections.defaultdict
type. -
Fix issue with field serializers on nested typed dictionaries by @davidhewitt in pydantic-core#1879.
-
Add more
pydantic-corebuilds for the three-threaded version of Python 3.14 by @davidhewitt in pydantic-core#1864.
Full Changelog: v2.12.3...v2.12.4
v2.12.3 2025-10-17
v2.12.3 (2025-10-17)
What's Changed
This is the third 2.13 patch release, fixing issues related to the FieldInfo class, and reverting a change to the supported after model validator function signatures.
- Raise a warning when an invalid after model validator function signature is raised by @Viicos in #12414.
Starting in 2.12.0, using class methods for after model validators raised an error, but the error wasn't raised concistently. We decided to emit a deprecation warning instead. - Add
FieldInfo.asdict()method, improve documentation aroundFieldInfoby @Viicos in #12411.
This also adds back support for mutations onFieldInfoclasses, that are reused asAnnotatedmetadata. However, note that this is still not a supported pattern. Instead, please refer to the added example in the documentation.
The blog post section on changes was also updated to document the changes related to serialize_as_any.
Full Changelog: v2.12.2...v2.12.3
v2.12.2 2025-10-14
v2.12.2 (2025-10-14)
What's Changed
Fixes
- Release a new
pydantic-coreversion, as a corrupted CPython 3.10manylinux2014_aarch64wheel got uploaded (pydantic-core#1843). - Fix issue with recursive generic models with a parent model class by @Viicos in #12398
Full Changelog: v2.12.1...v2.12.2
v2.12.1 2025-10-13
v2.12.1 (2025-10-13)
What's Changed
This is the first 2.12 patch release, addressing most (but not all yet) regressions from the initial 2.12.0 release.
Fixes
- Do not evaluate annotations when inspecting validators and serializers by @Viicos in #12355
- Make sure
Noneis converted asNoneTypein Python 3.14 by @Viicos in #12370 - Backport V1 runtime warning when using Python 3.14 by @Viicos in #12367
- Fix error message for invalid validator signatures by @Viicos in #12366
- Populate field name in
ValidationInfofor validation of default value by @Viicos in pydantic-core#1826 - Encode credentials in
MultiHostUrlbuilder by @willswire in pydantic-core#1829 - Respect field serializers when using
serialize_as_anyserialization flag by @davidhewitt in pydantic-core#1829 - Fix various
RootModelserialization issues by @davidhewitt in pydantic-core#1836
New Contributors
- @willswire made their first contribution in pydantic-core#1829
Full Changelog: v2.12.0...v2.12.1
v2.12.0 2025-10-07
v2.12.0 (2025-10-07)
Note
Check out the blog post for release highlights. Several minor changes (considered non-breaking changes according to our versioning policy) are also included in this release. Make sure to look into them before upgrading.
Warning
The core functionality of Pydantic V1 is not compatible with Python 3.14 or greater.
This is the final 2.12 release. It features the work of 20 external contributors and provides useful new features, along with initial Python 3.14 support.
Changelog (see the 2.12.0a1 and 2.12.0b1 releases for additional changes since 2.11):
Packaging
New Features
- Add
extraparameter to the validate functions by @anvilpete in #12233 - Add
exclude_computed_fieldsserialization option by @Viicos in #12334 - Add
preverse_empty_pathURL options by @Viicos in #12336 - Add
union_formatparameter to JSON Schema generation by @Viicos in #12147 - Add
__qualname__parameter forcreate_modelby @Atry in #12001
Fixes
- Do not try to infer name from lambda definitions in pipelines API by @Viicos in #12289
- Use proper namespace for functions in
TypeAdapterby @Viicos in #12324 - Use
Anyfor context type annotation inTypeAdapterby @inducer in #12279 - Expose
FieldInfoinpydantic.fields.__all__by @Viicos in #12339 - Respect
validation_aliasin@validate_callby @Viicos in #12340 - Use
Anyas context annotation in plugin API by @Viicos in #12341 - Use proper
stacklevelin warnings when possible by @Viicos in #12342
New Contributors
- @anvilpete made their first contribution in #12233
- @JonathanWindell made their first contribution in #12327
- @inducer made their first contribution in #12279
- @Atry made their first contribution in #12001
Full Changelog: v2.11.10...v2.12.0
v2.12.0b1 2025-10-03
v2.12.0b1 (2025-10-03)
This is the first beta release of the upcoming 2.12 release.
What's Changed
Packaging
New Features
- Add support for
exclude_ifat the field level by @andresliszt in #12141 - Add
ValidateAsannotation helper by @Viicos in #11942 - Add configuration options for validation and JSON serialization of temporal types by @ollz272 in #12068
- Add support for PEP 728 by @Viicos in #12179
- Add field name in serialization error by @NicolasPllr1 in pydantic-core#1799
- Add option to preserve empty URL paths by @davidhewitt in pydantic-core#1789
Changes
- Raise error if an incompatible
pydantic-coreversion is installed by @Viicos in #12196 - Remove runtime warning for experimental features by @Viicos in #12265
- Warn if registering virtual subclasses on Pydantic models by @Viicos in #11669
Fixes
- Fix
__getattr__()behavior on Pydantic models when a property raised anAttributeErrorand extra values are present by @raspuchin in #12106 - Add test to prevent regression with Pydantic models used as annotated metadata by @Viicos in #12133
- Allow to use property setters on Pydantic dataclasses with
validate_assignmentset by @Viicos in #12173 - Fix mypy v2 plugin for upcoming mypy release by @cdce8p in #12209
- Respect custom title in functions JSON Schema by @Viicos in #11892
- Fix
ImportStringJSON serialization for objects with anameattribute by @chr1sj0nes in #12219 - Do not error on fields overridden by methods in the mypy plugin by @Viicos in #12290
New Contributors
- @raspuchin made their first contribution in #12106
- @chr1sj0nes made their first contribution in #12219
v1.10.24 2025-09-25
What's Changed
- Add user warning when using Python 3.14 by @Viicos in #12263
Pydantic V1 will not work with Python 3.14 and greater. A warning is now raised as no actual
error show up when using it, but the core behavior will silently get broken at runtime. - Fix mypy plugin issue for mypy v1.18 by @cdce8p in #12254
This fixes another mypy issue that was discovered after the previous v1.10.23 release.
Full Changelog: v1.10.23...v1.10.24