Pydantic v2.14.0b2

v2.14.0b2Pre-release

v2.14.0b2 2026-09-09

Added 6
  • Allow any CoreSchema to be used as serialization
  • Add support for frozendict type
  • Allow dict, frozendict and frozenset as defaultdict default factories
  • Add support for TypeForm for static type checking where a type form is expected, such as type adapters
  • Add support for lazy imports
  • Stabilize MISSING sentinel type, which is no longer experimental and can be imported as from pydantic import MISSING
Changed 9
  • Take ser_json_temporal into account when generating JSON Schema
  • Use the field name in __signature__ when validate_by_alias is False
  • Add a deque core schema
  • Do not mention MISSING as a valid value in validation errors
  • Refactor Decimal JSON Schema pattern constraint
  • Refactor type references logic
Fixed 13
  • Fix support for callable discriminators with PEP 695 type aliases
  • Preserve re.Pattern instance for compiled patterns in the experimental pipeline
  • Fix missing GC traversal on some pydantic-core struct fields
  • Fix missing GC traversal in pydantic-core for GeneralFieldsSerializer
  • Fix JSON schema discriminator mapping keys for bool discriminators
  • Fix application of other constraints in the pipeline API

From Pydantic

What's Changed

This pre-release adds full support for Python 3.15 specific features, such as support for frozendict, making use of TypeForm and stabilizing the MISSING sentinel type.

New Features
  • Allow any CoreSchema to be used as serialization by @Viicos in #13680

  • Add support for frozendict type by @Viicos in #13634

  • Allow dict, frozendict and frozenset as defaultdict default factories by @Viicos in #13623

  • Add support for TypeForm by @Viicos in #13459.

    This adds support for static type checking where a type form is expected. For instance, type adapters:

    from pydantic import TypeAdapter
    
    ta = TypeAdapter(int | str)
    assert_type(ta.validate_python(1), int | str)
    
  • Add support for lazy imports by @Viicos in #13776

  • Stabilize MISSING sentinel by @Viicos in #13782.

    The MISSING sentinel is no longer experimental, and can be imported as from pydantic import MISSING.

Changes
  • Take ser_json_temporal into account when generating JSON Schema by @shashiKundur1 in #13665
  • Use the field name in __signature__ when validate_by_alias isFalse by @jaideeppyne in #13730
  • Add a deque core schema by @Viicos in #13757
  • Do not mention MISSING as a valid value in validation errors by @Viicos in #13779
  • Refactor Decimal JSON Schema pattern constraint by @Viicos in #13672
Performance
  • Refactor type references logic by @Viicos in #13643
  • Improve performance of GenerateSchema.generate_schema() dispatching by @Viicos in #13614
  • Move schema gathering logic to pydantic-core by @Viicos in #13725
  • Improve performance of FieldInfo construction by @Viicos in #13726
Fixes
  • Fix support for callable discriminators with PEP 695 type aliases by @Viicos in #13604
  • Preserve re.Pattern instance for compiled patterns in the experimental pipeline by @soma0212 in #13611
  • Fix missing GC traversal on some pydantic-core struct fields by @Viicos in #13624
  • Fix missing GC traversal in pydantic-core for GeneralFieldsSerializer by @Viicos in #13629
  • Fix JSON schema discriminator mapping keys for bool discriminators by @remi-fongaufier in #13632
  • Fix application of other constraints in the pipeline API by @Viicos in #13659
  • Support bare None annotation for discriminated unions by @Viicos in #13667
  • Respect runtime alias validation configuration when wrap validators are present by @Viicos in #13668
  • Exclude computed fields with exclude_if from JSON Schema required fields by @Bishwas-py in #13563
  • Use config of TypeAdapter in JSON Schema generation by @Viicos in #13676
  • Support populate_by_name in @validate_call by @Viicos in #13691
  • Allow None to serialize against secret fields by @Viicos in #13699
  • Do not drop include/exclude if serializer wasn't called by @Viicos in #13702
  • Don't apply serialization temporal formats to validation JSON schemas by @MLuc24 in #13711
  • Reflect str_min_length and str_max_length config in the JSON schema by @MLuc24 in #13714
  • Treat a class attribute set to None as existing when assigning with extra='allow' by @Kropiunig in #13718
  • Use the field name in validation JSON schemas when validate_by_alias is False by @MLuc24 in #13717
  • Do not rely on normalization to validate decimals by @Viicos in #13742
  • Handle any exception when trying to compute JSON Schema default by @Viicos in #13741
  • Fix Mypy plugin crash with import cycle by @Viicos in #13767
  • Fix supported constraints for types of datetime module by @Viicos in #13768
  • Fix inconsistencies between constraints and core schemas allowed values by @Viicos in #13772
  • Allow self to be used as a parameter with @validate_call by @Viicos in #13773
  • Fix race conditions in freethreaded build by @Viicos in #13785
New Contributors
  • @soma0212 made their first contribution in #13611
  • @remi-fongaufier made their first contribution in #13632
  • @shashiKundur1 made their first contribution in #13665
  • @MLuc24 made their first contribution in #13711
  • @jaideeppyne made their first contribution in #13730

Full Changelog: https://github.com/pydantic/pydantic/compare/v2.14.0a1...v2.14.0b2

View original

Upgraded? How did it go?

Discussion