Commit Graph

307 Commits

Author SHA1 Message Date
Jere Lahelma db53fad28d add py.typed marker file for PEP-561 support (#391)
Fix #390

Disable zip_safe option as mypy is incompatible with it.
2019-02-13 15:11:33 +00:00
Daniel Smith 96e3e74262 Tracking for setting attributes (#389)
fix #378

* Tracking for setting attributes

* Fixes accidental leak of fields

* Allows defaults fields to be recursively set

* Docs and history for skip_defaults

* Mypy fix on calculate keys

* Update pydantic/main.py

Co-Authored-By: dgasmith <dgasmith@icloud.com>

* Update pydantic/main.py

Co-Authored-By: dgasmith <dgasmith@icloud.com>

* Update HISTORY.rst

Co-Authored-By: dgasmith <dgasmith@icloud.com>

* Cleanup pass based off review

* Simplifies constructors based on feedback

* Makes mypy happy with exlicit KeysView

* SetOrKeys and faster key search

* Formats files once more

* add tests for dict, pickle and construct

* fixes for dict, pickle and construct

* correct field_set for extra.ignore

* Fixes format
2019-02-13 15:10:45 +00:00
Samuel Colvin baade9a117 rebuild validator arguments (#388)
* rebuild validator arguments

* cleanup and tests

* update docs
2019-02-13 10:31:36 +00:00
Samuel Colvin 8fa1382beb change ms/s watershed for datetime parsing (#385)
* change ms/s watershed for datetime parsing

* more tests for ms, μs and ns

* fix formatting

* uprev
2019-02-04 22:09:51 +00:00
Samuel Colvin 04391da318 fix for 'missing' error with validate_all or validate_always (#381)
* fix for 'missing' error with validate_all or validate_always

* update HISTORY
2019-02-04 21:57:44 +00:00
Samuel Colvin 9ef401839b add type hints (#373)
* add type hints, fix #372

* fix tests and BaseModel inference

* fix #280

* fix dataclasses and docs

* more typing

* adding hints to fields.py

* type **EVERTHING*

* fix for 3.6

* small speed ups and some typ checks

* correct model.copy

* update history
2019-02-04 21:54:20 +00:00
pyup.io bot a85334682c Scheduled monthly dependency update for February (#382)
* Update flake8 from 3.6.0 to 3.7.4

* Update mypy from 0.650 to 0.660

* Update pycodestyle from 2.4.0 to 2.5.0

* Update pyflakes from 2.0.0 to 2.1.0

* Update pytest from 4.0.2 to 4.2.0

* Update pytest-cov from 2.6.0 to 2.6.1

* fix test linting
2019-02-04 20:31:42 +00:00
Or Carmi 9900c7f00c Refactored extra types to use a single enum (#352)
deprecated `ignore_extra` and `allow_extra` Config fields in favor of `extra`, fix #352

* refaactored extra types to use a single enum

* slightly simplified

* added tests

* fixed most stuff

* docs and some simplifications

* better assert

* changed enum and fixed logic

* trying to capture deprecation warning

* make format

* fixing tests and moving exta logic to __new__

* set_extra tests

* fox benchmarks

* formatting

* updated history

* docs

* added a negative tests

* reverted format changes

* format

* matched casing

* renamed values

* more fixes

* forgot values change

* another one

* weird stuff

* linting issue

* Update pydantic/main.py

Co-Authored-By: liiight <4374581+liiight@users.noreply.github.com>
2019-02-04 13:15:07 +00:00
Stephen Brown II 61e758965c Add multiple_of attribute to constrained numerics (#371)
* Add multiple_of attribute to constrained numerics

* Update HISTORY.rst

* make format

* Change limit_value -> multiple_of
2019-02-03 17:13:27 +00:00
James Bradshaw 67c965fb50 Fix typo in index.rst (#383) 2019-02-03 17:10:54 +00:00
Samuel Colvin f287d41590 correct python_tag, fix #376 (#379) 2019-01-30 17:22:51 +00:00
Sebastián Ramírez 725e86a8f0 custom validators in schema (#375)
* Test NoneType directly in Field.include_in_schema and add test for validator

fix #363

* Update History
2019-01-30 10:31:45 +00:00
Artem Malyshev 987449a922 Support typing.Callable validation. (#364)
fix #279

* Support typing.Callable validation.

* Add myself to HISTORY.

* Prove it works with just Callable.

* Document callable validator behavior.

* Support differences in typing module between py36 and py37.

* Remove callable filed from JSON schema with warning.

* Update pydantic/schema.py

Co-Authored-By: proofit404 <proofit404@gmail.com>

* Update tests/test_callable.py

Co-Authored-By: proofit404 <proofit404@gmail.com>

* Update pydantic/validators.py

Co-Authored-By: proofit404 <proofit404@gmail.com>

* Update tests/test_callable.py

Co-Authored-By: proofit404 <proofit404@gmail.com>

* Move callables to the exotic types.

* Move Callable type choice to the import time.

* Move is_callable_type to the utils module.

* Raise warning at skip except.

* Update pydantic/schema.py

Co-Authored-By: proofit404 <proofit404@gmail.com>

* Update docs/index.rst

Co-Authored-By: proofit404 <proofit404@gmail.com>

* Update pydantic/schema.py

Co-Authored-By: proofit404 <proofit404@gmail.com>

* uprev

* Update index.rst (#370)

* Update history.rst

* Make the example a little more concise.

* Use callable import from the utils.

* Remove blank line.

* Remove duplication comments.

* fix history
2019-01-29 15:42:00 +00:00
Daniel Smith 39dd347607 Update index.rst (#370) 2019-01-26 17:55:29 +00:00
Samuel Colvin 06b0c41276 uprev 2019-01-22 18:34:28 +00:00
Samuel Colvin 2fb0b26b81 tweak schema, fix #361 (#362) 2019-01-20 14:50:49 +00:00
Samuel Colvin 8cb3557aec adding MANIFEST.in (#358)
* adding MANIFEST.in

* uprev
2019-01-17 20:59:58 +00:00
Nikita Grishko 145f04cb5d add `ConstrainedBytes and conbytes` types #315 (#357)
fix #315
2019-01-17 13:57:49 +00:00
Samuel Colvin 0c1482aaba uprev 2019-01-13 09:12:44 +00:00
Samuel Colvin 3c3c0262c0 add contributing docs, (#354)
* add contributing docs, fix #353

* tweaks

* tweaks
2019-01-11 21:08:14 +00:00
Samuel Colvin 25b5d98030 support postponed annotations and ForwardRef in python 3.7 (#348)
* support postponed annotations in python 3.7

* support for full ForwardRef

* tweak update_forward_refs

* better ForwardRef resolution

* remove debug, fix linting

* fix comments

* docs and history
2019-01-11 21:01:07 +00:00
Sebastián Ramírez 32d5cdcb30 Fix BaseConfig max_anystr_length default to fixed number to None (#350)
* Fix BaseConfig max_anystr_length default to fixed number to None

* Update History
2019-01-07 13:59:25 +00:00
Samuel Colvin 3c4c163dc5 fix allow_population_by_alias (#346)
* fix allow_population_by_alias, fix #257

* update history
2018-12-29 16:16:10 +00:00
Samuel Colvin dd202998bd improve docs for allow_extra and ignore_extra, fix #301 (#345) 2018-12-29 12:32:50 +00:00
Samuel Colvin 19320bf775 improve settings priority, (#343)
* improve settings priority, ref #341

* add HISTORY.rst

* move is_complex and rename _build_environ

* tweak
2018-12-29 12:31:53 +00:00
Samuel Colvin 6514307677 update pull request template 2018-12-29 12:01:05 +00:00
Samuel Colvin 0f7f8fcf14 allow validate_always with default=None (#344)
* allow validate alwasy with None, fix #132

* prevent whole validators being called on subitems

* improve Optional validators edge cases
2018-12-29 11:07:45 +00:00
Samuel Colvin b43b887ec3 docs typo 2018-12-28 16:11:00 +00:00
Samuel Colvin eeb48fbeac don't call validators on keys of dictionaries, fix #254 (#342) 2018-12-28 16:07:48 +00:00
Samuel Colvin 3d4dc90d4b classifiers and python-tag 2018-12-27 23:44:13 +00:00
Samuel Colvin 993510d531 set release date 2018-12-27 22:35:09 +00:00
Samuel Colvin c2bae0a05d support ClassVar, (#339)
* support ClassVar, fix #184

* fix tests, update history
2018-12-27 20:44:02 +00:00
Samuel Colvin 9ad1a0ad24 reame get_validators > __get_validators__ (#338)
* reame get_validators > __get_validators__

* update docs
2018-12-27 20:30:41 +00:00
Никита Конин e28d689f8c Simple iterables schema generation (#335)
* add schema generation for `list`, `tuple` and `set`

* add #335 mention to HISTORY.rst
2018-12-27 20:18:58 +00:00
Samuel Colvin 0d5cd3bce5 better import errors, fix #309 (#336) 2018-12-27 19:37:53 +00:00
Samuel Colvin 8301f9e4b2 dataclass validation (#334)
* dataclass validation, fix #273

* support for tuple or dict in dataclasses

* tweaks

* adding example in docs
2018-12-27 19:15:39 +00:00
Sebastián Ramírez c6d1a69bdd Add support for ConstrainedStr as dict keys (#332)
* Add support for ConstrainedStr as dict keys, fix #329

* Update History with PR number

* Remove test for nonexisting case, raise coverage

* Simplify constr dict key implementation, as per code review
2018-12-27 18:32:17 +00:00
jarekkar 72791787ea Add support for passing Configs to Dataclasses (#285)
* Add support for passing Configs to Dataclasses

* formatting and fixes

* move tests into dataclasses_config.py

* use inherit_config in create_model

fix #276
2018-12-27 17:54:17 +00:00
Никита Конин d3cec7be56 Fix schema generation for fields annotated as : dict (#331)
* #330 Fix schema generation for fields annotated as `: dict`

* #330 update history.rst

* #330 format on linter's advice
2018-12-27 09:48:11 +00:00
Samuel Colvin 94fc64f5e1 uprev pydantic and test deps 2018-12-25 22:55:18 +00:00
Samuel Colvin 8635accd95 prevent duplicate validator check in ipython (#328)
* prevent duplicate validator check in ipython, fix #312

* update history
2018-12-25 22:40:47 +00:00
Samuel Colvin c725a4a5e5 prevent validators being called repeatedly after inheritance (#327)
* prevent validators being called repeatedly after inheritance

* fix linting

* more tests
2018-12-25 22:33:18 +00:00
Samuel Colvin 2512f25df7 tweak 'Using Pydantic' (#326)
* tweak 'Using Pydantic'

* typo

* remove gitter
2018-12-25 21:32:05 +00:00
Sebastián Ramírez 96020e91f6 Add section "Based on Pydantic" with FastAPI (#323)
* Add section "Based on Pydantic" with FastAPI

* Update History

* Update Third-Party libraries section, based on the style of AIOHTTP

* Remove release History details
2018-12-23 12:15:26 +00:00
Sebastián Ramírez 81f155864e Fix schema for timedelta as number, instead of str (#325) 2018-12-23 12:13:29 +00:00
Samuel Colvin 1f270dd84a uprev. 2018-12-10 10:00:21 +00:00
Hugo Duncan 3249330b80 Properly set Config in create_model (#320)
* Properly set Config in create_model

Set the Config attribute in create_model, so it is found by the
MetaModel.

* Black formatting fixes

* Remove uneeded validator logic

* Use single quotes

* Add return value to inherit_validators

* Refactor inherit_validators

* Add HISTORY.rst entry

* Address feedback

* Extend existing validator test cases and remove field aliasing

* Add test cases for validators inherted from parent

* Make test case names consistent with where validators are configured

* Add detail create_model validator inheritance tests
2018-12-07 20:27:42 +00:00
Samuel Colvin 86949c2ba2 uprev. 2018-12-03 12:45:45 +00:00
Samuel Colvin 7a06736ead Add additional parameters to Schema for validation and annotation (#319)
* Add additional parameters to Schema for validation and annotation (#311)

* Add tests for validation declared via Schema class in defaults

* Add validations to field from declarations in Schema

* Add annotations in generated JSON Schema from validations via Schema

* Augment tests for schema generation

* Simplify validations from Schema in fields, from coverage hints

* Update schema test to use the spec plural "examples"

* Add docs and simple example of the additional parameters for Schema

* Update history

* Fix number of PR in HISTORY

* Refactor check for numeric types, remove break to make coverage happy

* Fix typo in docs, I confused gt with maximum

* Finish docstring for Schema (I had forgotten about it)

* Implement code review requests and lenient_issubclass with tests

* Move Schema to its now file to extract from fields.py but avoid circular imports

* Control coverage

* Schema fixes (#318)

* rearrange code

* cleanup get_annotation_from_schema

* fix typo

* rename _schema to schema
2018-12-03 12:37:39 +00:00
pyup.io bot a34cfd23da Scheduled monthly dependency update for December (#316)
* Update pygments from 2.2.0 to 2.3.0

* Update sphinx from 1.8.1 to 1.8.2

* Update coverage from 4.5.1 to 4.5.2

* Update pytest from 3.9.3 to 4.0.1

* Update pytest-sugar from 0.9.1 to 0.9.2
2018-12-03 09:32:37 +00:00