All Versions
26
Latest Version
Avg Release Cycle
23 days
Latest Release
1233 days ago

Changelog History
Page 1

  • v1.7.3 Changes

    November 30, 2020

    ๐Ÿ‘€ See Changelog.

    Thank you to pydantic's sponsors:
    @timdrijvers, @BCarley, @chdsbd, @tiangolo, @matin, @linusg, @kevinalh, @jorgecarleitao, @koxudaxi, @primer-api,
    ๐Ÿ‘ @mkeen, @meadsteve for their kind support.

    • ๐Ÿ›  fix: set right default value for required (optional) fields, #2142 by @PrettyWood
    • fix: support underscore_attrs_are_private with generic models, #2138 by @PrettyWood
    • fix: update all modified field values in root_validator when validate_assignment is on, #2116 by @PrettyWood
    • ๐Ÿ‘ Allow pickling of pydantic.dataclasses.dataclass dynamically created from a built-in dataclasses.dataclass, #2111 by @aimestereo
    • ๐Ÿ›  Fix a regression where Enum fields would not propagate keyword arguments to the schema, #2109 by @bm424
    • Ignore __doc__ as private attribute when Config.underscore_attrs_are_private is set, #2090 by @PrettyWood
  • v1.7.2 Changes

    November 01, 2020

    ๐Ÿ‘€ See Changelog.

    Thank you to pydantic's sponsors:
    @timdrijvers, @BCarley, @chdsbd, @tiangolo, @matin, @linusg, @kevinalh, @jorgecarleitao, @koxudaxi, @primer-api, @mkeen
    ๐Ÿ‘ for their kind support.

    • ๐Ÿ›  fix slow GenericModel concrete model creation, allow GenericModel concrete name reusing in module, #2078 by @MrMrRobat
    • keep the order of the fields when validate_assignment is set, #2073 by @PrettyWood
    • forward all the params of the stdlib dataclass when converted into pydantic dataclass, #2065 by @PrettyWood
  • v1.7.1 Changes

    October 28, 2020

    ๐Ÿ‘€ See Changelog.

    Thank you to pydantic's sponsors:
    @timdrijvers, @BCarley, @chdsbd, @tiangolo, @matin, @linusg, @kevinalh, @jorgecarleitao, @koxudaxi, @primer-api, @mkeen
    ๐Ÿ‘ for their kind support.

    • ๐Ÿ›  fix annotation of validate_arguments when passing configuration as argument, #2055 by @layday
    • ๐Ÿ›  Fix mypy assignment error when using PrivateAttr, #2048 by @aphedges
    • fix underscore_attrs_are_private causing TypeError when overriding __init__, #2047 by @samuelcolvin
    • ๐Ÿ›  Fixed regression introduced in v1.7 involving exception handling in field validators when validate_assignment=True, #2044 by @johnsabath
    • fix: pydantic dataclass can inherit from stdlib dataclass and Config.arbitrary_types_allowed is supported, #2042 by @PrettyWood
  • v1.7 Changes

    October 26, 2020

    ๐Ÿ‘€ See Changelog.

    Thank you to pydantic's sponsors:
    @timdrijvers, @BCarley, @chdsbd, @tiangolo, @matin, @linusg, @kevinalh, @jorgecarleitao, @koxudaxi, @primer-api
    ๐Ÿ‘ for their kind support.

    Highlights

    ๐Ÿ”„ Changes

    • ๐Ÿ’ฅ Breaking Change: remove __field_defaults__, add default_factory support with BaseModel.construct.
      0๏ธโƒฃ Use .get_default() method on fields in __fields__ attribute instead, #1732 by @PrettyWood
    • ๐Ÿ‘• Rearrange CI to run linting as a separate job, split install recipes for different tasks, #2020 by @samuelcolvin
    • ๐Ÿ‘ Allows subclasses of generic models to make some, or all, of the superclass's type parameters concrete, while
      also defining new type parameters in the subclass, #2005 by @choogeboom
    • Call validator with the correct values parameter type in BaseModel. __setattr__,
      when validate_assignment = True in model config, #1999 by @me-ransh
    • ๐Ÿ‘ฎ Force fields.Undefined to be a singleton object, fixing inherited generic model schemas, #1981 by @daviskirk
    • โœ… Include tests in source distributions, #1976 by @sbraz
    • Add ability to use min_length/max_length constraints with secret types, #1974 by @uriyyo
    • Also check root_validators when validate_assignment is on, #1971 by @PrettyWood
    • ๐Ÿ›  Fix const validators not running when custom validators are present, #1957 by @hmvp
    • โž• add deque to field types, #1935 by @wozniakty
    • โž• add basic support for python 3.9, #1832 by @PrettyWood
    • ๐Ÿ›  Fix typo in the anchor of exporting_models.md#modelcopy and incorrect description, #1821 by @KimMachineGun
    • โž• Added ability for BaseSettings to read "secret files", #1820 by @mdgilene
    • add parse_raw_as utility function, #1812 by @PrettyWood
    • ๐Ÿ‘Œ Support home directory relative paths for dotenv files (e.g. ~/.env), #1803 by @PrettyWood
    • ๐Ÿ“š Clarify documentation for parse_file to show that the argument
      should be a file path not a file-like object, #1794 by @mdavis-xyz
    • ๐Ÿ›  Fix false positive from mypy plugin when a class nested within a BaseModel is named Model, #1770 by @selimb
    • โž• add basic support of Pattern type in schema generation, #1767 by @PrettyWood
    • ๐Ÿ‘Œ Support custom title, description and default in schema of enums, #1748 by @PrettyWood
    • Properly represent Literal Enums when use_enum_values is True, #1747 by @noelevans
    • ๐Ÿ‘ Allows timezone information to be added to strings to be formatted as time objects. Permitted formats are Z for UTC
      or an offset for absolute positive or negative time shifts. Or the timezone data can be omitted, #1744 by @noelevans
    • Add stub __init__ with python 3.6 signature for ForwardRef, #1738 by @SirTelemak
    • ๐Ÿ›  Fix behaviour with forward refs and optional fields in nested models, #1736 by @PrettyWood
    • โž• add Enum and IntEnum as valid types for fields, #1735 by @PrettyWood
    • Change default value of __module__ argument of create_model from None to 'pydantic.main'.
      Set reference of created concrete model to it's module to allow pickling (not applied to models created in
      functions), #1686 by @MrMrRobat
    • โž• Add private attributes support, #1679 by @MrMrRobat
    • โž• add config to @validate_arguments, #1663 by @samuelcolvin
    • ๐Ÿ‘ Allow descendant Settings models to override env variable names for the fields defined in parent Settings models with
      ๐Ÿ”ง env in their Config. Previously only env_prefix configuration option was applicable, #1561 by @ojomio
    • ๐Ÿ‘Œ Support ref_template when creating schema $refs, #1479 by @Kilo59
    • Add a __call__ stub to PyObject so that mypy will know that it is callable, #1352 by @brianmaissy
    • ๐Ÿ‘ pydantic.dataclasses.dataclass decorator now supports built-in dataclasses.dataclass.
      It is hence possible to convert an existing dataclass easily to add pydantic validation.
      ๐Ÿ‘ Moreover nested dataclasses are also supported, #744 by @PrettyWood
  • v1.6.1 Changes

    July 15, 2020

    ๐Ÿ‘€ See Changelog.

    ๐Ÿ‘ Thank you to pydantic's sponsors: @matin, @tiangolo, @chdsbd, @jorgecarleitao, and 1 anonymous sponsor for their kind support.

    ๐Ÿ”„ changes:

    • ๐Ÿ›  fix validation and parsing of nested models with default_factory, #1710 by @PrettyWood
  • v1.6 Changes

    July 11, 2020

    ๐Ÿ‘€ See Changelog.

    ๐Ÿ‘ Thank you to pydantic's sponsors: @matin, @tiangolo, @chdsbd, @jorgecarleitao, and 1 anonymous sponsor for their kind support.

    ๐Ÿ”„ changes:

    • Modify validators for conlist and conset to not have always=True, #1682 by @samuelcolvin
    • โž• add port check to AnyUrl (can't exceed 65536) ports are 16 insigned bits: 0 <= port <= 2**16-1 src: rfc793 header format, #1654 by @flapili
    • 0๏ธโƒฃ Document default regex anchoring semantics, #1648 by @yurikhan
    • Use chain.from_iterable in class_validators.py. This is a faster and more idiomatic way of using itertools.chain.
      Instead of computing all the items in the iterable and storing them in memory, they are computed one-by-one and never
      stored as a huge list. This can save on both runtime and memory space, #1642 by @cool-RR
    • โž• Add conset(), analogous to conlist(), #1623 by @patrickkwang
    • make pydantic errors (un)pickable, #1616 by @PrettyWood
    • ๐Ÿ‘ Allow custom encoding for dotenv files, #1615 by @PrettyWood
    • Ensure SchemaExtraCallable is always defined to get type hints on BaseConfig, #1614 by @PrettyWood
    • โšก๏ธ Update datetime parser to support negative timestamps, #1600 by @mlbiche
    • โšก๏ธ Update mypy, remove AnyType alias for Type[Any], #1598 by @samuelcolvin
    • Adjust handling of root validators so that errors are aggregated from all failing root validators, instead of reporting on only the first root validator to fail, #1586 by @beezee
    • Make __modify_schema__ on Enums apply to the enum schema rather than fields that use the enum, #1581 by @therefromhere
    • Fix behavior of __all__ key when used in conjunction with index keys in advanced include/exclude of fields that are sequences, #1579 by @xspirus
    • ๐Ÿ“„ Subclass validators do not run when referencing a List field defined in a parent class when each_item=True. Added an example to the docs illustrating this, #1566 by @samueldeklund
    • change schema.field_class_to_schema to support frozenset in schema, #1557 by @wangpeibao
    • Call __modify_schema__ only for the field schema, #1552 by @PrettyWood
    • ๐Ÿšš Move the assignment of field.validate_always in fields.py so the always parameter of validators work on inheritance, #1545 by @dcHHH
    • โž• Added support for UUID instantiation through 16 byte strings such as b'\x12\x34\x56\x78' * 4. This was done to support BINARY(16) columns in sqlalchemy, #1541 by @shawnwall
    • โž• Add a test assertion that default_factory can return a singleton, #1523 by @therefromhere
    • Add NameEmail. __eq__ so duplicate NameEmail instances are evaluated as equal, #1514 by @stephen-bunn
    • โž• Add datamodel-code-generator link in pydantic document site, #1500 by @koxudaxi
    • โž• Added a "Discussion of Pydantic" section to the documentation, with a link to "Pydantic Introduction" video by Alexander Hultnรฉr, #1499 by @Hultner
    • 0๏ธโƒฃ Avoid some side effects of default_factory by calling it only once
      0๏ธโƒฃ if possible and by not setting a default value in the schema, #1491 by @PrettyWood
    • โž• Added docs about dumping dataclasses to JSON, #1487 by @mikegrima
    • Make BaseModel. __signature__ class-only, so getting __signature__ from model instance will raise AttributeError, #1466 by @MrMrRobat
    • include 'format': 'password' in the schema for secret types, #1424 by @Atheuz
    • Modify schema constraints on ConstrainedFloat so that exclusiveMinimum and
      minimum are not included in the schema if they are equal to -math.inf and
      exclusiveMaximum and maximum are not included if they are equal to math.inf, #1417 by @vdwees
    • Squash internal __root__ dicts in .dict() (and, by extension, in .json()), #1414 by @patrickkwang
    • ๐Ÿšš Move const validator to post-validators so it validates the parsed value, #1410 by @selimb
    • ๐Ÿ›  Fix model validation to handle nested literals, e.g. Literal['foo', Literal['bar']], #1364 by @DBCerigo
    • โœ‚ Remove user_required = True from RedisDsn, neither user nor password are required, #1275 by @samuelcolvin
    • โœ‚ Remove extra allOf from schema for fields with Union and custom Field, #1209 by @mostaphaRoudsari
    • โšก๏ธ Updates OpenAPI schema generation to output all enums as separate models.
      Instead of inlining the enum values in the model schema, models now use a $ref
      property to point to the enum definition, #1173 by @calvinwyoung
  • v1.5.1 Changes

    April 23, 2020

    ๐Ÿ‘€ See Changelog.

    • Signature generation with extra: allow never uses a field name, #1418 by @PrettyWood
    • 0๏ธโƒฃ Avoid mutating Field default value, #1412 by @PrettyWood
  • v1.5 Changes

    April 18, 2020

    ๐Ÿ‘€ 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 of by_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 of main.create_model() to __model_name to allow using model_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 and SecretBytes 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 from str, #1317 by @samuelcolvin
    • Have BaseModel inherit from Representation 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 to default_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-compiled Pattern objects. Fix str_validator() return type to str, #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 to Field to create a dynamic default value by passing a zero-argument callable, #1210 by @PrettyWood
    • โž• add support for NewType of List, 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 for dict(model), #1017 by @MrMrRobat
  • v1.4 Changes

    January 24, 2020

    ๐Ÿ‘€ See Changelog.

    • ๐Ÿ’ฅ Breaking Change: alias precedence logic changed so aliases on a field always take priority over
      an alias from alias_generator to avoid buggy/unexpected behaviour,
      ๐Ÿ‘€ see here for details, #1178 by @samuelcolvin
    • โž• Add support for unicode and punycode in TLDs, #1182 by @jamescurtin
    • ๐Ÿ›  Fix cls argument in validators during assignment, #1172 by @samuelcolvin
    • completing Luhn algorithm for PaymentCardNumber, #1166 by @cuencandres
    • add support for generics that implement __get_validators__ like a custom data type, #1159 by @tiangolo
    • โž• add support for infinite generators with Iterable, #1152 by @tiangolo
    • ๐Ÿ›  fix url_regex to accept schemas with +, - and . after the first character, #1142 by @samuelcolvin
    • ๐Ÿšš move version_info() to version.py, suggest its use in issues, #1138 by @samuelcolvin
    • ๐Ÿ‘Œ Improve pydantic import time by roughly 50% by deferring some module loading and regex compilation, #1127 by @samuelcolvin
    • ๐Ÿ›  Fix EmailStr and NameEmail to accept instances of themselves in cython, #1126 by @koxudaxi
    • Pass model class to the Config.schema_extra callable, #1125 by @therefromhere
    • ๐Ÿ›  Fix regex for username and password in URLs, #1115 by @samuelcolvin
    • โž• Add support for nested generic models, #1104 by @dmontagu
    • add __all__ to __init__.py to prevent "implicit reexport" errors from mypy, #1072 by @samuelcolvin
    • โž• Add support for using "dotenv" files with BaseSettings, #1011 by @acnebs
  • v1.3 Changes

    December 21, 2019

    ๐Ÿ‘€ See Changelog.

    • Change schema and schema_model to handle dataclasses by using their __pydantic_model__ feature, #792 by @aviramha
    • Added option for root_validator to be skipped if values validation fails using keyword skip_on_failure=True, #1049 by @aviramha
    • ๐Ÿ‘ Allow Config.schema_extra to be a callable so that the generated schema can be post-processed, #1054 by @selimb
    • โšก๏ธ Update mypy to version 0.750, #1057 by @dmontagu
    • Trick Cython into allowing str subclassing, #1061 by @skewty
    • Prevent type attributes being added to schema unless the attribute __schema_attributes__ is True, #1064 by @samuelcolvin
    • Change BaseModel.parse_file to use Config.json_loads, #1067 by @kierandarcy
    • ๐Ÿ›  Fix for optional Json fields, #1073 by @volker48
    • ๐Ÿ”„ Change the default number of threads used when compiling with cython to one,
      ๐Ÿ‘ allow override via the CYTHON_NTHREADS environment variable, #1074 by @samuelcolvin
    • ๐Ÿ‘ท Run FastAPI tests during Pydantic's CI tests, #1075 by @tiangolo
    • My mypy strictness constraints, and associated tweaks to type annotations, #1077 by @samuelcolvin
    • Add __eq__ to SecretStr and SecretBytes to allow "value equals", #1079 by @sbv-trueenergy
    • ๐Ÿ›  Fix schema generation for nested None case, #1088 by @lutostag
    • Consistent checks for sequence like objects, #1090 by @samuelcolvin
    • ๐Ÿ›  Fix Config inheritance on BaseSettings when used with env_prefix, #1091 by @samuelcolvin
    • Fix for __modify_schema__ when it conflicted with field_class_to_schema*, #1102 by @samuelcolvin
    • ๐Ÿ“„ docs: Fix explanation of case sensitive environment variable names when populating BaseSettings subclass attributes, #1105 by @tribals
    • ๐Ÿ“š Rename django-rest-framework benchmark in documentation, #1119 by @frankie567