Samuel Colvin
32efbf069b
dataclass import alias for export ( #783 )
...
* dataclass import alias for export, fix #781
* support --no-implicit-reexport in pydantic, add changes
2019-08-28 11:54:59 +01:00
Scott P
5015a7e48b
Improve auto-generated title in JSON schemas ( #772 )
...
* Improve auto-generated title in JSON schemas
Underscore is converted to space.
* Added changes .rst file.
2019-08-21 16:49:05 +01:00
Samuel Colvin
9dee83a689
better error message for TypeError on datetime parsing ( #766 )
...
* better error message for TypeError on datetime parsing
* add change, fix tests
* reduce scope of errors caught
2019-08-21 13:45:11 +01:00
Daniel Petti
aa5e8c60b7
Feature/frozenset support ( #762 )
...
* Better error for unsuported "typing" objects.
Fixes #745
Add a better error message for fields with types from the typing
module that are not directly supported by Pydantic. Previously,
it caused a cryptic assertion failure.
* Add support for frozenset fields.
Also provide an example of their usage.
Fixes #745
* Address review comments.
Fixes #745
* use equals not "is" for int comparison.
2019-08-21 13:13:46 +01:00
Samuel Colvin
5f634067da
moving typing related objects into typing.py ( #761 )
...
* moving typing related objects into typing.py, fix #713
* cleanup
2019-08-21 12:49:19 +01:00
dmontagu
756454fb58
Change defaults for BaseSettings ( #747 )
...
* Change defaults for BaseSettings
* Update docs and fix build
* Minor documentation fixes
* Fix lowercase issues
* Update docs and fix build
* Fix formatting
* Try with monkeypatched test
* Fix doublequotes
* Change case_insensitive to case_sensitive
* more change details.
2019-08-21 12:48:28 +01:00
dmontagu
5e8db161b8
Preserve annotations from bases ( #758 )
...
* Preserve annotations from bases
* Incorporate feedback
* Update tests based on feedback
2019-08-21 12:45:50 +01:00
dependabot-preview[bot]
9c30712162
Bump pytest from 5.1.0 to 5.1.1 ( #774 )
...
Bumps [pytest](https://github.com/pytest-dev/pytest ) from 5.1.0 to 5.1.1.
- [Release notes](https://github.com/pytest-dev/pytest/releases )
- [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst )
- [Commits](https://github.com/pytest-dev/pytest/compare/5.1.0...5.1.1 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-08-21 12:09:03 +01:00
Samuel Colvin
0e8cfba713
small performance improvements to validators and fields ( #763 )
...
* small performance improvements to validators and fields
* simplify ErrorWrapper and ValidationError
* more cleanup of errors, combine test_error_wrapper.py and test_error.py
* tweak datetime_parse.py
* fix for python 3.6
* add change
* fix bug with int or float passed to datetime.time
2019-08-18 16:48:39 +01:00
dmontagu
65d838aa88
Serialize only __root__ value ( #752 )
...
* Serialize only __root__ value, fix #730
* Add changes and fix docs
* Clean up root model docs
* Update docs/index.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* Update docs/index.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* Rename variable
* fix rst in change description
2019-08-17 18:58:32 +01:00
dmontagu
6c0f4f31d1
Test mypy integration with pytest ( #735 )
...
* Test mypy integration with pytest
* Fix for without deps
* Fix filenames issue
* Remove python run in external-mypy
* Update changes
* Remove external-mypy
2019-08-17 12:59:11 +01:00
Raphael de Carvalho Almeida
5b5451c02e
Added initvars support to post_init_post_parse ( #748 )
...
* Added initvars support to post_init_post_parse
* Update change log with PR number
* Add practical initvars example to tests
* Update documentation
2019-08-16 09:36:56 +01:00
dependabot-preview[bot]
cac933309e
Bump pytest from 5.0.1 to 5.1.0 ( #751 )
...
Bumps [pytest](https://github.com/pytest-dev/pytest ) from 5.0.1 to 5.1.0.
- [Release notes](https://github.com/pytest-dev/pytest/releases )
- [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst )
- [Commits](https://github.com/pytest-dev/pytest/compare/5.0.1...5.1.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-08-16 09:10:50 +01:00
Abdussamet Koçak
f41d5dca3c
Support assert statements inside validators ( #653 )
...
* Support assert statements inside validators
* Add a validator example that uses assert
* Add warning about consequences of using -O optimization flag
* Fix a typo
* Fix incomplete validator
* Extend exception name generation
* Improve tests
* Clarify pytest behaviour
* handle assertion error name, fix build
* Address feedback
* docs cleanup
* Incorporate feedback
* fix quotes
2019-08-15 12:06:21 +01:00
dmontagu
321cde0c88
Include all annotated fields in order ( #715 )
...
* Include all annotated fields in order
* Update docs and changes
* fix field ordering
* update change info
* fix coverage
2019-08-12 12:05:22 +01:00
Samuel Colvin
82ef45c890
alter the behaviour of dict(model) so that sub-models are nolonger converted to dictionaries ( #733 )
...
* fix iteration to not convert to dict by default
* add change
* remove extra newline
2019-08-12 11:31:35 +01:00
Samuel Colvin
5837acb288
test demonstrating internal ValidationError ( #738 )
...
* test demonstrating internval ValidationError
* fix #736
2019-08-11 14:14:02 +01:00
dmontagu
72edca7532
Make bool_validator strict ( #617 )
...
* Make bool_validator strict
* incorporate feedback
* Add RelaxedBool
* Fix position in schema.py
* update BoolError message
* Incorporate feedback
* Update history
* Add changes
* Update docs/index.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* Update docs/index.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* Update tests/test_types.py
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* Incorporate feedback
* Update booleans.py
* Remove RelaxedBool
* tweak docs and update changes to new format
2019-08-10 12:00:29 +01:00
Samuel Colvin
19834d33ff
Remove old, deprecated code
2019-08-06 16:30:37 +01:00
Sebastián Ramírez
d4d9e9e7d7
Implement Config attribute schema_extra, to allow extending a generated schema
2019-08-05 09:45:37 -05:00
Koudai Aono
b5d5e591ec
Merge remote-tracking branch 'upstream/master' into support_forwardred_in_python36
2019-08-05 21:00:01 +09:00
Koudai Aono
cffcb39c7c
add unittest for python3.7
2019-08-05 20:46:56 +09:00
Samuel Colvin
bbdc8e8038
add test_init_inspection
2019-08-05 11:35:49 +01:00
Arseny Boykov
f01cedca14
Merge branch 'master' into __dict__-instead-of-__values__
2019-08-05 12:58:46 +03:00
Samuel Colvin
7ace58cad8
Merge branch 'master' into type-in-validation-error
2019-08-05 10:37:42 +01:00
MrMrRobat
bbf0b4bfbe
Add __values__ property with deprecation warning and test for it
2019-08-03 18:05:17 +03:00
Koudai Aono
879a24ecb7
delete @skip_not_37 on forward_ref tests
2019-08-03 15:10:26 +09:00
Koudai Aono
8e0455c9c6
change test_py37.py to test_forward_ref.py
2019-08-02 21:47:15 +09:00
Koudai Aono
84d7c4aaf2
fix skip_not_36 condition
2019-08-02 16:24:16 +09:00
dependabot-preview[bot]
a3df3aa314
Bump flake8-quotes from 2.0.1 to 2.1.0
...
Bumps [flake8-quotes](https://github.com/zheller/flake8-quotes ) from 2.0.1 to 2.1.0.
- [Release notes](https://github.com/zheller/flake8-quotes/releases )
- [Commits](https://github.com/zheller/flake8-quotes/compare/2.0.1...2.1.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-08-02 06:39:16 +00:00
Koudai Aono
a4292aa24f
support ForwardRef in Python 3.6
2019-08-02 13:22:09 +09:00
dmontagu
f881d4f30c
Make .json() work for EnumError ( #697 )
...
Make .json() work for EnumError, fix #696
2019-07-31 09:12:18 +01:00
dependabot-preview[bot]
b58f31dfd9
Bump coverage from 4.5.3 to 4.5.4 ( #695 )
...
Bumps [coverage](https://github.com/nedbat/coveragepy ) from 4.5.3 to 4.5.4.
- [Release notes](https://github.com/nedbat/coveragepy/releases )
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst )
- [Commits](https://github.com/nedbat/coveragepy/compare/coverage-4.5.3...coverage-4.5.4 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-07-30 10:51:41 +01:00
dependabot-preview[bot]
99dc5c1c83
Bump cython from 0.29.12 to 0.29.13 ( #694 )
...
Bumps [cython](https://github.com/cython/cython ) from 0.29.12 to 0.29.13.
- [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.12...0.29.13 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-07-29 10:37:01 +01:00
dependabot-preview[bot]
cb81ca66b2
Bump cython from 0.29.11 to 0.29.12 ( #689 )
...
Bumps [cython](https://github.com/cython/cython ) from 0.29.11 to 0.29.12.
- [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.11...0.29.12 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-07-25 18:52:55 +01:00
dependabot-preview[bot]
85f1016c4a
Bump pytest from 5.0.0 to 5.0.1 ( #688 )
...
Bumps [pytest](https://github.com/pytest-dev/pytest ) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/pytest-dev/pytest/releases )
- [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst )
- [Commits](https://github.com/pytest-dev/pytest/compare/5.0.0...5.0.1 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-07-25 18:17:39 +01:00
dependabot-preview[bot]
f55a633296
Bump mypy from 0.711 to 0.720 ( #686 )
...
Bumps [mypy](https://github.com/python/mypy ) from 0.711 to 0.720.
- [Release notes](https://github.com/python/mypy/releases )
- [Commits](https://github.com/python/mypy/compare/v0.711...v0.720 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-07-25 18:17:27 +01:00
dependabot-preview[bot]
3dca559e82
Bump flake8 from 3.7.7 to 3.7.8 ( #685 )
...
Bumps [flake8](https://gitlab.com/pycqa/flake8 ) from 3.7.7 to 3.7.8.
- [Release notes](https://gitlab.com/pycqa/flake8/tags )
- [Commits](https://gitlab.com/pycqa/flake8/compare/3.7.7...3.7.8 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-07-25 18:17:13 +01:00
David Montague
8135f470e4
Incorporate feedback
2019-07-25 00:15:54 -07:00
David Montague
20619ea901
Add type name to ValidationError error message
2019-07-25 00:05:57 -07:00
Arseny Boykov
fae3588f42
Add Config.keep_untouched for custom descriptors support ( #679 )
...
* Add Config.keep_untouched for custom descriptors support
* Update HISTORY.rst
* Separate test
* Fix tests
* Update pydantic/validators.py
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* Update HISTORY.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* Rename TYPE_BLACKLIST -> UNTOUCHED_TYPES, fix tests and formatting
* Update docs/index.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
2019-07-24 16:33:49 +01:00
dmontagu
b702eb8738
Update error message for enum validator ( #673 )
...
* Update error message for enum validator
* Update history
2019-07-24 10:53:10 +01:00
dmontagu
b09e6977b9
Bugfix for generic types with parameterized generic fields ( #672 )
...
* Bugfix for generic types with parameterized generic fields
* Update history
* Skip new tests in python3.6
2019-07-24 10:52:44 +01:00
euri10
1e83ac5137
Color schema ( #666 )
...
* First attempt at adding Color in schema() generation
* Lint
* Add history
* Make docs pass
* Added format color
* Format color
* Making history...:)
2019-07-24 10:52:05 +01:00
Arseny Boykov
1b4c1a884c
Fix alias_generator and field config conflict ( #658 )
...
* Fix alias_generator and field config conflict (see #645 )
* HISTORY.rst update: fix alias_generator and field config conflict
* Merge HISTORY.rst with master
2019-07-24 10:32:40 +01:00
Arseny Boykov
74768c1535
Add advanced exclude and include support for dict, json and copy ( #648 )
...
* Add advanced exclude support for dict, json and copy
* Add advanced exclude support for dict, json and copy
Add new version section (v0.31)
* Add advanced include support, add more tests, improve code style
Rename ValueExclude to ValueItems and move it to utils
Use old logic to calculate keys, but still exclude it in _iter
* Add more tests for ValueItems
* Removed update arg check in _calculate_keys for return None
This will increase speed when no include or exclude given and skip_defaults is False
* Fix formatting, remove duplicate imports
* Add # pragma: no cover to 'if TYPE_CHECKING:' block
* tweaks and coverage
* fix history
* Add docs
* tweak docs
2019-07-24 09:58:38 +01:00
Justin DuJardin
bc60014518
Add better support for floating point multiple_of values ( #652 )
...
- modulo doesn't work with floating point values in many cases, e.g. `0.3 % 0.1 == 0.09999999999999998`
- port implementation from: https://github.com/tdegrunt/jsonschema/issues/187#issuecomment-320664251
- add tests for int/float multiple_of values
- update history with pr/author
2019-07-23 16:41:11 +01:00
dmontagu
18d4b2bb2a
Make schema work for Literal and NewType ( #649 )
...
* Make schema work for Literal and NewType, fix #646
* Fix test when typing_extensions not installed
* Make literal values fetching 3.6 compatible
* Rework to get around issues with Literal in python 3.6
* Make cython-compatible
* Use union for multiple allowed literal values
* Minor simplification of values-gathering
* Updated history
2019-07-15 20:06:35 +01:00
Levi Naden
61c8ca2f30
Re-enable nested model init calls while still allowing self ( #644 )
...
* Re-enable nested model init calls while still allowing self
This commit enables nested model `__init__` statements to be executed
while still allowing `self` as an argument.
Effectively reverses the changes from #632 while still enabling the
feature it implemented. In theory, there will still be a collision if
someone ever tried to use `pydantic_base_model/settings_init` as an arg,
but I don't know how to engineer a case where a collision would *never*
happen, I'm not sure there is one.
This commit also added a test for both BaseModel` and `BaseSettings` for
both the `self`-as-a-parameter and the nested `__init__` features since
`BaseSettings` now has the same issue as `BaseModel` since it invoked
an `__init__` with self.
I have added a comment under the `__init__` for both `BaseModel` and
`BaseSetting` since not having `self` as the first arg is such a
rarity within Python that it will likely confuse future developers who
encounter it.
The actual name of the variable referencing the class itself can be
up for debate.
* Please Lint
* Please Black
* Update from comments
2019-07-11 15:42:48 +02:00
Samuel Colvin
34f271e8fa
support self argument ( #632 )
...
* support self argument, fix #629
* support self recursively
2019-07-06 14:22:15 +01:00