Søren Bjerregaard Vrist
33fee6d9be
Let SecretStr/SecretBytes be value equals to them selves ( #1079 )
...
fix #1078
2019-12-09 17:23:34 +00:00
Selim Belhaouane
bdc3973d90
Allow schema_extra to be a callable ( #1054 )
...
* fixes for Windows development
* Allow Config.schema_extra to be a callable
2019-12-09 11:01:17 +00:00
Greg Lutostanski
34a64efc04
Fix schema for fields with nested None as default ( #1088 )
...
fix #1087
As None is typically used for the default value, it is not usually
encoded on its own into schemas. There was an issue, where using None
not as the top-level value, but rather inside other objects (e.g.
[None]) will throw a Traceback.
2019-12-09 10:05:55 +00:00
dependabot-preview[bot]
3891b1cbc0
Bump pytest-mock from 1.12.1 to 1.13.0 ( #1083 )
...
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock ) from 1.12.1 to 1.13.0.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases )
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/master/CHANGELOG.rst )
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v1.12.1...v1.13.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-12-06 11:38:44 +00:00
Sebastián Ramírez
ea709cc66f
Add FastAPI tests to Pydantic's CI tests ( #1075 )
...
fix #1041
* Add test-fastapi.sh script, after failing to create reusable variables in Make
* Add test-fastapi Make target
* Add fastapi dir for tests to gitignore
* Add fastapi tests to Travis
* Update test-fastapi to run the minimum (pytest)
* Move make test-fastapi to normal run, no "Without Deps"
* Install Pydantic without Cython for FastAPI tests
* Put FastAPI tests in its own Travis job
* Add PR changes description
* Remove coverage for FastAPI, it's not relevant for Pydantic
* Implement code review changes, refactor Makefile use and fastapi tests
* Add a bug intentionally, to test that FastAPI tests are using the current source
and make sure it actually breaks CI.
* Fix intentional bug. Confirmed it breaks Travis for FastAPI.
2019-12-05 11:35:56 +00:00
Samuel Colvin
9255012c08
add version_info to make creating issues easier ( #1071 )
...
* add version_info to make creating issues easier
* improve version_info()
* improve contributing docs
2019-12-04 15:14:53 +00:00
Kieran Darcy
9982eb43dd
Change BaseModel.parse_file to use Config.json_loads ( #1069 )
...
fix #1067
* Making json_loads available to parse_file
* Change BaseModel.parse_file to use Config.json_loads
* Update changes/1067-kierandarcy.md
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* Fixed some style issues and added missing test for parse_file_as
2019-12-03 15:05:27 +00:00
dmontagu
d538df5fbb
Update for compatibility with mypy 0.750 ( #1058 )
...
* Update for compatibility with mypy 0.750
* Remove coverage checks for 0.740 compatibility
2019-12-02 13:09:37 +00:00
Aviram Hassan
1b9f08bead
Dataclass is now compatible with schema methods ( #1045 )
2019-12-02 12:44:21 +00:00
Samuel Colvin
151143deb4
coverage for UndefinedType
2019-11-28 18:28:51 +00:00
Samuel Colvin
b521f6b24a
prepare v1.2 ( #1042 )
...
* making field-reuse idempotent (#1016 )
* making field-reuse idempotent
* fix for 3.6
* correct change details
* uprev
* generate HISTORY.md
2019-11-28 17:46:43 +00:00
Sebastián Ramírez
d9bbb05a16
Implement Optional required ( #1031 )
...
* Implement Optional required, when creating a ModelField(required=True), make it persist
* Add test for nullable required
* Improve formatting of Undefined custom object
* Refactor field infer/creation with Undefined to make it idempotent
Needed for when _type_analysis is re-run in Generics
* Add PR changes
* Increment/update tests with code review
* Update/refactor Undefined implementation with code review
* Fix BoolUndefined as string type for mypy, not runtime
* Add docs about required Optional
* Add explicit tests for Any
* Apply code review requested changes
* move tests out of test_validators.py
2019-11-28 16:48:33 +00:00
dependabot-preview[bot]
cb82d3c74b
Bump pytest from 5.3.0 to 5.3.1 ( #1036 )
...
* Bump pytest from 5.3.0 to 5.3.1
Bumps [pytest](https://github.com/pytest-dev/pytest ) from 5.3.0 to 5.3.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.3.0...5.3.1 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
* combine uprevs
2019-11-28 11:49:07 +00:00
dmontagu
c71326d4a6
Add better support for validator reuse ( #941 )
...
* Add better support for validator reuse
* Clean up classmethod unpacking
* Add changes
* Fix coverage check
* Make 3.8 compatible
* Update changes/940-dmontagu.md
Co-Authored-By: Samuel Colvin <s@muelcolvin.com >
* Make allow_reuse discoverable by adding to error message
* switch _check_validator_name to _prepare_validator
2019-11-25 15:15:05 +00:00
dmontagu
6564bbb4ce
Add parse_as_type function ( #934 )
...
* Add parse_as_type function
* Add changes
* Incorporate feedback
* Add naming tests
* Fix double quotes
* Fix docs example
* Reorder parameters; add dataclass and mapping tests
* Rename parse_as_type to parse_obj, and add parse_file
* Incorporate feedback
* Incorporate feedback
* use custom root types
2019-11-25 12:55:15 +00:00
dmontagu
62bc930f57
Add support for mapping types as custom root ( #958 )
...
* Add support for mapping types as custom root
* Incorporate feedback
* Add changes
* Incorporate feedback
* Add docs and tests
* Fix linting issue
* Incorporate more feedback
* Add more specific match
2019-11-25 12:19:41 +00:00
dmontagu
643266944c
Support typing.Literal in python 3.8 ( #1027 )
...
* Support typing.Literal in python 3.8
* Improve import pattern for Literal
* Update references to in docs
* Try to get build to pass
2019-11-25 11:32:01 +00:00
dependabot-preview[bot]
796b9588c6
Bump twine from 3.0.0 to 3.1.0 ( #1029 )
...
Bumps [twine](https://github.com/pypa/twine ) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/pypa/twine/releases )
- [Changelog](https://github.com/pypa/twine/blob/master/docs/changelog.rst )
- [Commits](https://github.com/pypa/twine/compare/3.0.0...3.1.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-11-25 09:13:34 +00:00
Samuel Colvin
4e23d4a61f
__str__ and __repr__ inheritance for models, fix #1022 ( #1023 )
2019-11-22 15:29:56 +00:00
dependabot-preview[bot]
95a7aa6021
Bump pytest-mock from 1.12.0 to 1.12.1 ( #1018 )
...
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock ) from 1.12.0 to 1.12.1.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases )
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/master/CHANGELOG.rst )
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v1.12.0...v1.12.1 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-11-21 11:49:28 +00:00
dependabot-preview[bot]
56ba84a195
Bump pytest from 5.2.4 to 5.3.0 ( #1013 )
...
Bumps [pytest](https://github.com/pytest-dev/pytest ) from 5.2.4 to 5.3.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.2.4...5.3.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-11-20 14:20:19 +00:00
dependabot-preview[bot]
ed1c0f2e9d
Bump pytest-mock from 1.11.2 to 1.12.0 ( #1014 )
...
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock ) from 1.11.2 to 1.12.0.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases )
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/master/CHANGELOG.rst )
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v1.11.2...v1.12.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-11-20 14:19:55 +00:00
dependabot-preview[bot]
022885b86d
Bump twine from 2.0.0 to 3.0.0 ( #1009 )
...
Bumps [twine](https://github.com/pypa/twine ) from 2.0.0 to 3.0.0.
- [Release notes](https://github.com/pypa/twine/releases )
- [Changelog](https://github.com/pypa/twine/blob/master/docs/changelog.rst )
- [Commits](https://github.com/pypa/twine/compare/2.0.0...3.0.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-11-19 18:28:24 +00:00
Niko Strijbol
fd32516e0f
Add exclude_none option ( #1003 )
...
* add `exclude_none` option (#587 )
* run formatter
* Apply @samuelcolvin's suggestions
2019-11-18 13:18:51 +00:00
dependabot-preview[bot]
3b313b2ae7
Bump pytest from 5.2.3 to 5.2.4 ( #1007 )
...
Bumps [pytest](https://github.com/pytest-dev/pytest ) from 5.2.3 to 5.2.4.
- [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.2.3...5.2.4 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-11-18 10:14:10 +00:00
dependabot-preview[bot]
7938cb0edf
Bump pytest from 5.2.2 to 5.2.3 ( #999 )
...
Bumps [pytest](https://github.com/pytest-dev/pytest ) from 5.2.2 to 5.2.3.
- [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.2.2...5.2.3 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-11-15 20:25:51 +00:00
Daniel Smith
c2e0082800
ByteSize conversion ( #996 )
...
* Bytesize implement to conversion
* Changelog
* Lint: changes to single quotes
* Update tests/test_types.py
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* Update tests/test_types.py
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* Update tests/test_types.py
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
2019-11-14 16:22:51 +00:00
Koudai Aono
33b3dc1825
mypy plugin support for dataclasses ( #966 )
...
* mypy plugin support for dataclassesv
* fix styles and types
* - change type-hint for `Config`
- change name of an expected file
- update documents
* fix broken a reference of a document.
* - update unittest
- update documents
* fix a document link
* Update docs/mypy_plugin.md
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* Update docs/mypy_plugin.md
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* Update docs/mypy_plugin.md
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* remove extra whitespaces on mypy test results
* fix output file name of mypy test
* Update docs/usage/dataclasses.md
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* use TypeVar for DataclassType
2019-11-14 11:26:46 +00:00
Samuel Colvin
0e8f88611f
build binaries for python 3.8 ( #994 )
...
* build binaries for python 3.8
* change and test with cibuildwheel
* skip codecov on pypi build
* speed up PR ci builds
* better conditional builds
* fix conditional builds
* finish conditional stages
2019-11-14 10:50:34 +00:00
Samuel Colvin
f4cc204138
fix mypy complaint on @root_validator(pre=True) ( #985 )
...
* fix mypy complaint on @root_validator(pre=True)
* fix internal mypy
* use overload on root_validator
2019-11-09 14:45:29 +00:00
Daniel Smith
b92e74d0a6
Bytesize ( #977 )
...
* ByteSize object
* Human readable format
* Lint, tests, and docs
* Update pydantic/errors.py
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* Update pydantic/types.py
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* Update pydantic/types.py
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* Allows human readable decimal descriptor
* Review comments
* Less verbose testing
* ByteSize docs
* Reworks valid units
* Missing type
* tweak tests
2019-11-09 12:39:02 +00:00
Alexander Hirner
c188b3fba8
Feature/dataclass schema defaults ( #980 )
...
* default dataclass field from default_factory
* silence mypy regarding issue 708
* test dataclass factory function default
* test default factory ending up in schema
* add changes md
* add docs for dataclass default factory and basemodel access
* fully print default factory schema
2019-11-09 12:29:15 +00:00
Samuel Colvin
093474ae27
fix coverage on generics.py ( #976 )
2019-11-07 16:24:12 +00:00
Samuel Colvin
1d3f7824ec
Fix broken Any and TypeVar behaviour ( #962 )
...
* tests for broken Dict behaviour
* fix Any, support TypeVar
* change type of field.type_
* add docs and example for TypeVar
2019-11-07 12:31:26 +00:00
Samuel Colvin
afa0bd4104
set FieldInfo on subfields ( #969 )
...
* set FieldInfo on subfields
* fix coverage
2019-11-07 10:34:49 +00:00
dependabot-preview[bot]
a0f9a93dda
Bump cython from 0.29.13 to 0.29.14 ( #964 )
...
Bumps [cython](https://github.com/cython/cython ) from 0.29.13 to 0.29.14.
- [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.13...0.29.14 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-11-05 10:01:49 +00:00
dependabot-preview[bot]
d701f01c0b
Bump flake8-quotes from 2.1.0 to 2.1.1 ( #963 )
...
Bumps [flake8-quotes](https://github.com/zheller/flake8-quotes ) from 2.1.0 to 2.1.1.
- [Release notes](https://github.com/zheller/flake8-quotes/releases )
- [Commits](https://github.com/zheller/flake8-quotes/compare/2.1.0...2.1.1 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-11-05 10:01:22 +00:00
dmontagu
0c18619769
Mypy plugin ( #722 )
...
* Add mypy plugin
* Make all arguments optional for BaseSettings
* Get test coverage up
* Add changes
* Add type-checking for BaseModel.construct, and checking for from_orm
* Fix formatting and linting
* Fix the build
* Heavy refactor of plugin and mypy tests
* Make linting pass
* Handle dynamic aliases
* Better organize plugin code
* Add docs
* Add support for error codes
* Fix minor docs typo
* Rename config settings, add docstrings, and incorporate other feedback
* Incorporate feedback
* Update docs, remove dataclasses for cython
* fix mypy example
2019-10-31 13:19:01 +01:00
dependabot-preview[bot]
e5f98a5734
Bump black from 19.3b0 to 19.10b0 ( #949 )
...
Bumps [black](https://github.com/psf/black ) from 19.3b0 to 19.10b0.
- [Release notes](https://github.com/psf/black/releases )
- [Commits](https://github.com/psf/black/commits )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-10-29 13:06:01 +01:00
dependabot-preview[bot]
63d8d47dea
Bump flake8 from 3.7.8 to 3.7.9 ( #950 )
...
Bumps [flake8](https://gitlab.com/pycqa/flake8 ) from 3.7.8 to 3.7.9.
- [Release notes](https://gitlab.com/pycqa/flake8/tags )
- [Commits](https://gitlab.com/pycqa/flake8/compare/3.7.8...3.7.9 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-10-29 13:05:27 +01:00
dependabot-preview[bot]
cec6a5e302
Bump pytest from 5.2.1 to 5.2.2 ( #933 )
...
Bumps [pytest](https://github.com/pytest-dev/pytest ) from 5.2.1 to 5.2.2.
- [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.2.1...5.2.2 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-10-26 22:27:36 +01:00
dependabot-preview[bot]
8a2db9121a
Bump pytest-mock from 1.11.1 to 1.11.2 ( #929 )
...
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock ) from 1.11.1 to 1.11.2.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases )
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/master/CHANGELOG.rst )
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v1.11.1...v1.11.2 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2019-10-24 10:30:32 +01:00
retnikt
dccc4014dc
Clarify documentation and error message about keep_untouched ( #926 )
...
* Clarify keep_untouched documentation (#924 )
* Clarify error message for custom types (#924 )
* Fix tests for changed error message (#924 )
* fix formatting
* remove erroneous error message and add change
2019-10-23 11:14:51 +01:00
Samuel Colvin
bab6970f12
allow abstract sets in include and exclude arguments ( #921 )
...
* allow abstract sets in include and exclude arguments
* add change
* correct type hints
2019-10-23 11:03:29 +01:00
Samuel Colvin
677677e536
modify behaviour of the construct method ( #898 )
...
* modify behaviour of the construct method
* change construct signature
* Add example for construct function (#907 )
* add example for construct
* edit exporting_models
* typo
* add changes file
* code review changes
* fix bad copy paste
* extend example in docs
* use __field_defaults__ in construct
2019-10-23 10:49:05 +01:00
Samuel Colvin
cb262daddd
fix ValidationError.json() ( #922 )
2019-10-23 10:27:55 +01:00
dmontagu
6b5adcc977
Rename skip-defaults, and add ability to exclude actual defaults ( #915 )
...
* Rename skip-defaults, and add ability to exclude actual defaults
* Add __defaults__ and deprecation warnings
* Add note about `skip_defaults` to docs
* Incorporate feedback
* Add tests and changes
* Fix reference to .json()
2019-10-23 10:14:51 +01:00
Samuel Colvin
f5cde39e75
ConstrainedList improvements, fix #913 ( #917 )
2019-10-21 12:15:54 +01:00
Samuel Colvin
7db098fa49
get item type in get_annotation_from_field_info ( #909 )
...
* get item type in get_annotation_from_field_info, fix #779
* check constraints are enforced
* add change
* tests for phony constraints
* rewrite get_annotation_from_field_info
* fix tests
* add constaint enforcement to docs
* fix get_annotation_from_field_info coverage
* fix linting
* update docs as per @tiangolo suggestions
2019-10-18 17:41:10 +01:00
Samuel Colvin
78921da353
better str and repr for ModelField ( #912 )
...
* better str and repr for ModelField, fix #505
* better type display, fix tests
* correct _type_display signature
* fix for python3.6 differences
* fix PyObjectStr
* fix coverage
2019-10-18 14:32:30 +01:00