* add test for create_model with slots
* add test for create_model with slots
* add warning and change description
* fix flakey none tests on 3.8.10
* avoid flakey coverage changes
* Fix#1458 - Allow for custom parsing of environment variables via env_parse
* Add docs for env_parse usage
* Add changes file for #3977
* fixup: remove stray print statement
* Revert env_parse property on field
* Add parse_env_var classmethod in nested Config
* Update documentation for parse_env_var
* Update changes file.
* fixup: linting in example
* Rebase and remove quotes around imported example
* fix example
* my suggestions
* remove unnecessary Field(env_parse=_parse_custom_dict)
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* ✨ Add JSON-compatible float constraints for NaN and Inf
* switching to a single "allow_inf_nan"
* fix tests
* add change and docs
* add allow_inf_nan to Config
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* Fix `AnyUrl.build` doesn't do percent encoding (#3061)
please review
* Use `urllib.parse` instead of custom implementation for percent encoding
* Make `quote_plus` a `stricturl` option
* Add docs for `stricturl(quote_plus=True)`
* Better changes message for #3061
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* Fix precent encoding version note to V1.10
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* Fix `Building URLs` snippit markdown
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* Fix formatting for `docs/examples/types_url_building.py`
* fix docs
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* feat: Make SecretStr hashable
* docs: Add change documentation
* test: Assert that the hash of SecretStr is an integer value
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
* feat: Make SecretBytes hashable
Co-authored-by: Johannes Rueschel <johannes.rueschel@telekom.de>
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
* Generate docs exampels for Python 3.10 and above
Code quality is not great and main intent here is to show the result.
* Fix docs build on 3.9
* Build docs on 3.10
* What's Python 3.1?
* Create temp dir if not exists
* Refactor and improve imlementetion
* Keep runtime typing in examples
* Revert unrelated formatting changes
* Add changes file
* Allow specifying requirements in examples
* Pin autoflake and pyupgrade
* Add docs/build to Makefile lint/format/mypy
* ignore_missing_imports for ansi2html and devtools
* Add .tmp-projections to .gitignore
* Remove dont-upgrade now when Pattern is supported
* Update postponed evaluation examples
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* Initial implmenetation of ConstrainedDate, condate, with tests and docs
* Attempt at fixing hypothesis tests for ConstrainedDate. Suspect still not working
* removed forgotten breakpoint() :(
* suggested changes to pydantic/_hypothesis_plugin.py for condate etc
Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
* - fixed import for hypothesis tests
* - linting fixes only
* - more fixes for linting
* changes following review by samuelcolvin 2022-08-08. Will rebase next
* - added changes to changes file
* fixed changes file filename to PR #3740
* additional changes requested by samuelcolvin 2022-08-11: add test for schema_json, add hypothesis test, etc
* make test_json_schema compare to a dictionary rather than json string
* added test_date_constrained_types to test_schema
* rewrite tests
Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* generate history from changes, uprev
* Pydantic V2 blog (#4218)
* first draft of pydantic V2 blog
* more blog
* blog rendering and formatting
* more section
* completing conversion table
* prompt build
* reviewing blog post
* more reviewing and extending
* recommendations from @Rabscuttler and @PrettyWood
* add implementation details and more suggestions
* comment about breaking changes
* convert namespae to table, more removals
* Apply suggestions from code review by @tiangolo
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
* feedback from @tiangolo's review
* changes from @adriangb's review
* Apply suggestions from code review
Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
* convert namespace info to psuedo-code
* rename property, remove schema_json()
* adding validation context
* remove 'model_schema_json', take 2
* more tweaks while reviewing
* comment about pypy and tagged unions
* add thanks :prey:, prepare for release
* suggestions from @PrettyWood
* suggestions from @PrettyWood, model_dump_json comment
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
* comments mostly from @PrettyWood (#4226)
* comments mostly from @PrettyWood
* add updated comment
* fix pre-commit
* allow for shallow copies (#4093)
* allow for shallow copies
* Add changes file
* tweak change
* update for comments
* rename attr
* use single quotes
* bump ci
* add warning if not a string, switch to string literals
* fix linting, prompt ci
* fix ci
* extend and fix tests
* change default to "shallow"
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* uprev and prepare for release
* linting
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
Co-authored-by: Tim Paine <t.paine154@gmail.com>
* Allow BaseModel to have fields of type Type
* update
* minor update
* update tests
* update
* fix type
* update
* Update changes/4051-aminalaee.md
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* Fix a bug where BaseModel.construct would not appropriately respect field aliases
* Perhaps do not raise on construct and just apply the fix
* Fix quotes and remove check on allow_population_by_field_name
* Fix lint
* Fix lint, remove bad arg
* Black formatted
* Mmmm black formatter and single quotes linting, what a world
* Added change file
* PR feedback
Co-authored-by: Kyle Amos <kamos@seatgeek.com>