github pydantic/pydantic v2.12.0a1
v2.12.0a1 2025-07-26

pre-releaseone month ago

v2.12.0a1 (2025-07-26)

This is the first alpha release of the upcoming 2.12 release, which adds initial support for Python 3.14.

What's Changed

New Features

  • Add __pydantic_on_complete__() hook that is called once model is fully ready to be used by @DouweM in #11762
  • Add initial support for Python 3.14 by @Viicos in #11991
  • Add regex patterns to JSON schema for Decimal type by @Dima-Bulavenko in #11987
  • Add support for doc attribute on dataclass fields by @Viicos in #12077
  • Add experimental MISSING sentinel by @Viicos in #11883

Changes

  • Allow config and bases to be specified together in create_model() by @Viicos in #11714
  • Move some field logic out of the GenerateSchema class by @Viicos in #11733
  • Always make use of inspect.getsourcelines() for docstring extraction on Python 3.13 and greater by @Viicos in #11829
  • Only support the latest Mypy version by @Viicos in #11832
  • Do not implicitly convert after model validators to class methods by @Viicos in #11957
  • Refactor FieldInfo creation implementation by @Viicos in #11898
  • Make Secret covariant by @bluenote10 in #12008
  • Emit warning when field-specific metadata is used in invalid contexts by @Viicos in #12028

Fixes

  • Properly fetch plain serializer function when serializing default value in JSON Schema by @Viicos in #11721
  • Remove generics cache workaround by @Viicos in #11755
  • Remove coercion of decimal constraints by @Viicos in #11772
  • Fix crash when expanding root type in the mypy plugin by @Viicos in #11735
  • Only mark model as complete once all fields are complete by @DouweM in #11759
  • Do not provide field_name in validator core schemas by @DouweM in #11761
  • Fix issue with recursive generic models by @Viicos in #11775
  • Fix qualified name comparison of private attributes during namespace inspection by @karta9821 in #11803
  • Make sure Pydantic dataclasses with slots and validate_assignment can be unpickled by @Viicos in #11769
  • Traverse function-before schemas during schema gathering by @Viicos in #11801
  • Fix check for stdlib dataclasses by @Viicos in #11822
  • Check if FieldInfo is complete after applying type variable map by @Viicos in #11855
  • Do not delete mock validator/serializer in model_rebuild() by @Viicos in #11890
  • Rebuild dataclass fields before schema generation by @Viicos in #11949
  • Always store the original field assignment on FieldInfo by @Viicos in #11946
  • Do not use deprecated methods as default field values by @Viicos in #11914
  • Allow callable discriminator to be applied on PEP 695 type aliases by @Viicos in #11941
  • Suppress core schema generation warning when using SkipValidation by @ygsh0816 in #12002
  • Do not emit typechecking error for invalid Field() default with validate_default set to True by @Viicos in #11988
  • Refactor logic to support Pydantic's Field() function in dataclasses by @Viicos in #12051

Packaging

New Contributors

Don't miss a new pydantic release

NewReleases is sending notifications on new releases.