Commit Graph

808 Commits

Author SHA1 Message Date
Samuel Colvin f219501ff0 tests for missing user 2020-06-29 22:30:04 +01:00
John Carter ff20477521 Apply __modify_schema__ on enum schema rather than fields that use it (#1581)
* Apply __modify_schema__ on enum schema rather than fields that use it

Resolves #1576

* tweak test

* correct linting :-(

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2020-06-29 13:22:27 +01:00
dc HHH 3a00e580d6 check ModelField().validate_always when inheriting (#1545)
* fix issure #1155

* add changes.1545-dcHHH.md

* improve change description

Co-authored-by: dchhh <hudacong@geetest.com>
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
2020-06-29 13:20:06 +01:00
ll H 847279416f check ModelField().validate_always when inheriting (#1545)
* fix issure #1155

* add changes.1545-dcHHH.md

* improve change description

Co-authored-by: dchhh <hudacong@geetest.com>
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
2020-06-29 11:56:54 +01:00
ll H 8aebba2c35 check ModelField().validate_always when inheriting (#1545)
fix #1155

* fix issure #1155

* add changes.1545-dcHHH.md

* improve change description

Co-authored-by: dchhh <hudacong@geetest.com>
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
2020-06-29 11:04:44 +01:00
PrettyWood e5fff9ccd0 fix: make pydantic errors (un)pickable (#1630)
* fix: make pydantic errors (un)pickable

closes #1616

* add typing

* refactor: rename kwargs into ctx
2020-06-27 19:31:23 +01:00
Yuri Khan 908f6edb72 Document default regex anchoring semantics (#1631) (#1648) 2020-06-27 19:16:32 +01:00
Yuri Khan d5e1c88fda Document schema_extra calling convention (#1645) 2020-06-27 18:53:59 +01:00
Ram Rachum ecb54c5d36 Use chain.from_iterable in class_validators.py (#1642)
* Use chain.from_iterable in class_validators.py

* fix change

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2020-06-27 18:43:28 +01:00
Patrick Wang 5a2d78765a squash internal __root__ models in .dict() (#1607)
fix #1414

* flatten internal __root__ models

* add 1414 changes doc
2020-06-27 14:55:17 +01:00
Mlbiche 113921c6c5 Update datetime parser to support negative timestamps (#1605)
- Negative timestamps corresponds to dates before 1970/1/1
2020-06-27 14:52:20 +01:00
Samuel Eklund 7bd635c21c Subclass validator each item docs (#1592)
* add description of subclass each_item scenario

* add example of subclass validator with each_item

* each_item causes validator to not run when parent class has List field #1566
2020-06-27 14:51:18 +01:00
PrettyWood 7ac9faf031 (fix) use right type check when modifying schema (#1562)
fix #1552
2020-06-27 14:12:36 +01:00
PrettyWood c59db275dc fix(field): remove some side effects of default_factory (#1504)
* Avoid some side effects of default factory

- by calling it only once if possible (fix #1491)
- by not setting the default value in the schema (fix #1520)

* refactor: ensure type is set when using default_factory
2020-06-27 14:02:29 +01:00
Ionuț Ciocîrlan e038f114cb document ability to use Field() in create_model() (#1492) 2020-06-27 13:59:26 +01:00
Samuel Colvin f85afab8cf tiny correction to docs 2020-06-27 13:58:23 +01:00
Samuel Colvin 12c741477c Revert "add configs to validate_arguments (#1378)" (#1662)
This reverts commit e690f0878e.
2020-06-27 13:46:17 +01:00
Samuel Colvin 43f61d4b76 error on failed import in benchmarks (#1661) 2020-06-27 13:42:59 +01:00
quantpy e690f0878e add configs to validate_arguments (#1378)
* add `configs` to validate_arguments

* simplify `validate_arguments` and add annotation for parameter `configs`

* change double quotes to single quotes

* reformat code

* fix mypy error

* fix mypy 'maximum semantic analysis' error

* rename 'configs' > 'config_params'

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2020-06-27 12:48:10 +01:00
Samuel Colvin d122b1dbdc remove RedisDsn.user_required = True (#1658)
* remove RedisDsn.user_required = True

* update docs
2020-06-26 12:02:57 +01:00
dependabot-preview[bot] d726497b5b Bump mypy from 0.780 to 0.782 (#1659)
Bumps [mypy](https://github.com/python/mypy) from 0.780 to 0.782.
- [Release notes](https://github.com/python/mypy/releases)
- [Commits](https://github.com/python/mypy/compare/v0.780...v0.782)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-26 12:02:32 +01:00
Samuel Colvin 8e00077cc4 uprev test dependencies (#1657) 2020-06-25 21:40:34 +01:00
dependabot-preview[bot] 70d531ff4c Bump mypy from 0.770 to 0.780 (#1598)
* Bump mypy from 0.770 to 0.780

Bumps [mypy](https://github.com/python/mypy) from 0.770 to 0.780.
- [Release notes](https://github.com/python/mypy/releases)
- [Commits](https://github.com/python/mypy/compare/v0.770...v0.780)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* fix mypy errors and remove AnyType

* fix python 3.6 inconsistencies

* linting

* tweak typing

* fix typing for 3.6

* bump

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2020-06-25 19:24:37 +01:00
Fredrik Jonsén 97b6b46268 docs: add missing period and capitalize where appropriate (#1653) 2020-06-23 18:47:39 +01:00
PrettyWood 0cee311be5 feat(settings): allow custom encoding for dotenv files (#1620)
closes #1615
2020-06-11 11:04:08 +01:00
PrettyWood 329b1d3e7b fix: type hints on BaseConfig (#1618)
closes #1614
2020-06-09 10:32:07 +01:00
wangpeibao 5e82689c79 Change schema frozenset (#1560)
* add frozenset to field_class_to_schema

* add change.md

* add my test

* format my test

* remove print()

* just test

* return to original code

Co-authored-by: wangpeibao <wangpeibao@troila.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2020-06-02 11:03:12 +01:00
dependabot-preview[bot] f89e372bda Bump flake8 from 3.8.1 to 3.8.2 (#1553)
Bumps [flake8](https://gitlab.com/pycqa/flake8) from 3.8.1 to 3.8.2.
- [Release notes](https://gitlab.com/pycqa/flake8/tags)
- [Commits](https://gitlab.com/pycqa/flake8/compare/3.8.1...3.8.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-31 15:23:37 +01:00
Koudai Aono 6e29848608 Add datamodel-code-generator link in pydantic document site (#1532)
* Add datamodel-code-generator link in pydantic document site.

* tweak menu

* fix blank lines

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2020-05-31 15:23:20 +01:00
Samuel Colvin 63ec6fffe3 update docs on generics, fix #1547 (#1584) 2020-05-31 15:08:57 +01:00
Samuel Colvin 2a5914c841 closes #1534 (#1559) 2020-05-31 15:08:32 +01:00
Shawn Wall 4f9e77d213 1541 UUID bytes support for 16 byte strings / BINARY(16) (#1542)
* [1541] add fallback to UUID instantiation through bytes

* [1541] added changes md file

* Update UUID docs for bytes/bytearray

Co-authored-by: Shawn Wall <shawn@civicscience.com>
2020-05-31 15:05:53 +01:00
dependabot-preview[bot] 0c39cc429c Bump mkdocs-material from 5.1.7 to 5.2.2 (#1567)
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 5.1.7 to 5.2.2.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/5.1.7...5.2.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-31 15:05:27 +01:00
Samuel Colvin dc094f1211 fix blank lines in docs 2020-05-31 15:05:06 +01:00
dependabot-preview[bot] cb8e7e0930 Bump pytest-cov from 2.8.1 to 2.9.0 (#1555)
Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 2.8.1 to 2.9.0.
- [Release notes](https://github.com/pytest-dev/pytest-cov/releases)
- [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-cov/compare/v2.8.1...v2.9.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-31 14:58:51 +01:00
dependabot-preview[bot] d6f446fdc0 Bump cython from 0.29.17 to 0.29.19 (#1544)
Bumps [cython](https://github.com/cython/cython) from 0.29.17 to 0.29.19.
- [Release notes](https://github.com/cython/cython/releases)
- [Changelog](https://github.com/cython/cython/blob/master/CHANGES.rst)
- [Commits](https://github.com/cython/cython/compare/0.29.17...0.29.19)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-31 14:58:38 +01:00
dependabot-preview[bot] 43edbe321d Bump email-validator from 1.1.0 to 1.1.1 (#1538)
Bumps [email-validator](https://github.com/JoshData/python-email-validator) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/JoshData/python-email-validator/releases)
- [Commits](https://github.com/JoshData/python-email-validator/compare/v1.1.0...v1.1.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-31 14:58:11 +01:00
Stephen Brown II ba2cc5c557 Make assertion match message (#1533) 2020-05-31 14:57:37 +01:00
Stephen Brown II ec1dca9126 Add linting for docs/examples (#1530) 2020-05-31 14:54:12 +01:00
John Carter 827388b4fe Add a test assertion that default_factory can return a singleton (#1523) 2020-05-31 14:51:50 +01:00
Luka Peschke 1bff80459d Add an example to documentation for reserved ORM field names (#1474)
Signed-off-by: Luka Peschke <mail@lukapeschke.com>
2020-05-31 14:44:23 +01:00
Alexander Hultnér 2eb62a3b2f Added a "Talks and video tutorials" section (#1499)
* Added a "Talks and video tutorials" section

Added my "Python pydantic Introduction – Give your data classes super powers" talk YouTube video based on the talk for Python Pizza.

* Add changelog entry for video change

Did this after creating the pr so I would have the number to use as a reference.

* Moved video into a discussion subsection

Now placed under testimonials

* Updated change log entry to reflect changes.
2020-05-26 07:50:56 +01:00
Calvin Young 5195e55c10 Enums as separate models (#1432)
* Updates schema() to generate enums as separate models

* Fixes mypy annotations

* Adds changes file

* Fixes comment

* Removes unused import

* Fixes test case

* Fixes missing partial branch in test coverage

* Resolves PR comments

* 🐛 Include enums in flat model schema handling

as they now have independent schemas, they kinda behave like top-level models, and should be taken into account for top level definitions

*  Add test for coverage

* 🐛 Use Type[Enum] as type for consistency

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2020-05-23 19:11:34 +01:00
Daniel Burkhardt Cerigo 913025ac3f FIX: validation on model attribute with nested Literal breaks (#1364)
* Add tests for nested literals validator

* Implement flatten literal in validator

* Add test for flatten literal

* Add changelog entry

* Add test skip markers if not Literal

* Refactor: use improved all literals implementation

From Github user PrettyWood, see PR https://github.com/samuelcolvin/pydantic/pull/1364

* Add testing for typing module

Includes moving corresponding tests.

* Remove unnecessary type hint

* Move all literals test to test_utils
2020-05-23 13:01:43 +01:00
Samuel Colvin 58b95b7e50 change sponsorship to github 2020-05-22 16:04:39 +01:00
Stephen Bunn 1eeb225c67 Fix NameEmail equality comparison (#1527)
* Adding appropriate __eq__ method for NameEmail

- Introducing new test assertions for NameEmail

Signed-off-by: Stephen Bunn <stephen@bunn.io>

* Adding change doc for NameEmail.__eq__

Signed-off-by: Stephen Bunn <stephen@bunn.io>

* Update pydantic/networks.py

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>

* Update tests/test_networks.py

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>

* Fixing indentation issue left over from suggestion

Signed-off-by: Stephen Bunn <stephen@bunn.io>

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
2020-05-19 08:59:33 +01:00
Mike Grima 28c2ac7a43 Added docs on dumping dataclasses to JSON (#1487) 2020-05-18 21:55:49 +01:00
Arseny Boykov 0b9b308ca5 Make signature class only (#1466)
* Make signature class only

* Add changes file
2020-05-18 21:41:24 +01:00
Samuel Colvin c8906ce810 uprev all test and docs dependencies (#1528) 2020-05-18 21:31:23 +01:00
dependabot-preview[bot] 0c206a4c72 Bump email-validator from 1.0.5 to 1.1.0 (#1468)
Bumps [email-validator](https://github.com/JoshData/python-email-validator) from 1.0.5 to 1.1.0.
- [Release notes](https://github.com/JoshData/python-email-validator/releases)
- [Commits](https://github.com/JoshData/python-email-validator/compare/v1.0.5...v1.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-18 18:56:14 +01:00