From 67acb659c2cd3d15a8195ec34cb008f39265ed33 Mon Sep 17 00:00:00 2001 From: Samuel Colvin Date: Sat, 18 Apr 2020 17:32:16 +0100 Subject: [PATCH] prepare v1.5 release --- HISTORY.md | 35 +++++++++++++++++++++++++++++++++++ changes/1017-MrMrRobat.md | 1 - changes/1034-MrMrRobat.md | 1 - changes/1179-samuelcolvin.md | 1 - changes/1190-Shados.md | 1 - changes/1192-samuelcolvin.md | 1 - changes/1207-Kazy.md | 1 - changes/1210-prettywood.md | 1 - changes/1222-samuelcolvin.md | 1 - changes/1228-paul-ilyin.md | 1 - changes/1229-esadruhn.md | 1 - changes/1237-adamgreg.md | 1 - changes/1248-kokes.md | 1 - changes/1258-leosussan.md | 1 - changes/1286-masalim2.md | 1 - changes/1291-StephenBrown2.md | 1 - changes/1301-StephenBrown2.md | 1 - changes/1307-prettywood.md | 1 - changes/1310-FuegoFro.md | 1 - changes/1317-samuelcolvin.md | 1 - changes/1326-samuelcolvin.md | 2 -- changes/1328-atheuz.md | 1 - changes/1330-atheuz.md | 1 - changes/1342-prettywood.md | 1 - changes/1345-b0g3r.md | 1 - changes/1367-kittipatv.md | 1 - changes/1383-samuelcolvin.md | 1 - changes/1396-lmcnearney.md | 1 - changes/1397-AlexECX.md | 1 - changes/1404-AlexECX.md | 1 - docs/index.md | 6 +----- docs/usage/models.md | 5 ----- pydantic/version.py | 4 ++-- 33 files changed, 38 insertions(+), 42 deletions(-) delete mode 100644 changes/1017-MrMrRobat.md delete mode 100644 changes/1034-MrMrRobat.md delete mode 100644 changes/1179-samuelcolvin.md delete mode 100644 changes/1190-Shados.md delete mode 100644 changes/1192-samuelcolvin.md delete mode 100644 changes/1207-Kazy.md delete mode 100644 changes/1210-prettywood.md delete mode 100644 changes/1222-samuelcolvin.md delete mode 100644 changes/1228-paul-ilyin.md delete mode 100644 changes/1229-esadruhn.md delete mode 100644 changes/1237-adamgreg.md delete mode 100644 changes/1248-kokes.md delete mode 100644 changes/1258-leosussan.md delete mode 100644 changes/1286-masalim2.md delete mode 100644 changes/1291-StephenBrown2.md delete mode 100644 changes/1301-StephenBrown2.md delete mode 100644 changes/1307-prettywood.md delete mode 100644 changes/1310-FuegoFro.md delete mode 100644 changes/1317-samuelcolvin.md delete mode 100644 changes/1326-samuelcolvin.md delete mode 100644 changes/1328-atheuz.md delete mode 100644 changes/1330-atheuz.md delete mode 100644 changes/1342-prettywood.md delete mode 100644 changes/1345-b0g3r.md delete mode 100644 changes/1367-kittipatv.md delete mode 100644 changes/1383-samuelcolvin.md delete mode 100644 changes/1396-lmcnearney.md delete mode 100644 changes/1397-AlexECX.md delete mode 100644 changes/1404-AlexECX.md diff --git a/HISTORY.md b/HISTORY.md index 13bdd3a..002f7a0 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,36 @@ +## v1.5 (2020-04-18) + +* 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 (2020-01-24) * **Breaking Change:** alias precedence logic changed so aliases on a field always take priority over @@ -160,6 +193,8 @@ ## v0.32.2 (2019-08-17) +(Docs are available [here](https://5d584fcca7c9b70007d1c997--pydantic-docs.netlify.com)) + * fix `__post_init__` usage with dataclass inheritance, fix #739 by @samuelcolvin * fix required fields validation on GenericModels classes, #742 by @amitbl * fix defining custom `Schema` on `GenericModel` fields, #754 by @amitbl diff --git a/changes/1017-MrMrRobat.md b/changes/1017-MrMrRobat.md deleted file mode 100644 index 9e18659..0000000 --- a/changes/1017-MrMrRobat.md +++ /dev/null @@ -1 +0,0 @@ -Refactor `._iter()` method, 10x speed boost for `dict(model)` \ No newline at end of file diff --git a/changes/1034-MrMrRobat.md b/changes/1034-MrMrRobat.md deleted file mode 100644 index ed6d7cc..0000000 --- a/changes/1034-MrMrRobat.md +++ /dev/null @@ -1 +0,0 @@ -Add `__signature__` to models \ No newline at end of file diff --git a/changes/1179-samuelcolvin.md b/changes/1179-samuelcolvin.md deleted file mode 100644 index 32141a9..0000000 --- a/changes/1179-samuelcolvin.md +++ /dev/null @@ -1 +0,0 @@ -Add `validate_arguments` function decorator which checks the arguments to a function matches type annotations. diff --git a/changes/1190-Shados.md b/changes/1190-Shados.md deleted file mode 100644 index 7cc66b1..0000000 --- a/changes/1190-Shados.md +++ /dev/null @@ -1 +0,0 @@ -Fixed parsing of nested 'custom root type' models. diff --git a/changes/1192-samuelcolvin.md b/changes/1192-samuelcolvin.md deleted file mode 100644 index da7a14e..0000000 --- a/changes/1192-samuelcolvin.md +++ /dev/null @@ -1 +0,0 @@ -fix mypy signature for `root_validator` diff --git a/changes/1207-Kazy.md b/changes/1207-Kazy.md deleted file mode 100644 index a9e4b28..0000000 --- a/changes/1207-Kazy.md +++ /dev/null @@ -1 +0,0 @@ -add support for `NewType` of `List`, `Optional`, etc. diff --git a/changes/1210-prettywood.md b/changes/1210-prettywood.md deleted file mode 100644 index df5e7ce..0000000 --- a/changes/1210-prettywood.md +++ /dev/null @@ -1 +0,0 @@ -Add `default_factory` argument to `Field` to create a dynamic default value by passing a zero-argument callable. diff --git a/changes/1222-samuelcolvin.md b/changes/1222-samuelcolvin.md deleted file mode 100644 index 896fc1e..0000000 --- a/changes/1222-samuelcolvin.md +++ /dev/null @@ -1 +0,0 @@ -Support instance methods and class methods with `@validate_arguments` diff --git a/changes/1228-paul-ilyin.md b/changes/1228-paul-ilyin.md deleted file mode 100644 index 76cbfc3..0000000 --- a/changes/1228-paul-ilyin.md +++ /dev/null @@ -1 +0,0 @@ -`update_forward_refs()` method of BaseModel now copies `__dict__` of class module instead of modyfying it \ No newline at end of file diff --git a/changes/1229-esadruhn.md b/changes/1229-esadruhn.md deleted file mode 100644 index 45975e3..0000000 --- a/changes/1229-esadruhn.md +++ /dev/null @@ -1 +0,0 @@ -Document how to manage Generics and inheritance. \ No newline at end of file diff --git a/changes/1237-adamgreg.md b/changes/1237-adamgreg.md deleted file mode 100644 index fbbfab6..0000000 --- a/changes/1237-adamgreg.md +++ /dev/null @@ -1 +0,0 @@ -Make `pattern_validator()` accept pre-compiled `Pattern` objects. Fix `str_validator()` return type to `str`. \ No newline at end of file diff --git a/changes/1248-kokes.md b/changes/1248-kokes.md deleted file mode 100644 index c6df978..0000000 --- a/changes/1248-kokes.md +++ /dev/null @@ -1 +0,0 @@ -In examples, type nullable fields as `Optional`, so that these are valid mypy annotations. diff --git a/changes/1258-leosussan.md b/changes/1258-leosussan.md deleted file mode 100644 index e0d1650..0000000 --- a/changes/1258-leosussan.md +++ /dev/null @@ -1 +0,0 @@ -Add pydantic.color.Color objects as available input for Color fields \ No newline at end of file diff --git a/changes/1286-masalim2.md b/changes/1286-masalim2.md deleted file mode 100644 index db1b598..0000000 --- a/changes/1286-masalim2.md +++ /dev/null @@ -1 +0,0 @@ -Exclude exported fields from all elements of a list/tuple of submodels/dicts with `'__all__'`. diff --git a/changes/1291-StephenBrown2.md b/changes/1291-StephenBrown2.md deleted file mode 100644 index b1374f0..0000000 --- a/changes/1291-StephenBrown2.md +++ /dev/null @@ -1 +0,0 @@ -Allow subclasses of known types to be encoded with superclass encoder \ No newline at end of file diff --git a/changes/1301-StephenBrown2.md b/changes/1301-StephenBrown2.md deleted file mode 100644 index 46cf625..0000000 --- a/changes/1301-StephenBrown2.md +++ /dev/null @@ -1 +0,0 @@ -Add `datetime` field to `default_factory` example diff --git a/changes/1307-prettywood.md b/changes/1307-prettywood.md deleted file mode 100644 index 21ac3d9..0000000 --- a/changes/1307-prettywood.md +++ /dev/null @@ -1 +0,0 @@ -Allow `None` as input to all optional list fields diff --git a/changes/1310-FuegoFro.md b/changes/1310-FuegoFro.md deleted file mode 100644 index 83c392e..0000000 --- a/changes/1310-FuegoFro.md +++ /dev/null @@ -1 +0,0 @@ -Have `BaseModel` inherit from `Representation` to make mypy happy when overriding `__str__`. diff --git a/changes/1317-samuelcolvin.md b/changes/1317-samuelcolvin.md deleted file mode 100644 index af16af0..0000000 --- a/changes/1317-samuelcolvin.md +++ /dev/null @@ -1 +0,0 @@ -fix card number length check in `PaymentCardNumber`, `PaymentCardBrand` now inherits from `str`. diff --git a/changes/1326-samuelcolvin.md b/changes/1326-samuelcolvin.md deleted file mode 100644 index 8217ecc..0000000 --- a/changes/1326-samuelcolvin.md +++ /dev/null @@ -1,2 +0,0 @@ -Move all testing and build to github actions, add windows and macos binaries, -thank you @StephenBrown2 for much help diff --git a/changes/1328-atheuz.md b/changes/1328-atheuz.md deleted file mode 100644 index f4068a1..0000000 --- a/changes/1328-atheuz.md +++ /dev/null @@ -1 +0,0 @@ -document making secret types dumpable using the json method diff --git a/changes/1330-atheuz.md b/changes/1330-atheuz.md deleted file mode 100644 index 4e0f4da..0000000 --- a/changes/1330-atheuz.md +++ /dev/null @@ -1 +0,0 @@ -Make `SecretStr` and `SecretBytes` initialization idempotent diff --git a/changes/1342-prettywood.md b/changes/1342-prettywood.md deleted file mode 100644 index ddb666e..0000000 --- a/changes/1342-prettywood.md +++ /dev/null @@ -1 +0,0 @@ -Remove `typing_extensions` dependency for python 3.8 diff --git a/changes/1345-b0g3r.md b/changes/1345-b0g3r.md deleted file mode 100644 index bcc0996..0000000 --- a/changes/1345-b0g3r.md +++ /dev/null @@ -1 +0,0 @@ -Replace raising of exception to silent passing for non-Var attributes in mypy plugin \ No newline at end of file diff --git a/changes/1367-kittipatv.md b/changes/1367-kittipatv.md deleted file mode 100644 index 065bb0e..0000000 --- a/changes/1367-kittipatv.md +++ /dev/null @@ -1 +0,0 @@ -Renaming `model_name` argument of `main.create_model()` to `__model_name` to allow using `model_name` as a field name. diff --git a/changes/1383-samuelcolvin.md b/changes/1383-samuelcolvin.md deleted file mode 100644 index 04e1d42..0000000 --- a/changes/1383-samuelcolvin.md +++ /dev/null @@ -1 +0,0 @@ -Confirm that shallow `model.copy()` does make a shallow copy of attributes. diff --git a/changes/1396-lmcnearney.md b/changes/1396-lmcnearney.md deleted file mode 100644 index 48448e7..0000000 --- a/changes/1396-lmcnearney.md +++ /dev/null @@ -1 +0,0 @@ -Update constr regex example to include start and end lines \ No newline at end of file diff --git a/changes/1397-AlexECX.md b/changes/1397-AlexECX.md deleted file mode 100644 index 1377f8a..0000000 --- a/changes/1397-AlexECX.md +++ /dev/null @@ -1 +0,0 @@ -Always use a field's real name with includes/excludes in `model._iter()`, regardless of `by_alias`. \ No newline at end of file diff --git a/changes/1404-AlexECX.md b/changes/1404-AlexECX.md deleted file mode 100644 index f27fa4d..0000000 --- a/changes/1404-AlexECX.md +++ /dev/null @@ -1 +0,0 @@ -Make includes/excludes arguments for `.dict()`, `._iter()`, ..., immutable. diff --git a/docs/index.md b/docs/index.md index b483a25..9ddc367 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,4 +1,4 @@ -[![CI](https://github.com/samuelcolvin/pydantic/workflows/CI/badge.svg)](https://github.com/samuelcolvin/pydantic/actions?query=workflow%3ACI) +[![CI](https://github.com/samuelcolvin/pydantic/workflows/CI/badge.svg?event=push)](https://github.com/samuelcolvin/pydantic/actions?query=event%3Apush+branch%3Amaster+workflow%3ACI) [![Coverage](https://codecov.io/gh/samuelcolvin/pydantic/branch/master/graph/badge.svg)](https://codecov.io/gh/samuelcolvin/pydantic) [![pypi](https://img.shields.io/pypi/v/pydantic.svg)](https://pypi.python.org/pypi/pydantic) [![CondaForge](https://img.shields.io/conda/v/conda-forge/pydantic.svg)](https://anaconda.org/conda-forge/pydantic) @@ -13,10 +13,6 @@ Data validation and settings management using python type annotations. Define how data should be in pure, canonical python; validate it with *pydantic*. -!!! note "Version 0.32 Documentation" - This documentation refers to Version 1 of *pydantic* which has just been released, **v0.32.2** - (the previous release) docs are available [here](https://5d584fcca7c9b70007d1c997--pydantic-docs.netlify.com). - ## Example ```py diff --git a/docs/usage/models.md b/docs/usage/models.md index 57a766a..7ca9ecf 100644 --- a/docs/usage/models.md +++ b/docs/usage/models.md @@ -263,11 +263,6 @@ For example, in the example above, if `_fields_set` was not provided, ## Generic Models -!!! note - New in version **v0.29**. - - This feature requires Python 3.7+. - Pydantic supports the creation of generic models to make it easier to reuse a common model structure. In order to declare a generic model, you perform the following steps: diff --git a/pydantic/version.py b/pydantic/version.py index fef3ebb..0c4c114 100644 --- a/pydantic/version.py +++ b/pydantic/version.py @@ -1,6 +1,6 @@ -__all__ = ['VERSION', 'version_info'] +__all__ = 'VERSION', 'version_info' -VERSION = '1.5a1' +VERSION = '1.5' def version_info() -> str: