* added config var warn_on_undefined_types
raises a UserWarning if model not fully defined and will need rebuild
* black formatting
* use | instead of Optional[]
* suppress undefined types warning in existing tests
* ran pre-commit to fix linting
* changed to use Optional since | failing in CI
* changes following initial code review
* added some preliminary documentation
* fix linting
* fixed linting
* fixed linting
* assert model partially built when suppressing warn
* moved check for ForwardRef into existing for loop
* change assertion to dict instead of json
* cleanup of undefined_types_warning tests and docs
* Update docs/examples/types_undefined_warning.py
* Update docs/examples/types_undefined_warning.py
* fix EOL (trim trailing whitespace) lint error
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* Remove Cython
* fix CI
* fix coverage
* fix tests
* switching to pypyroject.toml
* pre-commit all and use pre-commit for linting
* no mypy tests on macos and windows on ci, use flake8-pyproject
* fix docs and tests CI
* check build is working
* drop pytest-cov
* window and macos ci with 3.11, reduce filtering
* use pip-tools to pin all dependencies
* fix docs and fastapi tests
* fix test deps for 3.7
* no cache on tests job
* revert fastapi changes, fix coverage
* fix mypy coverage
* test with older mypy
* dotenv not required for mypy tests
* split testing requirements std and extra
* typo
* @PrettyWood comments
* correct branch name
* mypy python_version and pr template
* 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>
* 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>
* feat: add to upper function for strings and bytes
* docs(changes): add message for change
* fix: add constr upper on types
* fix: add constr upper on types
* feat: add examples and doc usage
* test: add test to upper for types
* chore: apply suggestions from code review
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
* chore(docs): reorder `anystr_upper` to under `anystr_lower`
* fix(test): adjust parametrizes to constrained bytes upper
* refactor: use pytest parametrize for unify test constrained str upper
* refactor: use pytest parametrize for unify test constrained str lower
* refactor(test): use pytest parametrize for unify test any str upper
* refactor(test): use pytest parametrize for unify test any str lower
* refactor(test): use pytest parametrize for unify test constrained bytes lower
* refactor(test): use pytest parametrize for unify test any str strip whitespace
* refactor(test): change test signatures to improve readability
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
* Add CockroachDsn type
The CockroachDsn type supports the following dialects: cockroachdb,
cockroachdb+psycopg2 and cockroachdb+asyncpg. It's meant to be used in
conjunction with the cockroachdb sqlalchemy dialect, more information
can be found here:
https://github.com/cockroachdb/sqlalchemy-cockroachdb
* tweak change log
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* updates to description of the fields option.
Update of the fields option for config to reflect the fact that it is not actually equivalent to the Field class, as I was having troubles understanting ehy I couldn't set default or default_factory.
* corrected typo
* correction
* fix typo
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* add support for alias handling in validate_arguments
* add test for alias handling in validate_arguments
* add documentation on alias support for decorator
* bug fixed in the validate_argumen decorator documentation
* add changes README
* change in the documentation due to a drafting error
* Update changes/3019-MAD-py.md
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* more challenging tests
* run the format checker
* integration of empty string as alias
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* Create utils.py
I needed non pascal case camel case support
* write tests for new `to_lower_camel()` function
* Create 3463-schlerp.md
* added mention to to_lower_camel()
* changed quotes to single tick
* adding second blank line at end of file.
* again, adding second blank line...
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* Move host regex out of url_regex and inject it afterwards
* Add new host regex with cache variable
* Move url regex strings to separate variables
* Add new postgres url regex with cache variable
* Add tests for failed postgres dns with many hosts
* Add new parts type: HostParts
* Add new slot 'hosts' to PostgreDsn and update init with it
* Add validators to PostgreDsn class.
When multiple hosts are found, all hosts will be store in hosts list. To
keep back compatibility single host will return all data as previously
in main params.
* Add more detail tests to check multi host postgres dsn with attributes
* Add changes description in the file
* Delete usless comments to regex strings because of varable names
* Add missing docstring to postgres_url_regex function
* Update postgre dsn with AnyUrl.slots
* Update AnyUrl.validate_parts to support disabling port validation
* Reuse _host_regex in postgres_url_regex
* Fix typing
* Delete not needed group in regex
* Improve tests by adding parametrize to postgreDsn tests
* Update postgres regex to not validate hosts in it
* Delete duplicated code and use shared validate method
* Move multi host methods into separate class and inherit it in the postgreDsn
* fix tests
* tweaks and re order code
* add a note to docs
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* Add MongoDsn to pydantic.networks with allowed_schemas and get_default_parts
* Add unit test to MongoDsn and remove default host from default parts becouse it's required by MongoDB protocol
* Fix import issues, follow contributing guide
* Add changes to docs
* Add changes to changelog
* Added support for Rich Repr protocol
* restore line
* Words
* quotes
* Update changes/3099-willmcgugan.md
Adds code to markdown
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* added usage with Rich
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>