pydantic v1.5 Release Notes
Release Date: 2020-04-18 // about 4 years ago-
๐ See Changelog.
- ๐ Make includes/excludes arguments for
.dict()
,._iter()
, ..., immutable, #1404 by @AlexECX - Always use a field's real name with includes/excludes in
model._iter()
, regardless ofby_alias
, #1397 by @AlexECX - โก๏ธ Update constr regex example to include start and end lines, #1396 by @lmcnearney
- Confirm that shallow
model.copy()
does make a shallow copy of attributes, #1383 by @samuelcolvin - Renaming
model_name
argument ofmain.create_model()
to__model_name
to allow usingmodel_name
as a field name, #1367 by @kittipatv - ๐ Replace raising of exception to silent passing for non-Var attributes in mypy plugin, #1345 by @b0g3r
- โ Remove
typing_extensions
dependency for python 3.8, #1342 by @PrettyWood - ๐ Make
SecretStr
andSecretBytes
initialization idempotent, #1330 by @Atheuz - document making secret types dumpable using the json method, #1328 by @Atheuz
- ๐ Move all testing and build to github actions, add windows and macos binaries,
thank you @StephenBrown2 for much help, #1326 by @samuelcolvin - ๐ fix card number length check in
PaymentCardNumber
,PaymentCardBrand
now inherits fromstr
, #1317 by @samuelcolvin - Have
BaseModel
inherit fromRepresentation
to make mypy happy when overriding__str__
, #1310 by @FuegoFro - ๐ Allow
None
as input to all optional list fields, #1307 by @PrettyWood - โ Add
datetime
field todefault_factory
example, #1301 by @StephenBrown2 - ๐ Allow subclasses of known types to be encoded with superclass encoder, #1291 by @StephenBrown2
- Exclude exported fields from all elements of a list/tuple of submodels/dicts with
' __all__'
, #1286 by @masalim2 - โ Add pydantic.color.Color objects as available input for Color fields, #1258 by @leosussan
- In examples, type nullable fields as
Optional
, so that these are valid mypy annotations, #1248 by @kokes - Make
pattern_validator()
accept pre-compiledPattern
objects. Fixstr_validator()
return type tostr
, #1237 by @adamgreg - Document how to manage Generics and inheritance, #1229 by @Esadruhn
update_forward_refs()
method of BaseModel now copies__dict__
of class module instead of modyfying it, #1228 by @Paul-Ilyin- ๐ Support instance methods and class methods with
@validate_arguments
, #1222 by @samuelcolvin - โ Add
default_factory
argument toField
to create a dynamic default value by passing a zero-argument callable, #1210 by @PrettyWood - โ add support for
NewType
ofList
,Optional
, etc, #1207 by @Kazy - ๐ fix mypy signature for
root_validator
, #1192 by @samuelcolvin - ๐ Fixed parsing of nested 'custom root type' models, #1190 by @Shados
- โ Add
validate_arguments
function decorator which checks the arguments to a function matches type annotations, #1179 by @samuelcolvin - Add
__signature__
to models, #1034 by @MrMrRobat - ๐จ Refactor
._iter()
method, 10x speed boost fordict(model)
, #1017 by @MrMrRobat
- ๐ Make includes/excludes arguments for