Commit Graph

305 Commits

Author SHA1 Message Date
dependabot-preview[bot] dc72ae00a3 Bump mkdocs-material from 5.3.3 to 5.4.0 (#1672)
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 5.3.3 to 5.4.0.
- [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.3.3...5.4.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-07-03 20:44:47 +01:00
Yuri Khan 259a1a0ff8 Fix typo (#1631) (#1674) 2020-07-01 14:47:44 +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
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 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
Samuel Colvin f85afab8cf tiny correction to docs 2020-06-27 13:58:23 +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
Samuel Colvin 8e00077cc4 uprev test dependencies (#1657) 2020-06-25 21:40:34 +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
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
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
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
Mike Grima 28c2ac7a43 Added docs on dumping dataclasses to JSON (#1487) 2020-05-18 21:55:49 +01:00
Samuel Colvin c8906ce810 uprev all test and docs dependencies (#1528) 2020-05-18 21:31:23 +01:00
Selim Belhaouane 881df8bde7 move const validator to post validators. fixes #1410 (#1446) 2020-04-30 19:05:42 +01:00
Jerry 9b2310a7d3 Fixed typo (#1456)
stictness -> strictness
2020-04-30 13:06:53 +01:00
dependabot-preview[bot] de24ae968b Bump mkdocs-material from 5.1.1 to 5.1.3 (#1440)
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 5.1.1 to 5.1.3.
- [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.1...5.1.3)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-30 13:05:25 +01:00
dependabot-preview[bot] 5c6ab56015 Bump mkdocs-material from 5.1 to 5.1.1 (#1406)
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 5.1 to 5.1.1.
- [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.0...5.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-04-22 11:15:42 +01:00
Samuel Colvin 67acb659c2 prepare v1.5 release 2020-04-18 17:32:16 +01:00
Stephen Brown II cab6313798 Allow subclasses of known types to be encoded with superclass encoder (#1291)
* Add (failing) test for Subclass JSON encoding

* Allow subclasses of known types to be encoded with superclass encoder

* Add change file

* Add documentation, fix custom json_encoders and add unit test

Blacken doc
Fix test that worked on my machine
datetime.timestamp() is flakey?
Single quotes only

* Reduce lookups

- Remove last element in `__mro__` as it will always be `object`
- Use .get for compactness

* Regarding the loop

* Move Path and Enum into ENCODERS_BY_TYPE

Sort ENCODERS_BY_TYPE

* improve JSON docs

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2020-04-18 17:11:00 +01:00
Lance McNearney 161a12a1a1 Update constr regex example to include start and end lines (#1400)
This is due to the regex using `re.match()` which allows for only a partial match, fix #1396
2020-04-18 17:02:22 +01:00
Samuel Colvin ec25f60d27 correct name of validate_arguments in docs (#1375)
* correct naem of validate_arguments in docs

* bump

* Update docs/usage/validation_decorator.md

Co-Authored-By: Stephen Brown II <Stephen.Brown2@gmail.com>

* Apply suggestions from code review

Co-Authored-By: Stephen Brown II <Stephen.Brown2@gmail.com>

Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>
2020-04-18 16:10:58 +01:00
Atheuz 097762b67a make secret types idempotent (#1330)
* make secret types idempotent

* remove idempotent from secret types example.
add note to docs for idempotently creating secret types.
use isinstance for comparing when creating secret types idempotently.
add assert for idempotent secret types test.

* tweaks

Co-authored-by: Lasse Gravesen <lasse.gravesen@falcon.io>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2020-04-18 16:10:36 +01:00
mikuhn 91c626eee0 docs: add hint for custom root types (#1373)
fix #1372

Co-authored-by: Michael Kuhn <michael.kuhn@uni-tuebingen.de>
2020-04-15 22:53:19 +01:00
Atheuz 7cc5dbeb6a document making secret types dumpable using the json method (#1328)
Co-authored-by: Lasse Gravesen <lasse.gravesen@falcon.io>
2020-04-15 22:05:43 +01:00
Samuel Colvin 76ebdb915d combined uprev of packages (#1395)
* combined uprev of packages

* unused f-strings

* scroll-spy on docs
2020-04-15 16:40:21 +01:00
Samuel Colvin d495710303 Cleanup ci & coverage (#1329)
* fix badges and deploy check

* fix coverage and correct check_tag.py
2020-03-21 18:14:17 +00:00
Stephen Brown II 13b002e97f Add datetime field to default_factory example (#1301)
* Add change file

* Add datetime field to default_factory example

Print instead of assert
Remove bad quotes
Remove bad quotes from all examples

* fix change description

* remove 'avoid-escape' from setup.cfg

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2020-03-18 20:23:42 +00:00
Michael (Misha) Salim ebb2e6c942 Use __all__ to exclude fields from all elements of a list/tuple of submodels. Raise more informative TypeError when passing bad exclude kwargs. (#1286)
* Raise informative TypeError when passing bad exclude kwargs to export

* Cleanup spurious example

* Add __all__ keyword to enable excluding fields from all members of a list/tuple of child submodels

* Add changelog

* Fix MD format inconsistencies and consolidate export tests

* Excluding from exported List of Dict fields with "__all__"

* tweaks

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2020-03-18 20:22:49 +00:00
dependabot-preview[bot] 567bf4eb43 Bump pygments from 2.5.2 to 2.6.1 (#1299)
Bumps [pygments](https://github.com/pygments/pygments) from 2.5.2 to 2.6.1.
- [Release notes](https://github.com/pygments/pygments/releases)
- [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES)
- [Commits](https://github.com/pygments/pygments/compare/2.5.2...2.6.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-03-17 21:04:55 +00:00
Ondrej Kokes ddc8e5a57b Fix type annotations in examples (#1248)
* README change to make type annotations valid

* example fixed to have valid type annotations

* changes description

* Update README.md

explicit assignment for an optional field

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* Update docs/examples/index_main.py

explicit assignment for an optional field

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
2020-03-04 17:26:11 +00:00
PrettyWood 78a3f42b0a Dynamic default value (#1210)
* Simplify dynamic default values

closes #866

* Add documentation and change

* Add `ModelField.get_default` method

* Fix default value in `infer`

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
2020-03-04 16:37:23 +00:00
Thaïs de Boisfossé 679e5d149e Generics inherit doc (#1249)
* doc: add an example of inheritance with Generics

* Update the changes directory with the doc changes.
2020-03-04 15:40:04 +00:00
Samuel Colvin e3243d267b upreving packages, fix python 3.7 docs generation (#1271) 2020-03-01 13:34:35 +00:00
Arseny Boykov 0f948618ba Add model signature generation (#1034)
* Add right __init__ signature generation

* Add params overlay support for custom __init__, enhance tests

* Change fake_ini creation to solve AttributeError in cython
AttributeError: attribute '__code__' of 'cython_function_or_method' objects is not writable
Possible there's other attrs that cannot be set in cython, but can't check myself yet

* Cython compatibility, add __signature__, ignore non-identifiers fields
Moved tests to separate file
Moved __init__ creation to utils

* Remove # pragma: no cover

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* Fixed adding signature to doc, some compatibility fixes

* Changed None to tuple() for py3.8 compatibility

* Finally (hope so) fix issues with closure. Add new docstring each time

* coverage for UndefinedType

* Checking signature more simple and obvious way

* Changed doc caption to simple message, used Undefined, merge conflicts

* Compatibility with py3.6

* Add changes/ file

* Ah, that space... Reformatted and ready to go!

* Update pydantic/main.py

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* Update pydantic/main.py

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* Fix signature for properties declared as fields

* Sort imports

* Add comments

* Generate BaseModel signature instead of __init__ signature

* Fixed imports

* Minor improvements from review

* Add docs for model signature

* Delete unused imports

* Fix formatting in tests

* Remove inspect imports from top level

* Update docs/examples/models_signature.py

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* Add missing import

* Remove notes from doc

* change hypothesis-auto mention to hypothesis

* Use None as slice end instead of len()

* tweak generate_model_signature

* improve docs

* Revert af3dd4d, add fields to custom init only if var_kw declared

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
2020-02-27 17:35:51 -05:00
dependabot-preview[bot] 645e5fe6a0 Bump mkdocs-material from 4.6.0 to 4.6.2 (#1215)
* Bump mkdocs-material from 4.6.0 to 4.6.2

Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 4.6.0 to 4.6.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/4.6.0...4.6.2)

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

* uprev markdown

* uprev dotenv

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
2020-02-10 11:10:12 +00:00
Samuel Colvin 948427da75 speedup and fix markdown version conflict (#1214) 2020-02-07 20:47:44 +00:00
Samuel Colvin 6914410f38 Validation Decorator (#1179)
* starting validation_decorator

* correct skip_pre_38

* fix coverage and type hints

* mypy tests and move to class based decorator

* 3.6 fix, prevent duplicate github actions

* correct py 3.6 check

* better errors

* cleaner field names for args and kwargs

* add change and comments

* starting docs

* back to 3.7 for docs

* docs

* bump

* add async example and fix print indents

* allow type annotations as strings

* python 3.8 in docs
2020-02-05 17:27:12 +00:00
Samuel Colvin 8397cde602 new docs preview (#1206)
* new docs preview

* fix docs build for python 3.8

* fix print statements in index_main.py

* bump

* fix github actions builds

* bump

* uprev

* tweaks
2020-02-03 14:07:01 +00:00
Wesley Ellis be95ddaf88 Be more specific about the meaning of Config.extra (#1203)
* Be more specific about the meaning of Config.extra

When reading through the docs as a beginner, it was not clear to me what the difference between `'allow'` and `'ignore'` was. I fixed this by adding a short description of each of the options from what I can tell from reading the source code.

Is there a better way to format this? Maybe as a list?


(ps, thanks for the cool library)

* tiny further clarification

* sorry...

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
2020-02-02 12:15:42 +00:00