* ✨ 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>
* Fix bug when mypy plugin fail on construct method call
* Update type annotation for __config__ field
* Remove type ignore
* Update changes/2753-uriyyo.md
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Thanks to @PrettyWood for pointing me to the right place to fix this!
Since I was told that both NamedTuple and TypedDict use the same
__pydantic_model__ machinery that dataclasses do, I checked and found
that TypedDict had the same bug, and fixed that too.
Tests for both issues are included, which fail without the associated
fixes being applied.
* Added dark color scheme for docs
Added alternative, dark color scheme for docs, which should be automatically activated if user's browser presents the `prefers-color-scheme: dark` media query.
* switch icons
* add change file
Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* Parse JSON for union type with complex subfields (#2936)
* style
* simplify
Co-authored-by: Christopher Bartz <c.bartz@zbw.eu>
Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* Add test for type hint subclass as default
* Fix support for using a subclass of an annotation as a default
* Add changes file
* add check in test
Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* Add a TypedDict class for error objects
This adds more specific typing for the dictionaries in
`ValidationError.errors()`. This shouldn't introduce any functional
change.
* quotes
* split required and not required keys
* type but be a class
* workaround cython (can't wait for v3)
Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* Fix: _pydantic_post_init() reassigns __dict__ and removes properties added to the object, for example in __new__(), breaking integration with SQLAlchemy and other libraries #3043
* Added changes file
* Fix 2860
When dealing with JsonWrapper, replace the inner type when constructing
a a generic model.
* tweak and schema test
Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* Renamed schema variable name to schema_ as there is a schema function already defined
* Same approach in enum_process_schema()
* added changes file
* Update changes/2724-shahriyarr.md
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* last shadow rename
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
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 KafkaDsn to network
* added short description to chandes folder
* added default non-displayable ports to HttpUrl model
* added info to changes folder
* fix: support non default ports in HttpUrl
* fix pr issues
* remove noqa
* add more typing by @PrettyWood
* add default http and https ports to `HttpUrl` model
* fix mypy
* chore: do not add implementation details
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>
* Allow collections.abc.Callable to be used as type in python 3.9
* Add is_none_type as function to check none types by identity
* Modify `typing.is_none_type` to work in python 3.6 and 3.7
* Add tests for none types in typing.py
* Apply review comments on #2519
* Add different implementations depending on python version
* Add tests for is_none_type
* Add change entry
* Fix field info repr
* Remove unneeded try/except for python < 3.8
* Add comment explaining alternative is_none_type implementation
* fix: typo
Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* refactor: rename `is_union` into `is_union_origin`
* fix: "new" union and generic types are not the same as `typing.GenericAlias`
* chore: rename param
* fix(ci): name changed for 3.10
* fix: mypy