Refactor the whole pydanticdataclass decorator to really act like its standard lib equivalent.
It hence keeps __eq__, __hash__, ... and makes comparison with its non-validated version possible.
It also fixes usage of frozen dataclasses in fields and usage of default_factory in nested dataclasses.
The support of Config.extra has been added.
Finally, config customization directly via a dict is now possible, #2557 by @PrettyWoodBREAKING CHANGES:
The compiled boolean (whether pydantic is compiled with cython) has been moved from main.py to version.py
Now that Config.extra is supported, dataclass ignores by default extra arguments (like BaseModel)
Fix PEP487 __set_name__ protocol in BaseModel for PrivateAttrs, #4407 by @tlambert03
Allow for custom parsing of environment variables via parse_env_var in Config, #4406 by @acmiyaguchi
Discriminated union models now use oneOf instead of anyOf when generating OpenAPI schema definitions, #4335 by @MaxwellPayne
Allow type checkers to infer inner type of Json type. Json[list[str]] will be now inferred as list[str],
Json[Any] should be used instead of plain Json.
Runtime behaviour is not changed, #4332 by @Bobronium
Allow empty string aliases by using a alias is not None check, rather than bool(alias), #4253 by @sergeytsaplin
The use of __dataclass_transform__ has been replaced by typing_extensions.dataclass_transform, which is the preferred way to mark pydantic models as a dataclass under PEP 681, #4241 by @multimeric
Use parent model's Config when validating nested NamedTuple fields, #4219 by @synek
Update BaseModel.construct to work with aliased Fields, #4192 by @kylebamos
Catch certain raised errors in smart_deepcopy and revert to deepcopy if so, #4184 by @coneybeare
Add Config.anystr_upper and to_upper kwarg to constr and conbytes, #4165 by @satheler
Fix JSON schema for set and frozenset when they include default values, #4155 by @aminalaee
Teach the mypy plugin that methods decorated by @validator are classmethods, #4102 by @DMRobertson
Improve mypy plugin's ability to detect required fields, #4086 by @richardxia
Refactor the whole pydanticdataclass decorator to really act like its standard lib equivalent.
It hence keeps __eq__, __hash__, ... and makes comparison with its non-validated version possible.
It also fixes usage of frozen dataclasses in fields and usage of default_factory in nested dataclasses.
The support of Config.extra has been added.
Finally, config customization directly via a dict is now possible, #2557 by @PrettyWoodBREAKING CHANGES:
The compiled boolean (whether pydantic is compiled with cython) has been moved from main.py to version.py
Now that Config.extra is supported, dataclass ignores by default extra arguments (like BaseModel)
Fix PEP487 __set_name__ protocol in BaseModel for PrivateAttrs, #4407 by @tlambert03
Allow for custom parsing of environment variables via parse_env_var in Config, #4406 by @acmiyaguchi
Discriminated union models now use oneOf instead of anyOf when generating OpenAPI schema definitions, #4335 by @MaxwellPayne
Allow type checkers to infer inner type of Json type. Json[list[str]] will be now inferred as list[str],
Json[Any] should be used instead of plain Json.
Runtime behaviour is not changed, #4332 by @Bobronium
Allow empty string aliases by using a alias is not None check, rather than bool(alias), #4253 by @sergeytsaplin
The use of __dataclass_transform__ has been replaced by typing_extensions.dataclass_transform, which is the preferred way to mark pydantic models as a dataclass under PEP 681, #4241 by @multimeric
Use parent model's Config when validating nested NamedTuple fields, #4219 by @synek
Update BaseModel.construct to work with aliased Fields, #4192 by @kylebamos
Catch certain raised errors in smart_deepcopy and revert to deepcopy if so, #4184 by @coneybeare
Add Config.anystr_upper and to_upper kwarg to constr and conbytes, #4165 by @satheler
Fix JSON schema for set and frozenset when they include default values, #4155 by @aminalaee
Teach the mypy plugin that methods decorated by @validator are classmethods, #4102 by @DMRobertson
Improve mypy plugin's ability to detect required fields, #4086 by @richardxia
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps pydantic from 1.9.1 to 1.10.0.
Release notes
Sourced from pydantic's releases.
... (truncated)
Changelog
Sourced from pydantic's changelog.
... (truncated)
Commits
64f2472
v1.10 :boom: (#4452)b065908
fix type hints inBaseSettings.Config
(#4450)f8575aa
prepare for v1.10.0b1 release0244b06
Warn and ignore__slots__
argument tocreate_model
(#4432)934adc1
prepare for v1.10.0a2 releasef708c32
avoid docs update on pre-release (#4429)9420c2b
Add how to skip the change file check to pull request template (#4428)135e3a5
setup - require typing_extensions>=4.1.0 for dataclass_transform (#4424)4832ae9
add Explosion AI and AWS to sponsors (#4413)9d2e1c4
patch/typo-in-pydantic-v2-docs (#4422)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)