NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #18 most downloaded on PyPI
Data validation using Python type hints
Last release 24 days ago
09 Sep 2026
Ships fairly regularly
a new release about every 3 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
2 versions withdrawn
withdrawn after publishing
9 years old
206 releases · first in 2017
One column per quarter.
Update pydantic-settings version in the docs by @hramezani in #8906
Upgrade to pydantic-core 2.16.3 by @sydney-runkle in #8879
pydantic-core 2.16.3 by @sydney-runkle in #8879Full Changelog: https://github.com/pydantic/pydantic/compare/v2.6.1...v2.6.2/
Upgrade to pydantic-core 2.16.2 by @sydney-runkle in #8717
pydantic-core 2.16.2 by @sydney-runkle in #8717mypy plugin and no_strict_optional = True by @dmontagu in #8666ByteSize error type change by @sydney-runkle in #8681Field annotations in dataclasses by @sydney-runkle in #8679PlainValidator by @sydney-runkle in #8710Union by @davidhewitt in pydantic/pydantic-core#1174computed_field JSON serializer exclude_none behavior by @sydney-runkle in pydantic/pydantic-core#1187Full Changelog: https://github.com/pydantic/pydantic/compare/v2.6.0...v2.6.1/
Move getattr warning in deprecated BaseConfig by @tlambert03 in #7183
The code released in v2.6.0 is practically identical to that of v2.6.0b1.
email-validator version >= 2.0 by @commonism in #6033ruff target version to Python 3.8 by @Elkiwa in #8341pydantic-extra-types==2.4.1 by @yezz123 in #8478pyright==1.1.345 by @Viicos in #8453NatsDsn by @ekeew in #6874ConfigDict.ser_json_inf_nan by @davidhewitt in #8159types.OnErrorOmit by @adriangb in #8222AliasGenerator usage by @sydney-runkle in #8282yyyy-MM-DD datetime parsing by @sydney-runkle in #8404ByteSize class #8415 by @luca-matei in #8507ByteSize by @geospackle in #8537eval_type_backport to handle union operator and builtin generic subscripting in older Pythons by @alexmojaki in #8209dataclass fields init by @dmontagu in #8552ValidationError by @davidhewitt in pydantic/pydantic-core#1119self in BaseModel constructor, so no field name can ever conflict with it by @ariebovenberg in #8072@validate_call return a function instead of a custom descriptor - fixes binding issue with inheritance and adds self/cls argument to validation errors by @alexmojaki in #8268BaseModel docstring from JSON schema description by @sydney-runkle in #8352classproperty decorator for model_computed_fields by @Jocelyn-Gas in #8437int extraction by @samuelcolvin in pydantic/pydantic-core#1155dataclass serialization speedups by @samuelcolvin in pydantic/pydantic-core#1162HashMap creation when looking up small JSON objects in LazyIndexMaps by @samuelcolvin in pydantic/jiter#55Peak with more efficient Peek by @davidhewitt in pydantic/jiter#48getattr warning in deprecated BaseConfig by @tlambert03 in #7183model_fields, not whole __dict__ by @alexmojaki in #7786mypy plugin by @dmontagu in #7411mypy error on untyped ClassVar by @vincent-hachin-wmx in #8138BaseModel.__eq__ instead of whole __dict__ by @QuentinSoubeyranAqemia in #7825strict docstring in model_validate method. by @LukeTonin in #8223computed_field by @Viicos in #8227validate_call decorator to be dynamically assigned to a class method by @jusexton in #8249unittest.mock deprecation warnings by @ibleedicare in #8262JsonValue contains subclassed primitive values by @jusexton in #8286mypy error on free before validator (classmethod) by @sydney-runkle in #8285to_snake conversion by @jevins09 in #8316ModelMetaclass.__prepare__ by @slanzmich in #8305config specification when initializing a TypeAdapter when the annotated type has config already by @sydney-runkle in #8365alias in dataclass signature by @NeevCohen in #8387Field(...) in a forward ref by @dmontagu in #8494__dict__ with model_construct call by @sydney-runkle in #8500path_type creation when globals does not contain __name__ by @hramezani in #8470from __future__ import annotations by @sydney-runkle in #8513@deprecated by @Viicos in #8294model_construct call by @sydney-runkle in #8525TypeAliasType for types with refs by @dmontagu in #8526pydantic.Field(repr=False) in dataclasses by @tigeryy2 in #8511dataclass_transform behavior for RootModel by @Viicos in #8163exclude_none for json serialization of computed_fields by @sydney-runkle in pydantic/pydantic-core#1098pydanticpydantic-coreMove getattr warning in deprecated BaseConfig by @tlambert03 in #7183
email-validator version >= 2.0 by @commonism in #6033pydantic-extra-types==2.4.1 by @yezz123 in #8478pyright==1.1.345 by @Viicos in #8453NatsDsn by @ekeew in #6874ConfigDict.ser_json_inf_nan by @davidhewitt in #8159types.OnErrorOmit by @adriangb in #8222AliasGenerator usage by @sydney-runkle in #8282yyyy-MM-DD datetime parsing by @sydney-runkle in #8404ByteSize class #8415 by @luca-matei in #8507ByteSize by @geospackle in #8537eval_type_backport to handle union operator and builtin generic subscripting in older Pythons by @alexmojaki in #8209dataclass fields init by @dmontagu in #8552ValidationError by @davidhewitt in pydantic/pydantic-core#1119self in BaseModel constructor, so no field name can ever conflict with it by @ariebovenberg in #8072@validate_call return a function instead of a custom descriptor - fixes binding issue with inheritance and adds self/cls argument to validation errors by @alexmojaki in #8268BaseModel docstring from JSON schema description by @sydney-runkle in #8352classproperty decorator for model_computed_fields by @Jocelyn-Gas in #8437int extraction by @samuelcolvin in pydantic/pydantic-core#1155dataclass serialization speedups by @samuelcolvin in pydantic/pydantic-core#1162HashMap creation when looking up small JSON objects in LazyIndexMaps by @samuelcolvin in pydantic/jiter#55Peak with more efficient Peek by @davidhewitt in pydantic/jiter#48getattr warning in deprecated BaseConfig by @tlambert03 in #7183model_fields, not whole __dict__ by @alexmojaki in #7786mypy plugin by @dmontagu in #7411mypy error on untyped ClassVar by @vincent-hachin-wmx in #8138BaseModel.__eq__ instead of whole __dict__ by @QuentinSoubeyranAqemia in #7825strict docstring in model_validate method. by @LukeTonin in #8223computed_field by @Viicos in #8227validate_call decorator to be dynamically assigned to a class method by @jusexton in #8249unittest.mock deprecation warnings by @ibleedicare in #8262JsonValue contains subclassed primitive values by @jusexton in #8286mypy error on free before validator (classmethod) by @sydney-runkle in #8285to_snake conversion by @jevins09 in #8316ModelMetaclass.__prepare__ by @slanzmich in #8305config specification when initializing a TypeAdapter when the annotated type has config already by @sydney-runkle in #8365alias in dataclass signature by @NeevCohen in #8387Field(...) in a forward ref by @dmontagu in #8494__dict__ with model_construct call by @sydney-runkle in #8500path_type creation when globals does not contain __name__ by @hramezani in #8470from __future__ import annotations by @sydney-runkle in #8513@deprecated by @Viicos in #8294model_construct call by @sydney-runkle in #8525TypeAliasType for types with refs by @dmontagu in #8526pydantic.Field(repr=False) in dataclasses by @tigeryy2 in #8511dataclass_transform behavior for RootModel by @Viicos in #8163exclude_none for json serialization of computed_fields by @sydney-runkle in pydantic/pydantic-core#1098pydanticpydantic-coreFull Changelog: https://github.com/pydantic/pydantic/compare/v2.5.3...v2.6.0b1
Fix memory leak with recursive definitions creating reference cycles by @davidhewitt in pydantic/pydantic-core#1125
pydantic-core to 2.14.6Full Changelog: https://github.com/pydantic/pydantic/compare/v2.5.2...v2.5.3/
Add ConfigDict.ser_json_inf_nan by @davidhewitt in #8159
pydantic-core to 2.14.5ConfigDict.ser_json_inf_nan by @davidhewitt in #8159Literal from JSON keys when used as dict key by @sydney-runkle in pydantic/pydantic-core#1075custom_init on members of Union by @sydney-runkle in pydantic/pydantic-core#1076JsonValue bool serialization by @sydney-runkle in #8190Literal in Unions by @sydney-runkle in pydantic/pydantic-core#1089https://github.com/pydantic/pydantic/compare/v2.5.1...v2.5.2/
uprev pydantic-core to 2.14.3 by @samuelcolvin in #8120
ValidateCallWrapper error when creating a model which has a @validate_call wrapped field annotation by @sydney-runkle in #8110Full Changelog: https://github.com/pydantic/pydantic/compare/v2.5.0...v2.5.1/
The code released in v2.5.0 is functionally identical to that of v2.5.0b1.
The code released in v2.5.0 is functionally identical to that of v2.5.0b1.
pyright==1.1.335 by @Viicos in #8075ValidationError errors by @adriangb in #7806__doc__ argument in create_model() by @chris-spann in #7863regex_engine flag - meaning you can use with the Rust or Python regex libraries in constraints by @utkini in #7768ComputedFieldInfo by @alexmojaki in #7889ruff formatter by @Luca-Blight in #7930validation_error_cause to config by @zakstucke in #7626CallableDiscriminator and Tag by @dmontagu in #7983
CallableDiscriminator renamed to Discriminator by @dmontagu in #8047examples and json_schema_extra to @computed_field by @alexmojaki in #8013JsonValue type by @dmontagu in #7998str as argument to Discriminator by @dmontagu in #8047SchemaSerializer.__reduce__ method to enable pickle serialization by @edoakes in pydantic/pydantic-core#1006ultra_strict with new smart union implementation, the way unions are validated has changed significantly to improve performance and correctness, we have worked hard to absolutely minimise the number of cases where behaviour has changed, see the PR for details - by @davidhewitt in pydantic/pydantic-core#867extra='allow' by @sydney-runkle in #7683Enum types with no cases by @sydney-runkle in #7927Generic before BaseModel by @alexmojaki in #7891jiter by @samuelcolvin in pydantic/pydantic-core#974__getattr__ for all package imports, improve import time by @samuelcolvin in #7947mypy issue with subclasses of RootModel by @sydney-runkle in #7677FieldInfo when a forward ref gets evaluated by @dmontagu in #7698SecretStr from JSON (regression in v2.4) by @sydney-runkle in #7729defer_build behavior with TypeAdapter by @sydney-runkle in #7736mypy versions by @dmontagu in #7742TypeVar handling when default is not set by @pmmmwh in #7719strict on Enum type fields by @sydney-runkle in #7761weakref.ref instead of subclassing to fix cloudpickle serialization by @edoakes in #7780model_post_init in subclasses by @alexmojaki in #7775json_schema_extra by @alexmojaki in #7803strict specification for UUID types by @sydney-runkle in #7865pydantic.Field(kw_only=True) with inherited dataclasses by @PrettyWood in #7827validate_call decorator for methods in classes with __slots__ by @sydney-runkle in #7883dataclasses.field default by @hramezani in #7898importlib_metadata on python 3.7 by @sydney-runkle in #7904| operator (Union) in PydanticRecursiveRef by @alexmojaki in #7892display_as_type for TypeAliasType in python 3.12 by @dmontagu in #7929NotRequired generics in TypedDict by @sydney-runkle in #7932TypeAliasType specifications produce different schema definitions by @alexdrydew in #7893PrivateAttr is passed from Annotated default position by @tabassco in #8004classmethod instead of classmethod[Any, Any, Any] by @Mr-Pepe in #7979Optional field with validate_default only performing one field validation by @sydney-runkle in pydantic/pydantic-core#1002definition-ref bug with Dict keys by @sydney-runkle in pydantic/pydantic-core#1014bool types with coerce_numbers_to_str=True by @sydney-runkle in pydantic/pydantic-core#1017NaN in float and decimal constraints by @davidhewitt in pydantic/pydantic-core#1037lax_str and lax_int support for enum values not inherited from str/int by @michaelhly in pydantic/pydantic-core#1015Union of List types by @sydney-runkle in pydantic/pydantic-core#1039max_digits and decimals to pass if normalized or non-normalized input is valid by @sydney-runkle in pydantic/pydantic-core#1049ValidationError messages by @Iipin in pydantic/pydantic-core#1050'-' as datetime input by @davidhewitt in pydantic/speedate#52 & pydantic/pydantic-core#1060pydanticpydantic-coreFull Changelog: https://github.com/pydantic/pydantic/compare/v2.4.2...v2.5.0
Update pydantic-core from 2.10.1 to 2.14.1, significant changes from these updates are described below, full changelog here
ValidationError errors by @adriangb in #7806__doc__ argument in create_model() by @chris-spann in #7863regex_engine flag - meaning you can use with the Rust or Python regex libraries in constraints by @utkini in #7768ComputedFieldInfo by @alexmojaki in #7889ruff formatter by @Luca-Blight in #7930validation_error_cause to config by @zakstucke in #7626CallableDiscriminator and Tag by @dmontagu in #7983examples and json_schema_extra to @computed_field by @alexmojaki in #8013JsonValue type by @dmontagu in #7998str as argument to Discriminator by @dmontagu in #8047SchemaSerializer.__reduce__ method to enable pickle serialization by @edoakes in pydantic/pydantic-core#1006ultra_strict with new smart union implementation, the way unions are validated has changed significantly to improve performance and correctness, we have worked hard to absolutely minimise the number of cases where behaviour has changed, see the PR for details - by @davidhewitt in pydantic/pydantic-core#867extra='allow' by @sydney-runkle in #7683Enum types with no cases by @sydney-runkle in #7927Generic before BaseModel by @alexmojaki in #7891jiter by @samuelcolvin in pydantic/pydantic-core#974__getattr__ for all package imports, improve import time by @samuelcolvin in #7947mypy issue with subclasses of RootModel by @sydney-runkle in #7677FieldInfo when a forward ref gets evaluated by @dmontagu in #7698SecretStr from JSON (regression in v2.4) by @sydney-runkle in #7729defer_build behavior with TypeAdapter by @sydney-runkle in #7736mypy versions by @dmontagu in #7742TypeVar handling when default is not set by @pmmmwh in #7719strict on Enum type fields by @sydney-runkle in #7761weakref.ref instead of subclassing to fix cloudpickle serialization by @edoakes in #7780model_post_init in subclasses by @alexmojaki in #7775json_schema_extra by @alexmojaki in #7803strict specification for UUID types by @sydney-runkle in #7865pydantic.Field(kw_only=True) with inherited dataclasses by @PrettyWood in #7827validate_call decorator for methods in classes with __slots__ by @sydney-runkle in #7883dataclasses.field default by @hramezani in #7898importlib_metadata on python 3.7 by @sydney-runkle in #7904| operator (Union) in PydanticRecursiveRef by @alexmojaki in #7892display_as_type for TypeAliasType in python 3.12 by @dmontagu in #7929NotRequired generics in TypedDict by @sydney-runkle in #7932TypeAliasType specifications produce different schema definitions by @alexdrydew in #7893PrivateAttr is passed from Annotated default position by @tabassco in #8004classmethod instead of classmethod[Any, Any, Any] by @Mr-Pepe in #7979Optional field with validate_default only performing one field validation by @sydney-runkle in pydantic/pydantic-core#1002definition-ref bug with Dict keys by @sydney-runkle in pydantic/pydantic-core#1014bool types with coerce_numbers_to_str=True by @sydney-runkle in pydantic/pydantic-core#1017NaN in float and decimal constraints by @davidhewitt in pydantic/pydantic-core#1037lax_str and lax_int support for enum values not inherited from str/int by @michaelhly in pydantic/pydantic-core#1015Union of List types by @sydney-runkle in pydantic/pydantic-core#1039max_digits and decimals to pass if normalized or non-normalized input is valid by @sydney-runkle in pydantic/pydantic-core#1049ValidationError messages by @Iipin in pydantic/pydantic-core#1050'-' as datetime input by @davidhewitt in pydantic/speedate#52 & pydantic/pydantic-core#1060pydanticpydantic-coreFull changelog: Full Changelog: https://github.com/pydantic/pydantic/compare/v2.4.2...v2.5.0b1/
Fix bug with JSON schema for sequence of discriminated union by @dmontagu in #7647
models_json_schema for generic models by @adriangb in #7654Full Changelog: https://github.com/pydantic/pydantic/compare/v2.4.1...v2.4.2/
Update pydantic-core to 2.10.1 by @davidhewitt in #7633
Any by @adriangb in #7606Full Changelog: https://github.com/pydantic/pydantic/compare/v2.4.0...v2.4.1/
Mark Extra as deprecated by @disrupted in #7299
Base64Url types by @dmontagu in #7286number to str coercion by @lig in #7508field_name and data in all validators if there is data and a field name by @samuelcolvin in #7542BaseModel.model_validate_strings and TypeAdapter.validate_strings by @hramezani in #7552plugins experimental implementation by @lig @samuelcolvin and @Kludex in #6820model_post_init in subclass with private attrs by @Viicos in #7302Extra as deprecated by @disrupted in #7299EncodedStr a dataclass by @Kludex in #7396annotated_handlers to be public by @samuelcolvin in #7569CoreSchema by @adriangb in #7523CoreSchema walking by @adriangb in #7528dict.get and dict.setdefault with more verbose versions in CoreSchema building hot paths by @adriangb in #7536CoreSchema discovery by @adriangb in #7535CoreSchema validation for faster startup times by @adriangb in #7565TypedDict from grandparent classes by @dmontagu in #7272strict config overridable in field for Path by @hramezani in #7281ser_json_<timedelta|bytes> on default in GenerateJsonSchema by @Kludex in #7269SkipValidation to referenced schemas by @adriangb in #7381__get_pydantic_core_schema__ signature by @hramezani in #7415TypeAdapter) by @sydney-runkle in #7435TypeError on model_validator in wrap mode by @pmmmwh in #7496repr work for instances that failed initialization when handling ValidationErrors by @dmontagu in #7439UUID values having UUID.version=None by @lig in #7566__iter__ returning private cached_property info by @sydney-runkle in #7570Full Changelog: https://github.com/pydantic/pydantic/compare/v2.3.0...v2.4.0
🔥 Remove orphaned changes file from repo by @lig in https://github.com/pydantic/pydantic/pull/7168
Field(..., exclude: bool) docs by @samuelcolvin in https://github.com/pydantic/pydantic/pull/7214Base64Str and Base64Bytes by @Kludex in https://github.com/pydantic/pydantic/pull/7192config.defer_build for serialization first cases by @samuelcolvin in https://github.com/pydantic/pydantic/pull/7024validators.md to correct validate_default kwarg by @lmmx in https://github.com/pydantic/pydantic/pull/7229tzinfo.fromutc method for TzInfo in pydantic-core by @lig in https://github.com/pydantic/pydantic/pull/7019__get_validators__ by @hramezani in https://github.com/pydantic/pydantic/pull/7197Full Changelog: https://github.com/pydantic/pydantic/compare/v2.2.1...v2.2.2
Field(..., exclude: bool) docs by @samuelcolvin in #7214Base64Str and Base64Bytes by @Kludex in #7192config.defer_build for serialization first cases by @samuelcolvin in #7024validators.md to correct validate_default kwarg by @lmmx in #7229tzinfo.fromutc method for TzInfo in pydantic-core by @lig in #7019__get_validators__ by @hramezani in #7197<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
Full Changelog: https://github.com/pydantic/pydantic/compare/v2.2.0...v2.2.1
xfailing test for root model extra stop xfailing by @dmontagu in #6937Deprecate Field.include by @hramezani in https://github.com/pydantic/pydantic/pull/6852
<!-- Release notes generated using configuration in .github/release.yml at main -->
Field.include by @hramezani in https://github.com/pydantic/pydantic/pull/6852Path fields by @samuelcolvin in https://github.com/pydantic/pydantic/pull/6903ForwardRef wrapper for py 3.10.0 (shim until bpo-45166) by @randomir in https://github.com/pydantic/pydantic/pull/6919main branch for badge links by @Viicos in https://github.com/pydantic/pydantic/pull/6925ser_json_bytes regarding base64 encoding by @Viicos in https://github.com/pydantic/pydantic/pull/7052@validate_call to work on async methods by @adriangb in https://github.com/pydantic/pydantic/pull/7046Settings and SettingsConfigDict by @JeanArhancet in https://github.com/pydantic/pydantic/pull/7002short_version and use it in links by @hramezani in https://github.com/pydantic/pydantic/pull/7115RootModel by @Kludex in https://github.com/pydantic/pydantic/pull/7113Field.exclude by @Viicos in https://github.com/pydantic/pydantic/pull/7086validate_assignment to use Field.frozen by @Viicos in https://github.com/pydantic/pydantic/pull/7103_core_utils by @samuelcolvin in https://github.com/pydantic/pydantic/pull/7040round_trip in Json type documentation by @jc-louis in https://github.com/pydantic/pydantic/pull/7137Full Changelog: https://github.com/pydantic/pydantic/compare/v2.1.1...v2.2.0
Field.include by @hramezani in #6852Path fields by @samuelcolvin in #6903ForwardRef wrapper for py 3.10.0 (shim until bpo-45166) by @randomir in #6919main branch for badge links by @Viicos in #6925ser_json_bytes regarding base64 encoding by @Viicos in #7052@validate_call to work on async methods by @adriangb in #7046Settings and SettingsConfigDict by @JeanArhancet in #7002short_version and use it in links by @hramezani in #7115RootModel by @Kludex in #7113Field.exclude by @Viicos in #7086validate_assignment to use Field.frozen by @Viicos in #7103_core_utils by @samuelcolvin in #7040round_trip in Json type documentation by @jc-louis in #7137Skip FieldInfo merging when unnecessary by @dmontagu in https://github.com/pydantic/pydantic/pull/6862
Add StringConstraints for use as Annotated metadata by @adriangb in https://github.com/pydantic/pydantic/pull/6605
help(BaseModelSubclass) raises errors by @hramezani in https://github.com/pydantic/pydantic/pull/6758version_info() by @samuelcolvin in https://github.com/pydantic/pydantic/pull/6785SkipJsonSchema annotation by @Kludex in https://github.com/pydantic/pydantic/pull/6653docs/usage/types/custom.md by @hramezani in https://github.com/pydantic/pydantic/pull/6803json_encoders by @adriangb in https://github.com/pydantic/pydantic/pull/6811config.defer_build to optionally make model building lazy by @samuelcolvin in https://github.com/pydantic/pydantic/pull/6823json_encoders docs by @adriangb in https://github.com/pydantic/pydantic/pull/6848Field.exclude takes priority over call-time include/exclude by @hramezani in https://github.com/pydantic/pydantic/pull/6851GenerateSchema public by @adriangb in https://github.com/pydantic/pydantic/pull/6737Full Changelog: https://github.com/pydantic/pydantic/compare/v2.0.3...v2.1.0
StringConstraints for use as Annotated metadata by @adriangb in #6605help(BaseModelSubclass) raises errors by @hramezani in #6758@model_validator(mode="after") by @ljodal in #6753contentSchema keyword for JSON schema by @dmontagu in #6715version_info() by @samuelcolvin in #6785SkipJsonSchema annotation by @Kludex in #6653GenericModel to MOVED_IN_V2 by @adriangb in #6776docs/usage/types/custom.md by @hramezani in #6803float -> Decimal coercion precision loss by @adriangb in #6810annotated_types.MaxLen validator for custom sequence types by @ImogenBits in #6809InstanceOf by @dmontagu in #6829json_encoders by @adriangb in #6811WeakValueDictionary to fix generic memory leak by @dmontagu in #6681config.defer_build to optionally make model building lazy by @samuelcolvin in #6823UUID serialization to pydantic-core by @davidhewitt in #6850json_encoders docs by @adriangb in #6848staticmethod/classmethod order with validate_call by @dmontagu in #6686Config by @samuelcolvin in #6847Field.exclude takes priority over call-time include/exclude by @hramezani in #6851GenerateSchema public by @adriangb in #6737Mention PyObject (v1) moving to ImportString (v2) in migration doc by @slafs in https://github.com/pydantic/pydantic/pull/6456
Field.alias behavior in Pydantic V2 by @hramezani in https://github.com/pydantic/pydantic/pull/6508alias_priority by @tpdorsey in https://github.com/pydantic/pydantic/pull/6520pydantic-core to v2.2.0 by @lig in https://github.com/pydantic/pydantic/pull/6589enum error type docs by @lig in https://github.com/pydantic/pydantic/pull/6603max_length for unicode strings by @lig in https://github.com/pydantic/pydantic/pull/6559pydantic.v1 by @tpdorsey in https://github.com/pydantic/pydantic/pull/6604$ref as an alias by @dmontagu in https://github.com/pydantic/pydantic/pull/6568AnyUrl etc by @davidhewitt in https://github.com/pydantic/pydantic/pull/6618json_schema_extra on RootModel using Field by @lig in https://github.com/pydantic/pydantic/pull/6622transform docstring by @StefanBRas in https://github.com/pydantic/pydantic/pull/6649Full Changelog: https://github.com/pydantic/pydantic/compare/v2.0.2...v2.03
Field.alias behavior in Pydantic V2 by @hramezani in #6508alias_priority by @tpdorsey in #6520pydantic-core to v2.2.0 by @lig in #6589enum error type docs by @lig in #6603max_length for unicode strings by @lig in #6559pydantic.v1 by @tpdorsey in #6604$ref as an alias by @dmontagu in #6568AnyUrl etc by @davidhewitt in #6618json_schema_extra on RootModel using Field by @lig in #6622transform docstring by @StefanBRas in #6649💚 Insert the version without double quotes on tweet by @Kludex in https://github.com/pydantic/pydantic/pull/6437
GenerateJsonSchema.generate_definitions signature by @dmontagu in https://github.com/pydantic/pydantic/pull/6436Full Changelog: https://github.com/pydantic/pydantic/compare/v2.0.1...v2.0.2
RootModel would change the value of __dict__, #6457 by @dmontaguconstr documentation, renamed old regex to new pattern, #6452 by @miiliGenerateJsonSchema.generate_definitions signature, #6436 by @dmontaguSee the full changelog here
📝 Add note about Bump Pydantic by @Kludex in https://github.com/pydantic/pydantic/pull/6281
model_parametrized_name in docs/usage/models.md by @hramezani in https://github.com/pydantic/pydantic/pull/6325__modify_schema__ to co-exist __get_pydantic_json_schema__ by @adriangb in https://github.com/pydantic/pydantic/pull/6334create_model function by @TimDiekmann in https://github.com/pydantic/pydantic/pull/6347setattr adds field to model_extra by @aaraney in https://github.com/pydantic/pydantic/pull/6365validate_call schema generation and doc error for TypedDict by @adriangb in https://github.com/pydantic/pydantic/pull/6370Mac Address documentation by @yezz123 in https://github.com/pydantic/pydantic/pull/6367docs/usage/types/encoded.md by @hramezani in https://github.com/pydantic/pydantic/pull/6377Field inside of Annotated by @adriangb in https://github.com/pydantic/pydantic/pull/6373pydantic-extra-types to integration tests by @yezz123 in https://github.com/pydantic/pydantic/pull/6344repr() on qualname retrieval by @Kludex in https://github.com/pydantic/pydantic/pull/6382TypeError in validators by @Viicos in https://github.com/pydantic/pydantic/pull/6391Field annotations by merging them by @adriangb in https://github.com/pydantic/pydantic/pull/6398validate_call to instance when decorating methods by @dmontagu in https://github.com/pydantic/pydantic/pull/6406__hash__ for WithJsonSchema and Examples by @Kludex in https://github.com/pydantic/pydantic/pull/6414BaseModel.__getattr__ to raise a better error in case of AttributeError in model property by @hramezani in https://github.com/pydantic/pydantic/pull/6417main-pv2 FastAPI branch in integration tests by @lig in https://github.com/pydantic/pydantic/pull/6432Full Changelog: https://github.com/pydantic/pydantic/compare/v2.0...v2.0.1
First patch release of Pydantic V2
setattr (i.e. m.some_extra_field = 'extra_value')
are added to .model_extra if model_config extra='allowed'. Fixed #6333, #6365 by @aaraneySee the full changelog here
Ignore deprecated methods of pydantic.main in pydocstyle check by @hramezani in https://github.com/pydantic/pydantic/pull/6185
TypeError on validators by @Kludex in https://github.com/pydantic/pydantic/pull/6179pydantic.main in pydocstyle check by @hramezani in https://github.com/pydantic/pydantic/pull/6185RootModel default values by @lig in https://github.com/pydantic/pydantic/pull/5949from_orm deprecated decorator by @hramezani in https://github.com/pydantic/pydantic/pull/6189pydantic/root_model.py docstring by @hramezani in https://github.com/pydantic/pydantic/pull/6193pydantic/functional_validators.py docstrings by @hramezani in https://github.com/pydantic/pydantic/pull/6191send_tweet as release by @Kludex in https://github.com/pydantic/pydantic/pull/6170pydantic/mypy.py docstring by @hramezani in https://github.com/pydantic/pydantic/pull/6207pydantic-settings by @lig in https://github.com/pydantic/pydantic/pull/6221parse_env_var removal by @hramezani in https://github.com/pydantic/pydantic/pull/6235__get_pydantic_core_schema__ by @adriangb in https://github.com/pydantic/pydantic/pull/6224_make_forward_ref by @Kludex in https://github.com/pydantic/pydantic/pull/6246publish_docs job by @Kludex in https://github.com/pydantic/pydantic/pull/6247assignees list to the hooky config by @lig in https://github.com/pydantic/pydantic/pull/6264json_schema.py by @Kludex in https://github.com/pydantic/pydantic/pull/6267final keyword from Field by @Kludex in https://github.com/pydantic/pydantic/pull/6284TypeError on mixed discriminated unions by @lig in https://github.com/pydantic/pydantic/pull/6282RootModel.construct() and RootModel.__init__() results aren't equal by @lig in https://github.com/pydantic/pydantic/pull/6283PydanticDeprecationWarning warning instead of the generic one by @lig in https://github.com/pydantic/pydantic/pull/6180use_enum_values config flag by @adriangb in https://github.com/pydantic/pydantic/pull/6294docs/usage/types/callables.md by @hramezani in https://github.com/pydantic/pydantic/pull/6318Full Changelog: https://github.com/pydantic/pydantic/compare/v2.0b3...v2.0
🗑️ Deprecate Color and PaymentCardNumber by @Kludex in https://github.com/pydantic/pydantic/pull/6003
Color and PaymentCardNumber by @Kludex in https://github.com/pydantic/pydantic/pull/6003__pydantic_config__ to be used on vanilla dataclasses by @adriangb in https://github.com/pydantic/pydantic/pull/6008model_config by @Kludex in https://github.com/pydantic/pydantic/pull/6021RootModel dynamically when accessed directly only by @lig in https://github.com/pydantic/pydantic/pull/5951PhoneNumber and ABARoutingNumber by @Kludex in https://github.com/pydantic/pydantic/pull/6031pydantic-settings by @Kludex in https://github.com/pydantic/pydantic/pull/6035mkdocs-material-insiders on forks by @Kludex in https://github.com/pydantic/pydantic/pull/6037ConfigDict API documentation from model_config.md by @Kludex in https://github.com/pydantic/pydantic/pull/6047postponed_annotations.md documentation by @Kludex in https://github.com/pydantic/pydantic/pull/6048pydantic-extra-types by @Kludex in https://github.com/pydantic/pydantic/pull/6050docs/usage/types/string_types.md by @hramezani in https://github.com/pydantic/pydantic/pull/6058pydocstyle ruff rules by @Kludex in https://github.com/pydantic/pydantic/pull/6067networks.py by @Kludex in https://github.com/pydantic/pydantic/pull/6069version.py by @Kludex in https://github.com/pydantic/pydantic/pull/6070install.md documentation by @Kludex in https://github.com/pydantic/pydantic/pull/6071fields.md on the documentation by @Kludex in https://github.com/pydantic/pydantic/pull/6072pydantic/_internal/_annotated_handlers.py docstring by @hramezani in https://github.com/pydantic/pydantic/pull/6086functional_serializers.py by @Kludex in https://github.com/pydantic/pydantic/pull/6092docs/usage/errors.md docs by @hramezani in https://github.com/pydantic/pydantic/pull/6098types.py by @Kludex in https://github.com/pydantic/pydantic/pull/6091fields.py docstring by @Kludex in https://github.com/pydantic/pydantic/pull/6088SecretField from public API by @Kludex in https://github.com/pydantic/pydantic/pull/6094docs/usage/types/custom.md by @adriangb in https://github.com/pydantic/pydantic/pull/5935__get_pydantic_core_schema__ for Enum by @adriangb in https://github.com/pydantic/pydantic/pull/6100pydantic/_internal/_dataclasses.py docstring by @hramezani in https://github.com/pydantic/pydantic/pull/6105deprecated-kwargs with removed-kwargs by @hramezani in https://github.com/pydantic/pydantic/pull/6107type_adapter.py by @Kludex in https://github.com/pydantic/pydantic/pull/6109handler.generate_schema() to simplify explaining it in the docs by @adriangb in https://github.com/pydantic/pydantic/pull/6102pydantic/_internal/_core_metadata.py docstring by @hramezani in https://github.com/pydantic/pydantic/pull/6089pydantic/_internal/_decorators.py docstring by @hramezani in https://github.com/pydantic/pydantic/pull/6114test_del_model_attr_error to run on PyPy < 3.9 by @hramezani in https://github.com/pydantic/pydantic/pull/6131test_del_model_attr_error to run on PyPy < 3.9 (#6131)" by @hramezani in https://github.com/pydantic/pydantic/pull/6133model_config inheritance by @Kludex in https://github.com/pydantic/pydantic/pull/6132model_config by @dmontagu in https://github.com/pydantic/pydantic/pull/6136AliasPath and AliasChoices by @Kludex in https://github.com/pydantic/pydantic/pull/6129pydantic/_internal/_decorators_v1.py docstring by @hramezani in https://github.com/pydantic/pydantic/pull/6128pydantic/_internal/_discriminated_union.py docstring by @hramezani in https://github.com/pydantic/pydantic/pull/6134union.md documentation by @Kludex in https://github.com/pydantic/pydantic/pull/6055init_var from __pydantic__fields__ by @Kludex in https://github.com/pydantic/pydantic/pull/6141pydantic/_internal/_fields.py docstring by @hramezani in https://github.com/pydantic/pydantic/pull/6138pydantic._internal._fields by @Viicos in https://github.com/pydantic/pydantic/pull/6148test_del_model_attr_error on PyPy by @hramezani in https://github.com/pydantic/pydantic/pull/6153pydantic/_internal/_forward_ref.py by @hramezani in https://github.com/pydantic/pydantic/pull/6146pydantic/_internal/_known_annotated_metadata.py docstring by @hramezani in https://github.com/pydantic/pydantic/pull/6155pydantic/_internal/_generics.py docstring by @hramezani in https://github.com/pydantic/pydantic/pull/6151pydantic/_internal/_generate_schema.py docstring by @hramezani in https://github.com/pydantic/pydantic/pull/6149pydantic/_internal/_internal_dataclass.py docstring by @hramezani in https://github.com/pydantic/pydantic/pull/6152PrivateAttr docs by @samuelcolvin in https://github.com/pydantic/pydantic/pull/6164__pydantic_extra__ by @adriangb in https://github.com/pydantic/pydantic/pull/6139pydantic/_internal/_model_construction.py docstring by @hramezani in https://github.com/pydantic/pydantic/pull/6166pydantic/_internal/_schema_generation_shared.py docstring by @hramezani in https://github.com/pydantic/pydantic/pull/6168pydantic/functional_validators.py docstring by @hramezani in https://github.com/pydantic/pydantic/pull/6169pydantic/main.py docstrings by @hramezani in https://github.com/pydantic/pydantic/pull/6173fields.md by @Kludex in https://github.com/pydantic/pydantic/pull/6137Full Changelog: https://github.com/pydantic/pydantic/compare/v2.0b2...v2.0b3
Third beta pre-release of Pydantic V2
See the full changelog here
Improve test coverage for pydantic.dataclasses by @hramezani in https://github.com/pydantic/pydantic/pull/5973
pydantic/main.py by @lig in https://github.com/pydantic/pydantic/pull/5977_generate_schema.py by @Kludex in https://github.com/pydantic/pydantic/pull/5966_generate_schema.py by @Kludex in https://github.com/pydantic/pydantic/pull/5975from_attributes to TypeAdapter.validate_python by @adriangb in https://github.com/pydantic/pydantic/pull/5983from_attributes to BaseModel.validate_python by @adriangb in https://github.com/pydantic/pydantic/pull/5985Full Changelog: https://github.com/pydantic/pydantic/compare/v2.0b1...v2.0b2
Add from_attributes runtime flag to TypeAdapter.validate_python and BaseModel.model_validate.
See the full changelog here
Replace deprecated validator usage by @Viicos in https://github.com/pydantic/pydantic/pull/5712
validator usage by @Viicos in https://github.com/pydantic/pydantic/pull/5712typing.Self for @classmethod constructors by @Viicos in https://github.com/pydantic/pydantic/pull/5713ModelPrivateAttr by @lig in https://github.com/pydantic/pydantic/pull/5709lig to the reviewers list by @lig in https://github.com/pydantic/pydantic/pull/5759tests.test_edge_cases.test_custom_generic_validators by @dmontagu in https://github.com/pydantic/pydantic/pull/5764_repr.Representation by @samuelcolvin in https://github.com/pydantic/pydantic/pull/5740_base_class_defined hack in favor of an empty bases check by @lig in https://github.com/pydantic/pydantic/pull/5761__prepare_pydantic_annotations__ to make it easier to wrap "known" types by @adriangb in https://github.com/pydantic/pydantic/pull/5801RootModel support by @lig in https://github.com/pydantic/pydantic/pull/5765duration instead of time-delta type for timedelta on JSON schema by @Kludex in https://github.com/pydantic/pydantic/pull/5864ModelMetaclass to _internal._model_construction by @samuelcolvin in https://github.com/pydantic/pydantic/pull/5865__get_pydantic_json_schema__ always gets the schema passed down from a wrapping handler by @adriangb in https://github.com/pydantic/pydantic/pull/5876allow_inf_nan doesn't work for Decimal by @lig in https://github.com/pydantic/pydantic/pull/5868__prepare_pydantic_annotations__ to exist without __get_pydantic_core_schema__ by @adriangb in https://github.com/pydantic/pydantic/pull/5886_internal objects becoming public by @samuelcolvin in https://github.com/pydantic/pydantic/pull/5892__pydantic_private__ for storing private attributes by @dmontagu in https://github.com/pydantic/pydantic/pull/5891@model_validator on nested models by @adriangb in https://github.com/pydantic/pydantic/pull/5889AttributeError on deleting a field of a Model having a PrivateAttr defined by @lig in https://github.com/pydantic/pydantic/pull/5897__fields__ -> model_fields by @samuelcolvin in https://github.com/pydantic/pydantic/pull/5912lenient_issubclass and lenient_isinstance to DEPRECATED_MOVED_IN_V2 by @Kludex in https://github.com/pydantic/pydantic/pull/5916DEPRECATED_MOVED_IN_V2 by @Kludex in https://github.com/pydantic/pydantic/pull/5926return_schema on functional serializers by @samuelcolvin in https://github.com/pydantic/pydantic/pull/5920RootModel tests by @lig in https://github.com/pydantic/pydantic/pull/5943RootModel equality logic by @lig in https://github.com/pydantic/pydantic/pull/5948json_schema.py by @Kludex in https://github.com/pydantic/pydantic/pull/5934json_schema.py by @Kludex in https://github.com/pydantic/pydantic/pull/5963pydantic.annotated to top level by @adriangb in https://github.com/pydantic/pydantic/pull/5954Full Changelog: https://github.com/pydantic/pydantic/compare/v2.0a4...v2.0b1
First beta pre-release of Pydantic V2
See the full changelog here
Add deprecated on BaseModel methods by @Kludex in https://github.com/pydantic/pydantic/pull/5646
pydantic.typing.evaluate_forwardref on the REMOVED_IN_V2 list by @Kludex in https://github.com/pydantic/pydantic/pull/5559Decimal by @samuelcolvin in https://github.com/pydantic/pydantic/pull/5585TypeError in Field and PrivateAttr by @samuelcolvin in https://github.com/pydantic/pydantic/pull/5587Annotated by @Kludex in https://github.com/pydantic/pydantic/pull/5603PathLike by @samuelcolvin in https://github.com/pydantic/pydantic/pull/5589datetime_parse module to the migration logic by @Kludex in https://github.com/pydantic/pydantic/pull/5617pydantic.__all__ by @dmontagu in https://github.com/pydantic/pydantic/pull/5633unique_items parameter in conlist by @Kludex in https://github.com/pydantic/pydantic/pull/5650tests.test_edge_cases.test_int_subclass as it is expected behavior by @hramezani in https://github.com/pydantic/pydantic/pull/5665Sequence[str] does not raise on str by @lig in https://github.com/pydantic/pydantic/pull/5599deprecated on BaseModel methods by @Kludex in https://github.com/pydantic/pydantic/pull/5646* to field_validator by @Kludex in https://github.com/pydantic/pydantic/pull/5657Base64 and a general Encoded types by @lig in https://github.com/pydantic/pydantic/pull/5615__prepare_pydantic_annotations__ for custom types by @adriangb in https://github.com/pydantic/pydantic/pull/5674UrlConstraints.__hash__ by @madkinsz in https://github.com/pydantic/pydantic/pull/5697Full Changelog: https://github.com/pydantic/pydantic/compare/v2.0a3...v2.0a4
Fourth pre-release of Pydantic V2
See the full changelog here
Move tools module to deprecated namespace by @Kludex in https://github.com/pydantic/pydantic/pull/5483
__all__ from private modules by @Kludex in https://github.com/pydantic/pydantic/pull/5467validate_call to replace validate_arguments by @samuelcolvin in https://github.com/pydantic/pydantic/pull/5342BaseConfig back to the pydantic.config module by @Kludex in https://github.com/pydantic/pydantic/pull/5479__get_pydantic_core_schema__ into __modify_pydantic_core_schema__ and __get_pydantic_core_schema__ by @adriangb in https://github.com/pydantic/pydantic/pull/5472tools module to deprecated namespace by @Kludex in https://github.com/pydantic/pydantic/pull/5483__get_pydantic_core_schema__ APIs by @adriangb in https://github.com/pydantic/pydantic/pull/5490@model_validator by @adriangb in https://github.com/pydantic/pydantic/pull/5529Full Changelog: https://github.com/pydantic/pydantic/compare/v2.0a2...v2.0a3
Third pre-release of Pydantic V2
See the full changelog here
Convert schema_of to use AnalyzedType by @adriangb in https://github.com/pydantic/pydantic/pull/5355
ConfigWrapper by @samuelcolvin in https://github.com/pydantic/pydantic/pull/5411@model_validator by @adriangb in https://github.com/pydantic/pydantic/pull/5379validation_alias and serialization_alias to Field by @hramezani in https://github.com/pydantic/pydantic/pull/5433Full Changelog: https://github.com/pydantic/pydantic/compare/v2.0a1...v2.0a2
Second pre-release of Pydantic V2
See the full changelog here
First pre-release of Pydantic V2!
First pre-release of Pydantic V2!
See this post for more details.
Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.2...v2.0a1
Fix syntax error under Python 3.7 by @Viicos in https://github.com/pydantic/pydantic/pull/12643
Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.25...v1.10.26
Add minimal support for Python 3.14 by @Viicos in https://github.com/pydantic/pydantic/pull/12636
Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.24...v1.10.25
Add user warning when using Python 3.14 by @Viicos in https://github.com/pydantic/pydantic/pull/12263 Pydantic V1 will *not* work with Python 3.14 and
Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.23...v1.10.24
Fix mypy plugin for mypy 1.18 by @cdce8p in https://github.com/pydantic/pydantic/pull/12207
Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.22...v1.10.23
Fix compatibility with typing-extensions by @Viicos in https://github.com/pydantic/pydantic/pull/11764
typing-extensions by @Viicos in https://github.com/pydantic/pydantic/pull/11764Fix compatibility with ForwardRef._evaluate and Python < 3.12.4 by @griels in https://github.com/pydantic/pydantic/pull/11232
Properly address Python 3.13 deprecation warnings.
This release provides proper support for Python 3.13, with (Cythonized) wheels published for this version.
As a consequence, Cython was updated from 0.29.x to 3.0.x.
3.0.x.pyproject.toml, make use of PEP 517 build options.build instead of direct setup.py invocations.Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.19...v1.10.20
Fix deprecation warning in V1 isinstance check by @alicederyn in https://github.com/pydantic/pydantic/pull/10645
isinstance check by @alicederyn in https://github.com/pydantic/pydantic/pull/10645Eval type fix in V1 by @sydney-runkle in https://github.com/pydantic/pydantic/pull/9751
to_lower_camel to __all__ in utils.py by @sydney-runkle (direct commit)mypy v1 plugin for mypy 1.11 release by @flaeppe in https://github.com/pydantic/pydantic/pull/10139.schema(by_alias=False) by @exs-dwoodward in https://github.com/pydantic/pydantic/pull/10146Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.17...v1.10.18
Advertise Python 3.12 for 1.10.x! Part Deux by @vfazio in https://github.com/pydantic/pydantic/pull/9644
v1 namespace to fix typing and object resolution in python>3.11 by @exs-dwoodward in https://github.com/pydantic/pydantic/pull/9660Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.16...v1.10.17
Import modules/objects directly from v1 namespace by @exs-dwoodward in https://github.com/pydantic/pydantic/pull/9162
v1 namespace by @exs-dwoodward in https://github.com/pydantic/pydantic/pull/9162recursive_guard as kwarg in FutureRef._evaluate by @vfazio in https://github.com/pydantic/pydantic/pull/9612Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.15...v1.10.16
Add pydantic.v1 namespace to Pydantic v1 by @exs-dmiketa in https://github.com/pydantic/pydantic/pull/9042
Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.14...v1.10.15
Update install.md by @dmontagu in https://github.com/pydantic/pydantic/pull/7690
cached_property handling in dataclasses when copied by @rdbisme in https://github.com/pydantic/pydantic/pull/8407Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.13...v1.10.14
Update pip commands to install 1.10 by @chbndrhnns in https://github.com/pydantic/pydantic/pull/6930
validate_email by @hramezani in https://github.com/pydantic/pydantic/pull/7673Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.12...v1.10.13
pydantic.validate_email, #7673 by @hramezaniDeque's maxlen property dropped on V1 validation by @maciekglowka in https://github.com/pydantic/pydantic/pull/6586
Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.11...v1.10.12
maxlen property being dropped on deque validation. Happened only if the deque item has been typed. Changes the _validate_sequence_like func, #6581 by @maciekglowkaFix import of create_model in tools.py by @SharathHuddar in https://github.com/pydantic/pydantic/pull/6364
Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.10...v1.10.11
Fix racy doctests by @K900 in https://github.com/pydantic/pydantic/pull/6103
Json field support to settings management by @hramezani in https://github.com/pydantic/pydantic/pull/6250Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.9...v1.10.10
Add Pydantic classifier by @hramezani in https://github.com/pydantic/pydantic/pull/5847
Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.8...v1.10.9
Fix a bug in Literal usage with typing-extension==4.6.0, #5826 by @hramezani
Literal usage with typing-extension==4.6.0, #5826 by @hramezaniAnyClassMethod for changes in python/typeshed#9771, #5505 by @ITProKyleFull Changelog: https://github.com/pydantic/pydantic/compare/v1.10.7...v1.10.8
Fix creating schema from model using ConstrainedStr with regex as dict key, #5223 by @matejetz
ConstrainedStr with regex as dict key, #5223 by @matejetzfrom_orm in their own classes, #5187 by @dmontaguInitVar usage with pydantic dataclasses, mypy version 1.1.1 and the custom mypy plugin, #5162 by @cdce8pFull Changelog: https://github.com/pydantic/pydantic/compare/v1.10.6...v1.10.7
Implement logic to support creating validators from non standard callables by using defaults to identify them and unwrapping functools.partial and fun
functools.partial and functools.partialmethod when checking the signature, #5126 by @JensHeinrichdataclass_transform decorator for pydantic dataclasses, #5111 by @cdce8pValidationError, not ConfigError, when a discriminator value is unhashable, #4773 by @kurtmckeeFull Changelog: https://github.com/pydantic/pydantic/compare/v1.10.5...v1.10.6
Fix broken parametrized bases handling with GenericModels with complex sets of models, #5052 by @MarkusSintonen
GenericModels with complex sets of models, #5052 by @MarkusSintonenRecursionError when deep-copying dataclass types wrapped by pydantic, #4949 by @mbillingrX | Y union syntax breaking GenericModel, #4146 by @thenxFull Changelog: https://github.com/pydantic/pydantic/compare/v1.10.4...v1.10.5
Change dependency to typing-extensions>=4.2.0, #4885 by @samuelcolvin
typing-extensions>=4.2.0, #4885 by @samuelcolvinFull Changelog: https://github.com/pydantic/pydantic/compare/v1.10.3...v1.10.4
fix parsing of custom root models, #4883 by @gou177
schema and schema_json on models where a model instance is a one of default values, #4781 by @BobroniumDataclassProxy, #4695 by @PrettyWoodpostgresql+psycopg as allowed scheme for PostgreDsn to make it usable with SQLAlchemy 2, #4689 by @morianpatternProperties and additionalProperties, #4641 by @jpariseunique_items, #4568 by @mfulgoGenericModel with Callable param raising a TypeError, #4551 by @mfulgoStrictStr type annotation, #4538 by @sispdataclass_transform keyword argument name from field_descriptors to field_specifiers, #4500 by @samuelcolvin__post_init__ when dataclasses are inherited, #4487 by @PrettyWoodFull Changelog: https://github.com/pydantic/pydantic/compare/v1.10.2...v1.10.3
NOTE: v1.10.3 was "yanked" from PyPI due to #4885 which is fixed in v1.10.4
schema and schema_json on models where a model instance is a one of default values, #4781 by @BobroniumDataclassProxy, #4695 by @PrettyWoodpostgresql+psycopg as allowed scheme for PostgreDsn to make it usable with SQLAlchemy 2, #4689 by @morianpatternProperties and additionalProperties, #4641 by @jpariseunique_items, #4568 by @mfulgoGenericModel with Callable param raising a TypeError, #4551 by @mfulgoStrictStr type annotation, #4538 by @sispdataclass_transform keyword argument name from field_descriptors to field_specifiers, #4500 by @samuelcolvin__post_init__ when dataclasses are inherited, #4487 by @PrettyWoodPrevent long (length > 4_300) strings/bytes as input to int fields, see python/cpython#95778 and CVE-2020-10735, #1477 by @samuelcolvin
4_300) strings/bytes as input to int fields, see python/cpython#95778 and CVE-2020-10735, #1477 by @samuelcolvintomllib on Python 3.11 when parsing mypy configuration, #4476 by @hauntsaninjaGenericModel cache to detect order of arguments in Union models, #4474 by @sveinugulist and dict as default_factory, #4457 by @samuelcolvinFull Changelog: https://github.com/pydantic/pydantic/compare/v1.10.1...v1.10.2
Add __hash__ method to pydancic.color.Color class, #4454 by @czaki
__hash__ method to pydancic.color.Color class, #4454 by @czakiFull Changelog: https://github.com/pydantic/pydantic/compare/v1.10.0...v1.10.1
__hash__ method to pydantic.color.Color class, #4454 by @czakiFinally, config customization directly via a dict is now possible, #2557 by @PrettyWood BREAKING CHANGES:
See #4419 for feedback and discussion, docs are live at pydantic-docs.helpmanual.io.
dataclass decorator to really act like its standard lib equivalent.
It hence keeps __eq__, __hash__, ... and makes comparison with its non-validated version possible.
It also fixes usage of frozen dataclasses in fields and usage of default_factory in nested dataclasses.
The support of Config.extra has been added.
Finally, config customization directly via a dict is now possible, #2557 by @PrettyWood
<br/><br/>
BREAKING CHANGES:
compiled boolean (whether pydantic is compiled with cython) has been moved from main.py to version.pyConfig.extra is supported, dataclass ignores by default extra arguments (like BaseModel)__set_name__ protocol in BaseModel for PrivateAttrs, #4407 by @tlambert03parse_env_var in Config, #4406 by @acmiyaguchimaster to main, #4405 by @hramezaniStrictStr does not raise ValidationError when max_length is present in Field, #4388 by @hramezaniSecretStr and SecretBytes hashable, #4387 by @chbndrhnnsStrictBytes does not raise ValidationError when max_length is present in Field, #4380 by @JeanArhancettype, #4375 by @hramezanire.Pattern, #4366 by @hramezani__post_init_post_parse__ is incorrectly passed keyword arguments when no __post_init__ is defined, #4361 by @hramezaniForwardRef and Callable from pydantic.typing instead of typing and also expose MappingIntStrAny, #4358 by @aminalaeeAny types from the dataclass decorator so it can be used with the disallow_any_expr mypy option, #4356 by @DetachHeadpydantic/pydantic, #4348 by @yezz123Extra.forbid is validated multiple times, #4343 by @detachheadoneOf instead of anyOf when generating OpenAPI schema definitions, #4335 by @MaxwellPayneJson type. Json[list[str]] will be now inferred as list[str],
Json[Any] should be used instead of plain Json.
Runtime behaviour is not changed, #4332 by @Bobroniumalias is not None check, rather than bool(alias), #4253 by @sergeytsaplinForwardRefs in Field.outer_type_, #4249 by @JacobHayes__dataclass_transform__ has been replaced by typing_extensions.dataclass_transform, which is the preferred way to mark pydantic models as a dataclass under PEP 681, #4241 by @multimericConfig when validating nested NamedTuple fields, #4219 by @synekBaseModel.construct to work with aliased Fields, #4192 by @kylebamossmart_deepcopy and revert to deepcopy if so, #4184 by @coneybeareConfig.anystr_upper and to_upper kwarg to constr and conbytes, #4165 by @sathelerset and frozenset when they include default values, #4155 by @aminalaee@validator are classmethods, #4102 by @DMRobertsonType[] in schema, #4051 by @aminalaeedefault value in JSON Schema when const=True, #4031 by @aminalaeeallow_inf_nan, #3994 by @tiangoloenv_prefix had characters in common with env_nested_delimiter, #3975 by @arsenroncreate_model, #3945 by @hot123sBaseModel, #3920 by @irgoliccockroachdb, cockroachdb+psycopg2 and cockroachdb+asyncpg, #3839 by @blubber__init__ method in models, #3824 by @patrick91BaseModel instances, #3777 by @PrettyWoodConstrainedDate and condate, #3740 by @hottwajkw_only in dataclasses, #3670 by @detachheadColor class, #3646 by @aminalaeeto_lower_camel() for "non pascal case" camel case, #3463 by @schlerpdefault and default_factory arguments in Mypy plugin, #3430 by @klaa97inspect.signature for BaseModel, #3413 by @fix-inspect-signatureSecretField abstract class so that all the current and future secret fields like SecretStr and SecretBytes will derive from it, #3409 by @expobrainPostgresDsn, #3337 by @rglskSecretsSettingsSource to respect config.case_sensitive, #3273 by @JeanArhancetConfigError when multiple fields are incorrectly set for a single validator, #3215 by @SunsetOrangeFields inside Annotated for TypedDicts required, #3133 by @ezegomezint_validator, #3112 by @ojii__rich_repr__ method to Representation class which enables pretty printing with Rich, #3099 by @willmcguganAnyUrl and descendent types, #3061 by @FaresAhmedbvalidate_arguments decorator now supports alias, #3019 by @MAD-py__dict__ and __weakref__ attributes in AnyUrl and IP address fields, #2890 by @nuno-andreFinal in a field type annotation, #2766 by @uriyyotyping_extensions>=4.1.0 to guarantee dataclass_transform is available, #4424 by @commonismcopy_on_model_validation to reflect recent changes, #4369 by @samuelcolvin__slots__ is passed to create_model, __slots__ is then ignored, #4432 by @samuelcolvinBaseSettings.Config to avoid mypy errors, also correct mypy version compatibility notice in docs, #4450 by @samuelcolvinFull Changelog: https://github.com/pydantic/pydantic/compare/v1.9.0...v1.10.0
Runtime warning if __slots__ is passed to create_model, __slots__ is then ignored, #4432 by @samuelcolvin
__slots__ is passed to create_model, __slots__ is then ignored, #4432 by @samuelcolvinFull Changelog https://github.com/pydantic/pydantic/compare/v1.10.0a2...v1.10.0b1
Update requirement to typing_extensions>=4.1.0 to guarantee dataclass_transform is available, #4424 by @commonism
typing_extensions>=4.1.0 to guarantee dataclass_transform is available, #4424 by @commonismcopy_on_model_validation to reflect recent changes, #4369 by @samuelcolvinFull Changelog https://github.com/pydantic/pydantic/compare/v1.10.0a1...v1.10.0a2
Finally, config customization directly via a dict is now possible, #2557 by @PrettyWood BREAKING CHANGES:
dataclass decorator to really act like its standard lib equivalent.
It hence keeps __eq__, __hash__, ... and makes comparison with its non-validated version possible.
It also fixes usage of frozen dataclasses in fields and usage of default_factory in nested dataclasses.
The support of Config.extra has been added.
Finally, config customization directly via a dict is now possible, #2557 by @PrettyWood
BREAKING CHANGES:
compiled boolean (whether pydantic is compiled with cython) has been moved from main.py to version.pyConfig.extra is supported, dataclass ignores by default extra arguments (like BaseModel)__set_name__ protocol in BaseModel for PrivateAttrs, #4407 by @tlambert03master to main, #4405 by @hramezaniStrictStr does not raise ValidationError when max_length is present in Field, #4388 by @hramezaniSecretStr and SecretBytes hashable, #4387 by @chbndrhnnsStrictBytes does not raise ValidationError when max_length is present in Field, #4380 by @JeanArhancettype, #4375 by @hramezanire.Pattern, #4366 by @hramezani__post_init_post_parse__ is incorrectly passed keyword arguments when no __post_init__ is defined, #4361 by @hramezaniForwardRef and Callable from pydantic.typing instead of typing and also expose MappingIntStrAny, #4358 by @aminalaeeAny types from the dataclass decorator so it can be used with the disallow_any_expr mypy option, #4356 by @DetachHeadpydantic/pydantic, #4348 by @yezz123Extra.forbid is validated multiple times, #4343 by @detachheadoneOf instead of anyOf when generating OpenAPI schema definitions, #4335 by @MaxwellPayneJson type. Json[list[str]] will be now inferred as list[str],
Json[Any] should be used instead of plain Json.
Runtime behaviour is not changed, #4332 by @Bobroniumalias is not None check, rather than bool(alias), #4253 by @sergeytsaplinForwardRefs in Field.outer_type_, #4249 by @JacobHayes__dataclass_transform__ has been replaced by typing_extensions.dataclass_transform, which is the preferred way to mark pydantic models as a dataclass under PEP 681, #4241 by @multimericConfig when validating nested NamedTuple fields, #4219 by @synekBaseModel.construct to work with aliased Fields, #4192 by @kylebamossmart_deepcopy and revert to deepcopy if so, #4184 by @coneybeareConfig.anystr_upper and to_upper kwarg to constr and conbytes, #4165 by @sathelerset and frozenset when they include default values, #4155 by @aminalaee@validator are classmethods, #4102 by @DMRobertsonType[] in schema, #4051 by @aminalaeedefault value in JSON Schema when const=True, #4031 by @aminalaeeallow_inf_nan, #3994 by @tiangoloenv_prefix had characters in common with env_nested_delimiter, #3975 by @arsenroncreate_model, #3945 by @hot123sBaseModel, #3920 by @irgoliccockroachdb, cockroachdb+psycopg2 and cockroachdb+asyncpg, #3839 by @blubber__init__ method in models, #3824 by @patrick91BaseModel instances, #3777 by @PrettyWoodConstrainedDate and condate, #3740 by @hottwajkw_only in dataclasses, #3670 by @detachheadColor class, #3646 by @aminalaeeto_lower_camel() for "non pascal case" camel case, #3463 by @schlerpdefault and default_factory arguments in Mypy plugin, #3430 by @klaa97inspect.signature for BaseModel, #3413 by @fix-inspect-signatureSecretField abstract class so that all the current and future secret fields like SecretStr and SecretBytes will derive from it, #3409 by @expobrainPostgresDsn, #3337 by @rglskSecretsSettingsSource to respect config.case_sensitive, #3273 by @JeanArhancetConfigError when multiple fields are incorrectly set for a single validator, #3215 by @SunsetOrangeFields inside Annotated for TypedDicts required, #3133 by @ezegomezint_validator, #3112 by @ojii__rich_repr__ method to Representation class which enables pretty printing with Rich, #3099 by @willmcguganAnyUrl and descendent types, #3061 by @FaresAhmedbvalidate_arguments decorator now supports alias, #3019 by @MAD-py__dict__ and __weakref__ attributes in AnyUrl and IP address fields, #2890 by @nuno-andreFinal in a field type annotation, #2766 by @uriyyoFull Changelog: https://github.com/pydantic/pydantic/compare/v1.9.0...v1.10a1
Revert Breaking Change: _v1.9.1_ introduced a breaking change where model fields were deep copied by default, this release reverts the default behavio…
Revert Breaking Change: v1.9.1 introduced a breaking change where model fields were
deep copied by default, this release reverts the default behaviour to match v1.9.0 and before,
while also allow deep-copy behaviour via copy_on_model_validation = 'deep'. See #4092 for more information.
Config.copy_on_model_validation is now a str which must be
'none', 'deep', or 'shallow' corresponding to not copying, deep copy & shallow copy; default 'shallow',
#4093 by @timkpaineYour coding agent can read these notes before it upgrades. Set up the MCP server →