* 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
* release notes for v1
* uprev and tweaks
* Apply suggestions from code review
Co-Authored-By: dmontagu <35119617+dmontagu@users.noreply.github.com>
* tweak notes, add back link to old docs
* build changelog
* 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
* starting insert prints
* working exec_script
* remove prints, fix exec_examples.py
* more cleanup of examples, better model printing
* upgrade netlify runtime
* extra docs deps
* few more small tweaks
* moving docs to mkdocs
* transfering readme to md and more
* fixing build
* splitting usage.md
* improving schema.md and index.md
* fix make_history.rst
* models intro
* working on data conversation and required fields
* more fixes to models.md
* list all standard types supported
* list of pydantic types
* tweaks
* update links in code
* Apply suggestions from code review
incorporate @dmontagu's suggestions.
Co-Authored-By: dmontagu <35119617+dmontagu@users.noreply.github.com>
* Apply suggestions from code review
more missed suggestions.
Co-Authored-By: dmontagu <35119617+dmontagu@users.noreply.github.com>
* Apply suggestions from code review
more corrects.
* cleanup
* Field order warning
* fix and regenerate benchmarks
* format examples better, cleanup
* improve schema mapping table
* correct highlighting file types in schema.md
* add redirects in javascript
* add logo
* rename Schema to Field
* add Schema function with deprecation warning
* mypy tests and other tweaks
* tweaks and cleanup
* Update pydantic/fields.py
Co-Authored-By: Sebastián Ramírez <tiangolo@gmail.com>
* root validators and rename __obj__ -> __root__
* implement root validation
* tweak Validator
* dataclass and generic tests, docs
* repeat and signature checks
* fix inheritance
* tweaks tests and var names
* improvements to 'from_orm' to work better with root validators (#822)
* improvements to 'from_orm' to work better with root validators
* cython compatibility and tweaks
* tweak config order
* added test for derived classes using custom getter_dict config (#833)
* added test for derived classes using custom getter_dict config
* fix linting
* fix formatting
* cleanup
* Added generic approach to strict type checking for constraint types
- Use the arbitrary validator to build strict validators for ConstrainedInt, ConstrainedFloat, ConstrainedStr
- Make StrictStr a derived class of ConstrainedStr
- Add tests for new strict cases for ConstrainedInt and ConstrainedFloat
* - Created StrictInt and StrictFloat subclasses and exported them
- Changed strictness tests to use these new subclasses
* - Added section for Strict Types to docs
* - Added changes file
* Update docs/index.rst
Co-Authored-By: Zaar Hai <haizaar@users.noreply.github.com>
* Update docs/index.rst
Co-Authored-By: Zaar Hai <haizaar@users.noreply.github.com>
* - Create validators for strict int and float
- Make ConstrainedInt and ConstrainedFloat use those validators instead of abusing arbitrary type validator for strictness
- Prevent double validaton of same conditions by only yielding either the strict or non-strict type validator for for those classes
* Changed strict int and float tests to alos match for exception message in invalid cases
* - Removed obvious note about lack of ConstrainedBool
- Added example for strict type usage
- Added note about caveats for StrictInt and StrictFloat
* Update pydantic/validators.py
faster method to check if a value is boolean for strict int validator
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* - Removed StrictBool part from Boolean section of docs
- Moved the Strctbool code example into strict_types.py example file
* - Changed behavior of strictness for COnstrainedStr to match that fo other constrained types
* - Actually make ConstrainedStr use the correct validator for strictness
* initial proposal of payment card validation #788
* some cleanup for PaymentCardNumber #788
* fix linting issues
* tests and more robust errors #788
* fixed linting
* fixing mypy errors
* let's try this to make mypy work
* make consistent with cpython tests
* avoid using __new__
* use __init__ instead of properties
* clean up PaymentCardNumber.__init__
* use ClassVar where applicable
* add to changes/
* turns out this is never used
* get brand for other
* clean up a bit
* make PaymentCardNumber private
* use if/else to make faster in cython
* card_number => card number in errors
* make it clearer in the tests which exception is being raised
* parameterize tests for PaymentCardNumber
* lint
* clean up merge mistake from earlier
* fix mypy test error
* take out commented line
* update comment since code is moved
* docs for PaymentCardNumber
* clean up docs for PaymentCardNumber
* var name that makes more sense
* Add support for Type[T] typehints when arbitrary_types_allowe==True.
* Add documentation.
* Let black do its magic.
* Ignore mypy warning - see here: https://github.com/python/mypy/issues/3060
* Prettify docs.
* Change Changelog.
* Refactor and simplify check for Type[T].
* Black again. ^^ - Really need pre-commit hooks.
* Update pydantic/validators.py
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Rename arbitrary_class to class.
* Black.
* Add type hints.
* Make private function public.
* Add support for bare Type.
* Black again.
* Update docs.
* CO_ct not meant for export.
* Fix get_class for Python3.6
* Update error message of ClassError.
* Use relative import.
* Incorporate typing feedback (both versions are fine with mypy).
* Move from issubclass to lenient_issubclass.
* correct docs
* new URL parsing, fix#603, fix#541
* AnyUrl parts and more tests
* more coverage and db DSNs
* remove DSN methods
* tests for urlstr
* remove debug
* make AnyStr a subtype of str
* fix with cython
* rearranging networking code
* allowing international domains, cleanup
* support international domains
* better URL builder
* allow underscores in subdomains and domains
* tests for json and schema, max length
* urlstr > stricturl
* updating docs
* tweak docs examples
* tweak docs
* 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.
* 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
* support custom root types
* update HISTORY.rst for costom root types
* fix invalid arguments case
* remove the keyword argument of "__root__" in __init__
add a keyword argument of "__root__" in parse_obj
fix documents
create a method for cheking valid field name
* fix parse_obj
* Update docs/index.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Apply suggestions from code review
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* add type cheking for custom root type
* Update docs/index.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Update index.rst
* Added alias_provider
* Update HISTORY.rst (+ add alias_provider support #622 by @MrMrRobat)
* Rename alias_provider —> alias_generator
Move docs to config section, reformat example
Separate test_alias_generator
* 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 docs/index.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Fix conflict between dictionary field config in Config.fields and Config.alias_generator
Add one more condition for applying alias_generator
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Add test for using alias_generator with field schema
* Added generic functionality
* Skip tests in python 3.6
* double quote -> single quote
* Simplified, with more comprehensive tests
* double quote -> single quote
* Remove unintentional file
* Add caching
* don't cythonize generics.py
* Make work with mypy
* Remove __parameters__
* double quote -> single quote i'll remember one day
* More cleanup and validation
* Removed unwanted file
* A little more cleanup, and finish the PR
* Add proper inheritance
* Added note about inheritance to docs
* Added error for double-parameterizing
* Should build for python3.7
* Works with both 3.6 and 3.7
* Fixed bug with caching for single argument
* handle __name__ for generic models
* double quote -> single quote
* Updated error messages
* StrictBool
StrictBool only allows booleans to be parsed. Any other value, no matter
its truthiness, is rejected.
* Fix type of `validate`
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* " => '
* Update the exotic docs with StrictBool
* Fix error message
* Improve docs
* tweak docs.
* added feature post_init_post_parse
* fixed bug where post_init_post_parse was triggered without looking is post_init_original is set
* change double to single quotes
* __doc__ strings fixed back to double quote
* added better way of doing the post_init_post_parse also tests passes now
* removed unused file
* deleted unnecessary test
* update history.rst, changed previouis change 560 to breaking change because it broke the original flow
* update docs, added section post_init_post_parse under dataclasses
* added __post_init_post_parse__ as attribute of DataclassType
* Update HISTORY.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Update HISTORY.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Update pydantic/dataclasses.py
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* update docs, added subsection initialize hooks under dataclasses
* my bad
* make tests work again
* removed checking if post_init_parse is none
* correct typo in history
* fixed typo in history.rst
* Color validator MVP
* Color Validator refactored
* Small optimizations applied
* Code coverage improved
* hex processing improved, json encoder and repr added
* Add documentation, update HISTORY (#504)
* Increase test coverage (#504)
* hex helpers refactored (#504)
* Fixes after code review (#509)
* Color Type section in docs reduced
* Check for valid but unnamed colors
* Minor fixes: typo in docs, default value for float comparison function
* rewrite Color
* fix color tests
* tweaks and improve docs
* tweaks and change Color.__str__
* add as_hsla and as_hsl
* support more rgb(a) formats
* add hsl parsing
* parsing hex with alpha channel
* fix hsl parsing
* simpler failure/fallback rules for color display
* storage as floats internally
* tweak docs
* fix type hints
* fix json for Path, FilePath, and DirectoryPath objects, fix#473
* convert to single spaces
* assert result to a string
* Update test_json.py
* encode entire Path hierarchy the same way
* Added validators for dataclass, fix#415
* Added dataclass validators
* Added dataclass validators
* Updated docs for added validating to dataclass
* Updated docs for added validating to dataclass
* Fixed line endings
* Set __validators__ type to Mapping instead of Dict
* Update History
* Use __mro__ instead of __bases__ for gather_validators
* Fix PR number
* Fix issue.rst header underline
* Fix HISTORY.rst merge conflict
* Fix utils.py merge conflict
* fix utils.py
* Rebase and other fixes
* Fix rebase and other issues
* Change history
* Remove unnecessary lines in main.py
* Rebase
* Update history
* Rename ModelType to ModelOrDc
* Added inheritance replace test
* More consiste dataclass validator tests
* fix history.
* Remove Optional ModelOrDc Type
* Fix ModelOrDc
* fix: serialize secrets to json, fix#462
* feat: adjust documentation for secretstr.
* feat: undo unnecessary changes. keep tests.
* fix: tests were broken, now they're fixed again.
* feat: add display fn to SecretStr and SecretBytes, to be used for json output.
* fix: minor typo.
* fix: last few comments.