* Try to evaluate forward refs after model created
* Upadate docs and remove code duplication
* Update changes/2588-uriyyo.md
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* Update docs/usage/postponed_annotations.md
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* Remove unused import
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* feat(schema): enforce length in generated JSON schema for tuple type
* docs: add change file
* docs: update documentation
* simplify a bit
* always set array
* ✨ Add autocomplete support for VS Code, via dataclass_transform
* 📝 Update changes
* 📝 Add docs for VS Code
* 📝 Clarify strict type error checks alternatives, include example with cast()
* ♻️ Update BaseSettings annotation to improve editor support
keeping editor support for BaseSetting's custom Config, but preventing __config__ from showing in constructor on editors supporting dataclass_transform
* 🎨 Remove unused type: ignore comment
* 🎨 Update type annotations for BaseSettings and BaseModel to use ClassVar where suitable
to improve editor support with type annotations and dataclass_transform
* 🎨 Apply ClassVars again
* 📝 Simplify VS Code docs terms
refer mainly to Pylance and clarify the relationship with Pyright
* 📝 Add link to Pylance FAQ
Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* add `FileUrl` type for `file://` schemes
Also add a `host_required` parameter, True by default,
False in `FileUrl` and `RedisDsn`.
* chore: useless extra in assert statement
Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* Added suport to postgresql async driver
* Added postgres+asyncpg in the doc.
* Added changes file
* Added postgresql+pg8000 schema
* ran make format
* Update docs/usage/types.md
Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>
* Changed from schema to scheme
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* fixed typo scheme
* fixed merge schema
* changed to one line description
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* added others DBAPI dialects.
* Added two # by PrettyWood
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* fix typo by PrettyWood
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* Fixed typo by PrettyWood
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* added postgresql+psycopg2 in changes dir
* Fixed typo by @samuelcolvin
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* docs: fix typo
* chore: sort alphabetically
Co-authored-by: Fernando Ike <fernando.ike@maburix.com>
Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* refactor: extra `BaseConfig` and `Extra` in dedicated `config` module
* refactor: clean useless `#noqa: F401`
* refactor: clean useless `#noqa: F811`
* refactor: replace enum check
Error with 3.10
> DeprecationWarning: accessing one member from another is not supported
* refactor: avoid using `distutils` directly
error with python 3.10
> DeprecationWarning: The distutils package is deprecated and slated
> for removal in Python 3.12.
> Use setuptools or check PEP 632 for potential alternatives
* fix: `__annotations__` always exists
* fix: origin of `typing.Hashable` is not `None`
* ci: add run with 3.10.0b2
* docs: add 3.10
* feat: support `|` union operator properly
`|` operator has origin `types.Union` (and not `typing.Union`)
* fix: enum repr is different with 3.10+
* fix: error message changed a bit
change from basic `__init__` to `test_hashable_required.<locals>.MyDataclass.__init__()` (with `__qualname__`)
* fix: always exists and is not inherited anymore
* fix: avoid calling `asyncio.get_event_loop` directly
With python 3.10, calling it results in
> DeprecationWarning: There is no current event loop
* fix(ci): do not run 3.10 on linux for now
For now it can not be compiled.
Let's just skip the check on linux for now instead of tuning the CI pipeline
* fix(ci): ignore DeprecationWarning raised by `mypy` on windows
* docs: add change file
* Add GetterDict example
* Update docs/usage/models.md
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* add repr parameter to hide a field from repr()
* fix styling issues
… found by flake8.
* fix type annotation issues
* correctly name changes file
* test hiding default values from repr() of a Field
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* Fix(docs): remove colon to separate unrelated clauses
The colon at the end of the line "The fields which were supplied when user was initialised:" suggests that the code following it is related.
Changed it to a period.
* Include change summary readme.
* Add exclude/include as field parameters
- Add "exclude" / "include" as a field parameter so that it can be
configured using model config (or fields) instead of purely at
`.dict` / `.json` export time.
- Unify merging logic of advanced include/exclude fields
- Add tests for merging logic and field/config exclude/include params
- Closes#660
* Precompute include/exclude fields for class
* Increase test coverage
* Remove (now) redundant type checks in Model._iter: New
exclusion/inclusion algorithms guarantee that no sets are passed further down.
* Add docs for advanced field level exclude/include settings
* Minimal optimization for simple exclude/include export
Running benchmarks this vs. master is at:
this: pydantic best=33.225μs/iter avg=33.940μs/iter stdev=1.120μs/iter version=1.7.3
master: pydantic best=32.901μs/iter avg=33.276μs/iter stdev=0.242μs/iter version=1.7.3
* Apply review comments on exclude/enclude field arguments
* Fix/simplify type annotations
* Allow both ``True`` and ``Ellipsis`` to be used to indicate full field
exclusion
* Reenable hypothesis plugin (removed by mistake)
* Update advanced include/include docs to use ``True`` instead of ``...``
* Move field info exclude/include updates into FieldInfo class
This way, the model field object does not need to concern itself with
dealing with field into specific fields.
(Same was done for alias in a previous commit).
* remove double back tick in markdown.
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* Put examples to the start of the section
I think this is where they belong, they were in the middle of the list of config options somewhere near the end.
* Add "options" in table of contents
* tweak
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* doc(schema): use boldface to highlight a note
* doc(schema): fix small formatting typo
* doc(schema): attempt to fix the callout
* docs(schema): indent the callout