Data validation using Python type hints
…
by @LouisGobert in #9214
validation_alias
behavior with model_construct
for AliasChoices
and AliasPath
by @sydney-runkle in #9223
typing.Literal
and import it outside the TYPE_CHECKING block by @frost-nzcr4 in #9232
Secret
serialization schema, applicable for unions by @sydney-runkle in #9240
strict
application to function-after
with use_enum_values
by @sydney-runkle in #9279
model_construct
on a class which defines model_post_init
fails with AttributeError
by @babygrimes in #9168
model_json_schema
with config types by @NeevCohen in #9287
int
by @samuelcolvin in pydantic/pydantic-core#1269
int
s with leading unary plus by @cknv in pydantic/pydantic-core#1272
extra != 'ignore'
and from_attributes=True
by @davidhewitt in pydantic/pydantic-core#1276
Enum
's missing
function as ValidationError
by @sydney-runkle in pydantic/pydantic-core#1274
Iterable
validation by @davidhewitt in pydantic/pydantic-core#1271
Full Changelog: https://github.com/pydantic/pydantic/compare/v2.7.0...v2.7.1/
The code released in v2.7.0 is practically identical to that of v2.7.0b1.
pyproject.toml
sections by @Viicos in #8899
pydantic-core
to v2.18.1
by @sydney-runkle in #9211
jiter
v0.2.0
by @samuelcolvin in pydantic/pydantic-core#1250
FieldInfo.description
by @Viicos in #6563
with_config
decorator to comply with typing spec by @Viicos in #8611
ByteSize.human_readable
by @jks15satoshi in #8706
Secret
base type by @conradogarciaberrotaran in #8519
Sphinx
inventories for cross references in docs by @Viicos in #8682
deprecated
fields by @Viicos in #8237
field_serializer('*')
by @ornariece in #9001
model_config
is defined as a model property by @alexeyt101 in #9004
create_model()
to support typing.Annotated
as input by @wannieman98 in #8947
ClickhouseDsn
support by @solidguy7 in #9062
re.Pattern[str]
to pattern
field by @jag-k in #9053
serialize_as_any
runtime setting by @sydney-runkle in #8830
typing.Self
by @Youssefares in #9023
context
to serialization by @ornariece in #8965
Finalized in v2.7.0, rather than v2.7.0b1:
warnings
parameter for serialization utilities to allow raising a warning by @Lance-Drane in #9166
model_construct
behavior with extra
by @sydney-runkle in #8807
RootModel
subclasses by @sydney-runkle in #8857
PEP570
syntax by @Viicos in #8940
enum
and type
to the JSON schema for single item literals by @dmontagu in #8944
update_json_schema
internal function by @sydney-runkle in #9125
enum
validator improvements by @samuelcolvin in #9045
enum
validation and serialization to Rust by @samuelcolvin in #9064
aarch64
(Note: SIMD on x86 will be implemented in a future release) by @samuelcolvin in in pydantic/jiter#65
Cow<str>
from jiter
by @davidhewitt in pydantic/pydantic-core#1231
Sequence
s by @sydney-runkle in #8614
__qualname__
by @anci3ntr0ck in #8642
__pydantic_extra__
annotation being a string or inherited by @alexmojaki in #8659
NameEmail
by @Holi0317 in #8650
BaseModel
by @bluenote10 in #8651
mypy
plugin and no_strict_optional = True
by @dmontagu in #8666
ByteSize
error type
change by @sydney-runkle in #8681
__pydantic_config__
ignored for TypeDict by @13sin in #8734
pytest v8.0.0
due to pytest.warns()
starting to work inside pytest.raises()
by @mgorny in #8678
is_valid_field
from 1.x for mypy
plugin by @DanielNoord in #8738
mypy
strict equality flag by @dmontagu in #8799
FieldInfo.__repr_args__
by @sydney-runkle in #8801
BaseModel
type annotations to be resolvable by typing.get_type_hints
by @devmonkey22 in #7680
AliasGenerator
by @sydney-runkle in #8810
date
-> datetime
timezone assumption fix by @sydney-runkle in #8823
ast.Str
by @Viicos in #8837
deprecated
decorators by @Viicos in #8877
NameEmail
if name includes an email address by @NeevCohen in #8860
TypeAdapter
's typing compatible with special forms by @adriangb in #8923
enum
s by @dmontagu in #8920
model_json_schema
usage by @sydney-runkle in #8928
mypy
plugin by @dmontagu in #9008
PlainSerializer
usage with std type constructor by @sydney-runkle in #9031
Model.__getattr__()
by @NeevCohen in #9082
ClassVar
forward ref inherited from parent class by @alexmojaki in #9097
True
by @andresliszt in #8977
deque
when passed to Sequence[blah blah blah]
by @sydney-runkle in #9128
model_post_init
by @Viicos in #9134
model_construct
with validation_alias
by @ornariece in #9144
Literal
null
types by @bruno-f-cruz in #9135
Full Changelog: https://github.com/pydantic/pydantic/compare/v2.6.4...v2.7.0/
pyproject.toml
sections by @Viicos in #8899
pydantic-core
to v2.18.0
by @sydney-runkle in #9153
jiter
v0.2.0
by @samuelcolvin in pydantic/pydantic-core#1250
FieldInfo.description
by @Viicos in #6563
with_config
decorator to comply with typing spec by @Viicos in #8611
ByteSize.human_readable
by @jks15satoshi in #8706
Secret
base type by @conradogarciaberrotaran in #8519
Sphinx
inventories for cross references in docs by @Viicos in #8682
deprecated
fields by @Viicos in #8237
field_serializer('*')
by @ornariece in #9001
model_config
is defined as a model property by @alexeyt101 in #9004
create_model()
to support typing.Annotated
as input by @wannieman98 in #8947
ClickhouseDsn
support by @solidguy7 in #9062
re.Pattern[str]
to pattern
field by @jag-k in #9053
serialize_as_any
runtime setting by @sydney-runkle in #8830
typing.Self
by @Youssefares in #9023
context
to serialization by @ornariece in #8965
model_construct
behavior with extra
by @sydney-runkle in #8807
RootModel
subclasses by @sydney-runkle in #8857
PEP570
syntax by @Viicos in #8940
enum
and type
to the JSON schema for single item literals by @dmontagu in #8944
update_json_schema
internal function by @sydney-runkle in #9125
enum
validator improvements by @samuelcolvin in #9045
enum
validation and serialization to Rust by @samuelcolvin in #9064
aarch64
(Note: SIMD on x86 will be implemented in a future release) by @samuelcolvin in in pydantic/jiter#65
Cow<str>
from jiter
by @davidhewitt in pydantic/pydantic-core#1231
Sequence
s by @sydney-runkle in #8614
__qualname__
by @anci3ntr0ck in #8642
__pydantic_extra__
annotation being a string or inherited by @alexmojaki in #8659
NameEmail
by @Holi0317 in #8650
BaseModel
by @bluenote10 in #8651
mypy
plugin and no_strict_optional = True
by @dmontagu in #8666
ByteSize
error type
change by @sydney-runkle in #8681
__pydantic_config__
ignored for TypeDict by @13sin in #8734
pytest v8.0.0
due to pytest.warns()
starting to work inside pytest.raises()
by @mgorny in #8678
is_valid_field
from 1.x for mypy
plugin by @DanielNoord in #8738
mypy
strict equality flag by @dmontagu in #8799
FieldInfo.__repr_args__
by @sydney-runkle in #8801
BaseModel
type annotations to be resolvable by typing.get_type_hints
by @devmonkey22 in #7680
AliasGenerator
by @sydney-runkle in #8810
date
-> datetime
timezone assumption fix by @sydney-runkle in #8823
ast.Str
by @Viicos in #8837
deprecated
decorators by @Viicos in #8877
NameEmail
if name includes an email address by @NeevCohen in #8860
TypeAdapter
's typing compatible with special forms by @adriangb in #8923
enum
s by @dmontagu in #8920
model_json_schema
usage by @sydney-runkle in #8928
mypy
plugin by @dmontagu in #9008
PlainSerializer
usage with std type constructor by @sydney-runkle in #9031
Model.__getattr__()
by @NeevCohen in #9082
ClassVar
forward ref inherited from parent class by @alexmojaki in #9097
True
by @andresliszt in #8977
deque
when passed to Sequence[blah blah blah]
by @sydney-runkle in #9128
model_post_init
by @Viicos in #9134
model_construct
with validation_alias
by @ornariece in #9144
Literal
null
types by @bruno-f-cruz in #9135
Full Changelog: https://github.com/pydantic/pydantic/compare/v2.6.4...v2.7.0b1/
Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.14...v1.10.15
AliasGenerator
with computed_field
decorator by @sydney-runkle in #8806
Full Changelog: https://github.com/pydantic/pydantic/compare/v2.6.3...v2.6.4/
pydantic-settings
version in the docs by @hramezani in #8906
Full Changelog: https://github.com/pydantic/pydantic/compare/v2.6.2...v2.6.3/
pydantic-core
2.16.3 by @sydney-runkle in #8879
Full Changelog: https://github.com/pydantic/pydantic/compare/v2.6.1...v2.6.2/
pydantic-core
2.16.2 by @sydney-runkle in #8717
mypy
plugin and no_strict_optional = True
by @dmontagu in #8666
ByteSize
error type
change by @sydney-runkle in #8681
Field
annotations in dataclasses by @sydney-runkle in #8679
PlainValidator
by @sydney-runkle in #8710
Union
by @davidhewitt in pydantic/pydantic-core#1174
computed_field
JSON serializer exclude_none
behavior by @sydney-runkle in pydantic/pydantic-core#1187
Full Changelog: https://github.com/pydantic/pydantic/compare/v2.6.0...v2.6.1/
The code released in v2.6.0 is practically identical to that of v2.6.0b1.
email-validator
version >= 2.0 by @commonism in #6033
ruff
target version to Python 3.8 by @Elkiwa in #8341
pydantic-extra-types==2.4.1
by @yezz123 in #8478
pyright==1.1.345
by @Viicos in #8453
NatsDsn
by @ekeew in #6874
ConfigDict.ser_json_inf_nan
by @davidhewitt in #8159
types.OnErrorOmit
by @adriangb in #8222
AliasGenerator
usage by @sydney-runkle in #8282
yyyy-MM-DD
datetime parsing by @sydney-runkle in #8404
ByteSize
class #8415 by @luca-matei in #8507
ByteSize
by @geospackle in #8537
eval_type_backport
to handle union operator and builtin generic subscripting in older Pythons by @alexmojaki in #8209
dataclass
fields init
by @dmontagu in #8552
ValidationError
by @davidhewitt in pydantic/pydantic-core#1119
self
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 #8268
BaseModel
docstring from JSON schema description by @sydney-runkle in #8352
classproperty
decorator for model_computed_fields
by @Jocelyn-Gas in #8437
int
extraction by @samuelcolvin in pydantic/pydantic-core#1155
dataclass
serialization speedups by @samuelcolvin in pydantic/pydantic-core#1162
HashMap
creation when looking up small JSON objects in LazyIndexMaps
by @samuelcolvin in pydantic/jiter#55
Peak
with more efficient Peek
by @davidhewitt in pydantic/jiter#48
getattr
warning in deprecated BaseConfig
by @tlambert03 in #7183
model_fields
, not whole __dict__
by @alexmojaki in #7786
mypy
plugin by @dmontagu in #7411
mypy
error on untyped ClassVar
by @vincent-hachin-wmx in #8138
BaseModel.__eq__
instead of whole __dict__
by @QuentinSoubeyranAqemia in #7825
strict
docstring in model_validate
method. by @LukeTonin in #8223
computed_field
by @Viicos in #8227
validate_call
decorator to be dynamically assigned to a class method by @jusexton in #8249
unittest.mock
deprecation warnings by @ibleedicare in #8262
JsonValue
contains subclassed primitive values by @jusexton in #8286
mypy
error on free before validator (classmethod) by @sydney-runkle in #8285
to_snake
conversion by @jevins09 in #8316
ModelMetaclass.__prepare__
by @slanzmich in #8305
config
specification when initializing a TypeAdapter
when the annotated type has config already by @sydney-runkle in #8365
alias
in dataclass
signature by @NeevCohen in #8387
Field(...)
in a forward ref by @dmontagu in #8494
__dict__
with model_construct
call by @sydney-runkle in #8500
path_type
creation when globals does not contain __name__
by @hramezani in #8470
from __future__ import annotations
by @sydney-runkle in #8513
@deprecated
by @Viicos in #8294
model_construct
call by @sydney-runkle in #8525
TypeAliasType
for types with refs by @dmontagu in #8526
pydantic.Field(repr=False)
in dataclasses by @tigeryy2 in #8511
dataclass_transform
behavior for RootModel
by @Viicos in #8163
exclude_none
for json serialization of computed_field
s by @sydney-runkle in pydantic/pydantic-core#1098
pydantic
pydantic-core
email-validator
version >= 2.0 by @commonism in #6033
pydantic-extra-types==2.4.1
by @yezz123 in #8478
pyright==1.1.345
by @Viicos in #8453
NatsDsn
by @ekeew in #6874
ConfigDict.ser_json_inf_nan
by @davidhewitt in #8159
types.OnErrorOmit
by @adriangb in #8222
AliasGenerator
usage by @sydney-runkle in #8282
yyyy-MM-DD
datetime parsing by @sydney-runkle in #8404
ByteSize
class #8415 by @luca-matei in #8507
ByteSize
by @geospackle in #8537
eval_type_backport
to handle union operator and builtin generic subscripting in older Pythons by @alexmojaki in #8209
dataclass
fields init
by @dmontagu in #8552
ValidationError
by @davidhewitt in pydantic/pydantic-core#1119
self
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 #8268
BaseModel
docstring from JSON schema description by @sydney-runkle in #8352
classproperty
decorator for model_computed_fields
by @Jocelyn-Gas in #8437
int
extraction by @samuelcolvin in pydantic/pydantic-core#1155
dataclass
serialization speedups by @samuelcolvin in pydantic/pydantic-core#1162
HashMap
creation when looking up small JSON objects in LazyIndexMaps
by @samuelcolvin in pydantic/jiter#55
Peak
with more efficient Peek
by @davidhewitt in pydantic/jiter#48
getattr
warning in deprecated BaseConfig
by @tlambert03 in #7183
model_fields
, not whole __dict__
by @alexmojaki in #7786
mypy
plugin by @dmontagu in #7411
mypy
error on untyped ClassVar
by @vincent-hachin-wmx in #8138
BaseModel.__eq__
instead of whole __dict__
by @QuentinSoubeyranAqemia in #7825
strict
docstring in model_validate
method. by @LukeTonin in #8223
computed_field
by @Viicos in #8227
validate_call
decorator to be dynamically assigned to a class method by @jusexton in #8249
unittest.mock
deprecation warnings by @ibleedicare in #8262
JsonValue
contains subclassed primitive values by @jusexton in #8286
mypy
error on free before validator (classmethod) by @sydney-runkle in #8285
to_snake
conversion by @jevins09 in #8316
ModelMetaclass.__prepare__
by @slanzmich in #8305
config
specification when initializing a TypeAdapter
when the annotated type has config already by @sydney-runkle in #8365
alias
in dataclass
signature by @NeevCohen in #8387
Field(...)
in a forward ref by @dmontagu in #8494
__dict__
with model_construct
call by @sydney-runkle in #8500
path_type
creation when globals does not contain __name__
by @hramezani in #8470
from __future__ import annotations
by @sydney-runkle in #8513
@deprecated
by @Viicos in #8294
model_construct
call by @sydney-runkle in #8525
TypeAliasType
for types with refs by @dmontagu in #8526
pydantic.Field(repr=False)
in dataclasses by @tigeryy2 in #8511
dataclass_transform
behavior for RootModel
by @Viicos in #8163
exclude_none
for json serialization of computed_field
s by @sydney-runkle in pydantic/pydantic-core#1098
pydantic
pydantic-core
Full Changelog: https://github.com/pydantic/pydantic/compare/v2.5.3...v2.6.0b1