diff --git a/HISTORY.md b/HISTORY.md index c5aeda5b03..81d5bf88e5 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,96 @@ +## v1.8.0 (2021-02-26) + +Thank you to pydantic's sponsors: +@jorgecarleitao, @BCarley, @chdsbd, @tiangolo, @matin, @linusg, @kevinalh, @koxudaxi, @timdrijvers, @mkeen, @meadsteve, +@ginomempin, @primer-io, @and-semakin, @tomthorogood, @AjitZK, @westonsteimel, @Mazyod, @christippett, @CarlosDomingues, +@Kludex, @r-m-n +for their kind support. + +### Highlights + +* [Hypothesis plugin](https://pydantic-docs.helpmanual.io/hypothesis_plugin/) for testing, #2097 by @Zac-HD +* support for [`NamedTuple` and `TypedDict`](https://pydantic-docs.helpmanual.io/usage/types/#annotated-types), #2216 by @PrettyWood +* Support [`Annotated` hints on model fields](https://pydantic-docs.helpmanual.io/usage/schema/#typingannotated-fields), #2147 by @JacobHayes +* [`frozen` parameter on `Config`](https://pydantic-docs.helpmanual.io/usage/model_config/) to allow models to be hashed, #1880 by @rhuille + +### Changes + +* **Breaking Change**, remove old deprecation aliases from v1, #2415 by @samuelcolvin: + * remove notes on migrating to v1 in docs + * remove `Schema` which was replaced by `Field` + * remove `Config.case_insensitive` which was replaced by `Config.case_sensitive` (default `False`) + * remove `Config.allow_population_by_alias` which was replaced by `Config.allow_population_by_field_name` + * remove `model.fields` which was replaced by `model.__fields__` + * remove `model.to_string()` which was replaced by `str(model)` + * remove `model.__values__` which was replaced by `model.__dict__` +* **Breaking Change:** always validate only first sublevel items with `each_item`. + There were indeed some edge cases with some compound types where the validated items were the last sublevel ones, #1933 by @PrettyWood +* Update docs extensions to fix local syntax highlighting, #2400 by @daviskirk +* fix: allow `utils.lenient_issubclass` to handle `typing.GenericAlias` objects like `list[str]` in python >= 3.9, #2399 by @daviskirk +* Improve field declaration for _pydantic_ `dataclass` by allowing the usage of _pydantic_ `Field` or `'metadata'` kwarg of `dataclasses.field`, #2384 by @PrettyWood +* Making `typing-extensions` a required dependency, #2368 by @samuelcolvin +* Make `resolve_annotations` more lenient, allowing for missing modules, #2363 by @samuelcolvin +* Allow configuring models through class kwargs, #2356 by @MrMrRobat +* Prevent `Mapping` subclasses from always being coerced to `dict`, #2325 by @ofek +* fix: allow `None` for type `Optional[conset / conlist]`, #2320 by @PrettyWood +* Support empty tuple type, #2318 by @PrettyWood +* fix: `python_requires` metadata to require >=3.6.1, #2306 by @hukkinj1 +* Properly encode `Decimal` with, or without any decimal places, #2293 by @hultner +* fix: update `__fields_set__` in `BaseModel.copy(update=…)`, #2290 by @PrettyWood +* fix: keep order of fields with `BaseModel.construct()`, #2281 by @PrettyWood +* Support generating schema for Generic fields, #2262 by @maximberg +* Fix `validate_decorator` so `**kwargs` doesn't exclude values when the keyword + has the same name as the `*args` or `**kwargs` names, #2251 by @cybojenix +* Prevent overriding positional arguments with keyword arguments in + `validate_arguments`, as per behaviour with native functions, #2249 by @cybojenix +* add documentation for `con*` type functions, #2242 by @tayoogunbiyi +* Support custom root type (aka `__root__`) when using `parse_obj()` with nested models, #2238 by @PrettyWood +* Support custom root type (aka `__root__`) with `from_orm()`, #2237 by @PrettyWood +* ensure cythonized functions are left untouched when creating models, based on #1944 by @kollmats, #2228 by @samuelcolvin +* Resolve forward refs for stdlib dataclasses converted into _pydantic_ ones, #2220 by @PrettyWood +* Add support for `NamedTuple` and `TypedDict` types. + Those two types are now handled and validated when used inside `BaseModel` or _pydantic_ `dataclass`. + Two utils are also added `create_model_from_namedtuple` and `create_model_from_typeddict`, #2216 by @PrettyWood +* Do not ignore annotated fields when type is `Union[Type[...], ...]`, #2213 by @PrettyWood +* Raise a user-friendly `TypeError` when a `root_validator` does not return a `dict` (e.g. `None`), #2209 by @masalim2 +* Add a `FrozenSet[str]` type annotation to the `allowed_schemes` argument on the `strict_url` field type, #2198 by @Midnighter +* add `allow_mutation` constraint to `Field`, #2195 by @sblack-usu +* Allow `Field` with a `default_factory` to be used as an argument to a function + decorated with `validate_arguments`, #2176 by @thomascobb +* Allow non-existent secrets directory by only issuing a warning, #2175 by @davidolrik +* fix URL regex to parse fragment without query string, #2168 by @andrewmwhite +* fix: ensure to always return one of the values in `Literal` field type, #2166 by @PrettyWood +* Support `typing.Annotated` hints on model fields. A `Field` may now be set in the type hint with `Annotated[..., Field(...)`; all other annotations are ignored but still visible with `get_type_hints(..., include_extras=True)`, #2147 by @JacobHayes +* Added `StrictBytes` type as well as `strict=False` option to `ConstrainedBytes`, #2136 by @rlizzo +* added `Config.anystr_lower` and `to_lower` kwarg to `constr` and `conbytes`, #2134 by @tayoogunbiyi +* Support plain `typing.Tuple` type, #2132 by @PrettyWood +* Add a bound method `validate` to functions decorated with `validate_arguments` + to validate parameters without actually calling the function, #2127 by @PrettyWood +* Add the ability to customize settings sources (add / disable / change priority order), #2107 by @kozlek +* Fix mypy complaints about most custom _pydantic_ types, #2098 by @PrettyWood +* Add a [Hypothesis](https://hypothesis.readthedocs.io/) plugin for easier [property-based testing](https://increment.com/testing/in-praise-of-property-based-testing/) with Pydantic's custom types - [usage details here](https://pydantic-docs.helpmanual.io/hypothesis_plugin/), #2097 by @Zac-HD +* add validator for `None`, `NoneType` or `Literal[None]`, #2095 by @PrettyWood +* Handle properly fields of type `Callable` with a default value, #2094 by @PrettyWood +* Updated `create_model` return type annotation to return type which inherits from `__base__` argument, #2071 by @uriyyo +* Add merged `json_encoders` inheritance, #2064 by @art049 +* allow overwriting `ClassVar`s in sub-models without having to re-annotate them, #2061 by @layday +* add default encoder for `Pattern` type, #2045 by @PrettyWood +* Add `NonNegativeInt`, `NonPositiveInt`, `NonNegativeFloat`, `NonPositiveFloat`, #1975 by @mdavis-xyz +* Use % for percentage in string format of colors, #1960 by @EdwardBetts +* Fixed issue causing `KeyError` to be raised when building schema from multiple `BaseModel` with the same names declared in separate classes, #1912 by @JSextonn +* Add `rediss` (Redis over SSL) protocol to `RedisDsn` + Allow URLs without `user` part (e.g., `rediss://:pass@localhost`), #1911 by @TrDex +* Add a new `frozen` boolean parameter to `Config` (default: `False`). + Setting `frozen=True` does everything that `allow_mutation=False` does, and also generates a `__hash__()` method for the model. This makes instances of the model potentially hashable if all the attributes are hashable, #1880 by @rhuille +* fix schema generation with multiple Enums having the same name, #1857 by @PrettyWood +* Added support for 13/19 digits VISA credit cards in `PaymentCardNumber` type, #1416 by @AlexanderSov +* fix: prevent `RecursionError` while using recursive `GenericModel`s, #1370 by @xppt +* use `enum` for `typing.Literal` in JSON schema, #1350 by @PrettyWood +* Fix: some recursive models did not require `update_forward_refs` and silently behaved incorrectly, #1201 by @PrettyWood +* Fix bug where generic models with fields where the typevar is nested in another type `a: List[T]` are considered to be concrete. This allows these models to be subclassed and composed as expected, #947 by @daviskirk +* Add `Config.copy_on_model_validation` flag. When set to `False`, _pydantic_ will keep models used as fields + untouched on validation instead of reconstructing (copying) them, #265 by @PrettyWood + ## v1.7.3 (2020-11-30) Thank you to pydantic's sponsors: diff --git a/changes/1201-PrettyWood.md b/changes/1201-PrettyWood.md deleted file mode 100644 index d22cd864c5..0000000000 --- a/changes/1201-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -Fix: some recursive models did not require `update_forward_refs` and silently behaved incorrectly \ No newline at end of file diff --git a/changes/1350-PrettyWood.md b/changes/1350-PrettyWood.md deleted file mode 100644 index f7fecfb4b8..0000000000 --- a/changes/1350-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -use `enum` for `typing.Literal` in JSON schema diff --git a/changes/1370-xppt.md b/changes/1370-xppt.md deleted file mode 100644 index 095c10d5f8..0000000000 --- a/changes/1370-xppt.md +++ /dev/null @@ -1 +0,0 @@ -fix: prevent `RecursionError` while using recursive `GenericModel`s diff --git a/changes/1416-AlexanderSov.md b/changes/1416-AlexanderSov.md deleted file mode 100644 index 188946a148..0000000000 --- a/changes/1416-AlexanderSov.md +++ /dev/null @@ -1 +0,0 @@ -Added support for 13/19 digits VISA credit cards in `PaymentCardNumber` type diff --git a/changes/1857-PrettyWood.md b/changes/1857-PrettyWood.md deleted file mode 100644 index f62bff6757..0000000000 --- a/changes/1857-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -fix schema generation with multiple Enums having the same name \ No newline at end of file diff --git a/changes/1880-rhuille.md b/changes/1880-rhuille.md deleted file mode 100644 index 3df77322f9..0000000000 --- a/changes/1880-rhuille.md +++ /dev/null @@ -1,2 +0,0 @@ -Add a new `frozen` boolean parameter to `Config` (default: `False`). -Setting `frozen=True` does everything that `allow_mutation=False` does, and also generates a `__hash__()` method for the model. This makes instances of the model potentially hashable if all the attributes are hashable. \ No newline at end of file diff --git a/changes/1911-TrDex.md b/changes/1911-TrDex.md deleted file mode 100644 index 9978022833..0000000000 --- a/changes/1911-TrDex.md +++ /dev/null @@ -1,2 +0,0 @@ -Add `rediss` (Redis over SSL) protocol to `RedisDsn` -Allow URLs without `user` part (e.g., `rediss://:pass@localhost`) \ No newline at end of file diff --git a/changes/1912-JSextonn.md b/changes/1912-JSextonn.md deleted file mode 100644 index 5225db4ba2..0000000000 --- a/changes/1912-JSextonn.md +++ /dev/null @@ -1 +0,0 @@ -Fixed issue causing KeyError to be raised when building schema from multiple `BaseModel` with the same names declared in separate classes. \ No newline at end of file diff --git a/changes/1933-PrettyWood.md b/changes/1933-PrettyWood.md deleted file mode 100644 index 656d844f50..0000000000 --- a/changes/1933-PrettyWood.md +++ /dev/null @@ -1,2 +0,0 @@ -**Breaking Change:** always validate only first sublevel items with `each_item`. -There were indeed some edge cases with some compound types where the validated items were the last sublevel ones. \ No newline at end of file diff --git a/changes/1960-EdwardBetts.md b/changes/1960-EdwardBetts.md deleted file mode 100644 index c424d4dde0..0000000000 --- a/changes/1960-EdwardBetts.md +++ /dev/null @@ -1 +0,0 @@ -Use % for percentage in string format of colors diff --git a/changes/1975-mdavis-xyz.md b/changes/1975-mdavis-xyz.md deleted file mode 100644 index 82cf2eb29f..0000000000 --- a/changes/1975-mdavis-xyz.md +++ /dev/null @@ -1 +0,0 @@ -Add `NonNegativeInt`, `NonPositiveInt`, `NonNegativeFloat`, `NonPositiveFloat` diff --git a/changes/2045-PrettyWood.md b/changes/2045-PrettyWood.md deleted file mode 100644 index 1fdf47c1e6..0000000000 --- a/changes/2045-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -add default encoder for `Pattern` type \ No newline at end of file diff --git a/changes/2061-layday.md b/changes/2061-layday.md deleted file mode 100644 index a17e9e59fd..0000000000 --- a/changes/2061-layday.md +++ /dev/null @@ -1 +0,0 @@ -allow overwriting `ClassVar`s in sub-models without having to re-annotate them diff --git a/changes/2064-art049.md b/changes/2064-art049.md deleted file mode 100644 index 426c3f379a..0000000000 --- a/changes/2064-art049.md +++ /dev/null @@ -1 +0,0 @@ -Add merged `json_encoders` inheritance \ No newline at end of file diff --git a/changes/2071-uriyyo.md b/changes/2071-uriyyo.md deleted file mode 100644 index 36b9a6aa13..0000000000 --- a/changes/2071-uriyyo.md +++ /dev/null @@ -1 +0,0 @@ -Updated `create_model` return type annotation to return type which inherits from `__base__` argument. \ No newline at end of file diff --git a/changes/2090-PrettyWood.md b/changes/2090-PrettyWood.md deleted file mode 100644 index 2e2e56f550..0000000000 --- a/changes/2090-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -Ignore `__doc__` as private attribute when `Config.underscore_attrs_are_private` is set \ No newline at end of file diff --git a/changes/2094-PrettyWood.md b/changes/2094-PrettyWood.md deleted file mode 100644 index b94bdbc20a..0000000000 --- a/changes/2094-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -Handle properly fields of type `Callable` with a default value \ No newline at end of file diff --git a/changes/2095-PrettyWood.md b/changes/2095-PrettyWood.md deleted file mode 100644 index 9f643028f7..0000000000 --- a/changes/2095-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -add validator for `None`, `NoneType` or `Literal[None]` \ No newline at end of file diff --git a/changes/2097-Zac-HD.md b/changes/2097-Zac-HD.md deleted file mode 100644 index 8a985245d3..0000000000 --- a/changes/2097-Zac-HD.md +++ /dev/null @@ -1 +0,0 @@ -Add a [Hypothesis](https://hypothesis.readthedocs.io/) plugin for easier [property-based testing](https://increment.com/testing/in-praise-of-property-based-testing/) with Pydantic's custom types - [usage details here](https://pydantic-docs.helpmanual.io/hypothesis_plugin/) diff --git a/changes/2098-PrettyWood.md b/changes/2098-PrettyWood.md deleted file mode 100644 index 910e4ea90b..0000000000 --- a/changes/2098-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -Fix mypy complaints about most custom _pydantic_ types \ No newline at end of file diff --git a/changes/2107-kozlek.md b/changes/2107-kozlek.md deleted file mode 100644 index a9e0e16452..0000000000 --- a/changes/2107-kozlek.md +++ /dev/null @@ -1 +0,0 @@ -Add the ability to customize settings sources (add / disable / change priority order). diff --git a/changes/2109-bm424.md b/changes/2109-bm424.md deleted file mode 100644 index 0d3c29cc6e..0000000000 --- a/changes/2109-bm424.md +++ /dev/null @@ -1 +0,0 @@ -Fix a regression where Enum fields would not propagate keyword arguments to the schema \ No newline at end of file diff --git a/changes/2111-aimestereo.md b/changes/2111-aimestereo.md deleted file mode 100644 index d930dfc852..0000000000 --- a/changes/2111-aimestereo.md +++ /dev/null @@ -1 +0,0 @@ -Allow pickling of `pydantic.dataclasses.dataclass` dynamically created from a built-in `dataclasses.dataclass`. \ No newline at end of file diff --git a/changes/2116-PrettyWood.md b/changes/2116-PrettyWood.md deleted file mode 100644 index d2c81cbf7f..0000000000 --- a/changes/2116-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -fix: update all modified field values in `root_validator` when `validate_assignment` is on \ No newline at end of file diff --git a/changes/2127-PrettyWood.md b/changes/2127-PrettyWood.md deleted file mode 100644 index dd39881e67..0000000000 --- a/changes/2127-PrettyWood.md +++ /dev/null @@ -1,2 +0,0 @@ -Add a bound method `validate` to functions decorated with `validate_arguments` -to validate parameters without actually calling the function \ No newline at end of file diff --git a/changes/2132-PrettyWood.md b/changes/2132-PrettyWood.md deleted file mode 100644 index ed05c0037a..0000000000 --- a/changes/2132-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -Support plain `typing.Tuple` type \ No newline at end of file diff --git a/changes/2134-tayoogunbiyi.md b/changes/2134-tayoogunbiyi.md deleted file mode 100644 index 5779fc9db4..0000000000 --- a/changes/2134-tayoogunbiyi.md +++ /dev/null @@ -1 +0,0 @@ -added `Config.anystr_lower` and `to_lower` kwarg to `constr` and `conbytes`. diff --git a/changes/2136-rlizzo.md b/changes/2136-rlizzo.md deleted file mode 100644 index ecae6a74cf..0000000000 --- a/changes/2136-rlizzo.md +++ /dev/null @@ -1 +0,0 @@ -Added `StrictBytes` type as well as `strict=False` option to `ConstrainedBytes`. diff --git a/changes/2138-PrettyWood.md b/changes/2138-PrettyWood.md deleted file mode 100644 index e58d0ed169..0000000000 --- a/changes/2138-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -fix: support `underscore_attrs_are_private` with generic models \ No newline at end of file diff --git a/changes/2142-PrettyWood.md b/changes/2142-PrettyWood.md deleted file mode 100644 index ddba015239..0000000000 --- a/changes/2142-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -fix: set right default value for required (optional) fields \ No newline at end of file diff --git a/changes/2147-JacobHayes.md b/changes/2147-JacobHayes.md deleted file mode 100644 index 322da5ffbc..0000000000 --- a/changes/2147-JacobHayes.md +++ /dev/null @@ -1 +0,0 @@ -Support `typing.Annotated` hints on model fields. A `Field` may now be set in the type hint with `Annotated[..., Field(...)`; all other annotations are ignored but still visible with `get_type_hints(..., include_extras=True)`. diff --git a/changes/2166-PrettyWood.md b/changes/2166-PrettyWood.md deleted file mode 100644 index 8d882957af..0000000000 --- a/changes/2166-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -fix: ensure to always return one of the values in `Literal` field type \ No newline at end of file diff --git a/changes/2168-andrewmwhite.md b/changes/2168-andrewmwhite.md deleted file mode 100644 index 6b906fcdd3..0000000000 --- a/changes/2168-andrewmwhite.md +++ /dev/null @@ -1,2 +0,0 @@ -fix URL regex to parse fragment without query string - diff --git a/changes/2175-davidolrik.md b/changes/2175-davidolrik.md deleted file mode 100644 index eff5995e19..0000000000 --- a/changes/2175-davidolrik.md +++ /dev/null @@ -1 +0,0 @@ -Allow non-existent secrets directory by only issuing a warning diff --git a/changes/2176-thomascobb.md b/changes/2176-thomascobb.md deleted file mode 100644 index 7ef0f30a8d..0000000000 --- a/changes/2176-thomascobb.md +++ /dev/null @@ -1,2 +0,0 @@ -Allow `Field` with a `default_factory` to be used as an argument to a function -decorated with `validate_arguments` \ No newline at end of file diff --git a/changes/2195-sblack-usu.md b/changes/2195-sblack-usu.md deleted file mode 100644 index 273da98020..0000000000 --- a/changes/2195-sblack-usu.md +++ /dev/null @@ -1 +0,0 @@ -add `allow_mutation` constraint to `Field` diff --git a/changes/2198-Midnighter.md b/changes/2198-Midnighter.md deleted file mode 100644 index a09b1f768f..0000000000 --- a/changes/2198-Midnighter.md +++ /dev/null @@ -1 +0,0 @@ -Add a `FrozenSet[str]` type annotation to the `allowed_schemes` argument on the `strict_url` field type. \ No newline at end of file diff --git a/changes/2209-masalim2.md b/changes/2209-masalim2.md deleted file mode 100644 index f9e3a4c49a..0000000000 --- a/changes/2209-masalim2.md +++ /dev/null @@ -1 +0,0 @@ -Raise a user-friendly `TypeError` when a `root_validator` does not return a `dict` (e.g. `None`) diff --git a/changes/2213-PrettyWood.md b/changes/2213-PrettyWood.md deleted file mode 100644 index 241538382d..0000000000 --- a/changes/2213-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -Do not ignore annotated fields when type is `Union[Type[...], ...]` \ No newline at end of file diff --git a/changes/2216-PrettyWood.md b/changes/2216-PrettyWood.md deleted file mode 100644 index bcf9e6d5a4..0000000000 --- a/changes/2216-PrettyWood.md +++ /dev/null @@ -1,3 +0,0 @@ -Add support for `NamedTuple` and `TypedDict` types. -Those two types are now handled and validated when used inside `BaseModel` or _pydantic_ `dataclass`. -Two utils are also added `create_model_from_namedtuple` and `create_model_from_typeddict`. \ No newline at end of file diff --git a/changes/2220-PrettyWood.md b/changes/2220-PrettyWood.md deleted file mode 100644 index 259597448b..0000000000 --- a/changes/2220-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -Resolve forward refs for stdlib dataclasses converted into _pydantic_ ones diff --git a/changes/2228-samuelcolvin.md b/changes/2228-samuelcolvin.md deleted file mode 100644 index 05d4606f0d..0000000000 --- a/changes/2228-samuelcolvin.md +++ /dev/null @@ -1 +0,0 @@ -ensure cythonized functions are left untouched when creating models, based on #1944 by @kollmats diff --git a/changes/2237-PrettyWood.md b/changes/2237-PrettyWood.md deleted file mode 100644 index 14e811b551..0000000000 --- a/changes/2237-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -Support custom root type (aka `__root__`) with `from_orm()` diff --git a/changes/2238-PrettyWood.md b/changes/2238-PrettyWood.md deleted file mode 100644 index 4a0f9239bf..0000000000 --- a/changes/2238-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -Support custom root type (aka `__root__`) when using `parse_obj()` with nested models \ No newline at end of file diff --git a/changes/2242-tayoogunbiyi.md b/changes/2242-tayoogunbiyi.md deleted file mode 100644 index db9bb03d44..0000000000 --- a/changes/2242-tayoogunbiyi.md +++ /dev/null @@ -1 +0,0 @@ -add documentation for con* type functions \ No newline at end of file diff --git a/changes/2249-cybojenix.md b/changes/2249-cybojenix.md deleted file mode 100644 index ad7021f591..0000000000 --- a/changes/2249-cybojenix.md +++ /dev/null @@ -1,2 +0,0 @@ -Prevent overriding positional arguments with keyword arguments in -`validate_arguments`, as per behaviour with native functions. \ No newline at end of file diff --git a/changes/2251-cybojenix.md b/changes/2251-cybojenix.md deleted file mode 100644 index c41d5e8b66..0000000000 --- a/changes/2251-cybojenix.md +++ /dev/null @@ -1,2 +0,0 @@ -Fix `validate_decorator` so `**kwargs` doesn't exclude values when the keyword -has the same name as the `*args` or `**kwargs` names. \ No newline at end of file diff --git a/changes/2262-maximberg.md b/changes/2262-maximberg.md deleted file mode 100644 index 0911c71d0a..0000000000 --- a/changes/2262-maximberg.md +++ /dev/null @@ -1 +0,0 @@ -Support generating schema for Generic fields. \ No newline at end of file diff --git a/changes/2281-PrettyWood.md b/changes/2281-PrettyWood.md deleted file mode 100644 index b554eb5c80..0000000000 --- a/changes/2281-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -fix: keep order of fields with `BaseModel.construct()` diff --git a/changes/2290-PrettyWood.md b/changes/2290-PrettyWood.md deleted file mode 100644 index 13df890876..0000000000 --- a/changes/2290-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -fix: update `__fields_set__` in `BaseModel.copy(update=…)` diff --git a/changes/2293-hultner.md b/changes/2293-hultner.md deleted file mode 100644 index e0eb18d3fc..0000000000 --- a/changes/2293-hultner.md +++ /dev/null @@ -1 +0,0 @@ -Properly encode `Decimal` with, or without any decimal places. diff --git a/changes/2306-hukkinj1.md b/changes/2306-hukkinj1.md deleted file mode 100644 index f2300718fd..0000000000 --- a/changes/2306-hukkinj1.md +++ /dev/null @@ -1 +0,0 @@ -fix: `python_requires` metadata to require >=3.6.1 \ No newline at end of file diff --git a/changes/2318-PrettyWood.md b/changes/2318-PrettyWood.md deleted file mode 100644 index 6ffb3cfb18..0000000000 --- a/changes/2318-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -Support empty tuple type diff --git a/changes/2320-PrettyWood.md b/changes/2320-PrettyWood.md deleted file mode 100644 index b3bd818aea..0000000000 --- a/changes/2320-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -fix: allow `None` for type `Optional[conset / conlist]` diff --git a/changes/2325-ofek.md b/changes/2325-ofek.md deleted file mode 100644 index 8a9cfe1af3..0000000000 --- a/changes/2325-ofek.md +++ /dev/null @@ -1 +0,0 @@ -Prevent `Mapping` subclasses from always being coerced to `dict` diff --git a/changes/2356-MrMrRobat.md b/changes/2356-MrMrRobat.md deleted file mode 100644 index d4adb3c2be..0000000000 --- a/changes/2356-MrMrRobat.md +++ /dev/null @@ -1 +0,0 @@ -Allow configuring models through class kwargs \ No newline at end of file diff --git a/changes/2363-samuelcolvin.md b/changes/2363-samuelcolvin.md deleted file mode 100644 index 68c221ab60..0000000000 --- a/changes/2363-samuelcolvin.md +++ /dev/null @@ -1 +0,0 @@ -Make `resolve_annotations` more lenient, allowing for missing modules diff --git a/changes/2368-samuelcolvin.md b/changes/2368-samuelcolvin.md deleted file mode 100644 index c71748f2bb..0000000000 --- a/changes/2368-samuelcolvin.md +++ /dev/null @@ -1 +0,0 @@ -Making `typing-extensions` a required dependency. diff --git a/changes/2384-PrettyWood.md b/changes/2384-PrettyWood.md deleted file mode 100644 index f2dcd54486..0000000000 --- a/changes/2384-PrettyWood.md +++ /dev/null @@ -1 +0,0 @@ -Improve field declaration for _pydantic_ `dataclass` by allowing the usage of _pydantic_ `Field` or `'metadata'` kwarg of `dataclasses.field` \ No newline at end of file diff --git a/changes/2399-daviskirk.md b/changes/2399-daviskirk.md deleted file mode 100644 index 1191a5bed3..0000000000 --- a/changes/2399-daviskirk.md +++ /dev/null @@ -1 +0,0 @@ -fix: allow `utils.lenient_issubclass` to handle `typing.GenericAlias` objects like `list[str]` in python >= 3.9. diff --git a/changes/2400-daviskirk.md b/changes/2400-daviskirk.md deleted file mode 100644 index 278cb5abec..0000000000 --- a/changes/2400-daviskirk.md +++ /dev/null @@ -1 +0,0 @@ -Update docs extensions to fix local syntax highlighting diff --git a/changes/265-PrettyWood.md b/changes/265-PrettyWood.md deleted file mode 100644 index 56a600fd63..0000000000 --- a/changes/265-PrettyWood.md +++ /dev/null @@ -1,2 +0,0 @@ -Add `Config.copy_on_model_validation` flag. When set to `False`, _pydantic_ will keep models used as fields -untouched on validation instead of reconstructing (copying) them \ No newline at end of file diff --git a/changes/947-daviskirk.md b/changes/947-daviskirk.md deleted file mode 100644 index d50a1a1dee..0000000000 --- a/changes/947-daviskirk.md +++ /dev/null @@ -1 +0,0 @@ -Fix bug where generic models with fields where the typevar is nested in another type `a: List[T]` are considered to be concrete. This allows these models to be subclassed and composed as expected. diff --git a/docs/requirements.txt b/docs/requirements.txt index 1373876e7d..6fb5cc7d57 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -2,10 +2,11 @@ ansi2html==1.6.0 flake8==3.8.4 flake8-quotes==3.2.0 hypothesis==6.3.0 +markdown-include==0.6.0 +mdx-truly-sane-lists==1.2 mkdocs==1.1.2 mkdocs-exclude==1.0.2 mkdocs-material==6.2.8 -markdown-include==0.6.0 sqlalchemy orjson ujson diff --git a/docs/usage/model_config.md b/docs/usage/model_config.md index 70a7545a73..e10529cc21 100644 --- a/docs/usage/model_config.md +++ b/docs/usage/model_config.md @@ -81,7 +81,7 @@ Options: not be included in the model schemas. **Note**: this means that attributes on the model with *defaults of this type*, not *annotations of this type*, will be left alone. **`schema_extra`** -: a `dict` used to extend/update the generated JSON Schema, or a callable to post-process it; see [Schema customization](schema.md#schema-customization) +: a `dict` used to extend/update the generated JSON Schema, or a callable to post-process it; see [schema customization](schema.md#schema-customization) **`json_loads`** : a custom function for decoding JSON; see [custom JSON (de)serialisation](exporting_models.md#custom-json-deserialisation) diff --git a/docs/usage/models.md b/docs/usage/models.md index 4346cbc5f5..f7aa5a2110 100644 --- a/docs/usage/models.md +++ b/docs/usage/models.md @@ -87,10 +87,10 @@ Models possess the following methods and attributes: : loads data into a model from an arbitrary class; cf. [ORM mode](#orm-mode-aka-arbitrary-class-instances) `schema()` -: returns a dictionary representing the model as JSON Schema; cf. [Schema](schema.md) +: returns a dictionary representing the model as JSON Schema; cf. [schema](schema.md) `schema_json()` -: returns a JSON string representation of `schema()`; cf. [Schema](schema.md) +: returns a JSON string representation of `schema()`; cf. [schema](schema.md) `construct()` : a class method for creating models without running validation; diff --git a/docs/usage/types.md b/docs/usage/types.md index 929188fffd..2cfa6b0ad0 100644 --- a/docs/usage/types.md +++ b/docs/usage/types.md @@ -881,7 +881,7 @@ _(This script is complete, it should run "as is")_ Similar validation could be achieved using [`constr(regex=...)`](#constrained-types) except the value won't be formatted with a space, the schema would just include the full pattern and the returned value would be a vanilla string. -See [Schema](schema.md) for more details on how the model's schema is generated. +See [schema](schema.md) for more details on how the model's schema is generated. ### Arbitrary Types Allowed diff --git a/mkdocs.yml b/mkdocs.yml index c2f4e4014a..b0493e31db 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -57,6 +57,7 @@ markdown_extensions: - admonition - pymdownx.highlight - pymdownx.extra +- mdx_truly_sane_lists plugins: - search diff --git a/pydantic/version.py b/pydantic/version.py index dd840e984c..43ad06b310 100644 --- a/pydantic/version.py +++ b/pydantic/version.py @@ -1,6 +1,6 @@ __all__ = 'VERSION', 'version_info' -VERSION = '1.7.3' +VERSION = '1.8' def version_info() -> str: