What's Changed
- Replace deprecated
validator
usage by @Viicos in #5712 - Use
typing.Self
for@classmethod
constructors by @Viicos in #5713 - Improve usage errors by @hramezani in #5699
- ⚡ Speedup
ModelPrivateAttr
by @lig in #5709 - Updates model docstrings by @tpdorsey in #5715
- Re-organize exports for new validators and serializers by @adriangb in #5641
- Replace TypeError with ValidationError in forzen model by @hramezani in #5717
- ✅ Improve internal validators test coverage by @lig in #5700
- Generate separate JSON schema for inputs vs. outputs by @dmontagu in #5707
- Add PastDatetime and FutureDatetime types by @hramezani in #5720
- Uprev pydantic-core to 0.31.0 by @adriangb in #5727
- Fix typo in error message by @hramezani in #5734
- Fix use of None as type of private attribute by @dmontagu in #5735
- Models usage docs revisions by @tpdorsey in #5738
- Don't try to automatically handle subclasses of known types by @adriangb in #5737
- ✅ Improve test coverage by @lig in #5710
- Improve validation errors doc by @hramezani in #5733
- Make usage errors code blocks testable. by @hramezani in #5743
- Respect config.alias_generator in pydantic dataclass by @hramezani in #5673
- Fix typo in error code by @hramezani in #5748
- updates to errors and fields docstrings by @tpdorsey in #5746
- correct deprecated warning message in _copy_and_set_values method by @rmargar in #5753
- ✅ Improve test coverage by @lig in #5742
- Eliminate the undefined types warning by @dmontagu in #5754
- Fixes typo in documentation by @halfdanrump in #5756
- Do not try to automatically handle subclasses of mappings by @adriangb in #5744
- Add
lig
to the reviewers list by @lig in #5759 - Generate JSON schema for Sequence[T] as though it was List[T] by @dmontagu in #5706
- Remove xfail from
tests.test_edge_cases.test_custom_generic_validators
by @dmontagu in #5764 - Add pydantic-settings test to CI by @hramezani in #5758
- stop BaseModel inheriting from
_repr.Representation
by @samuelcolvin in #5740 - Edits for Usage Error documentation by @tpdorsey in #5774
- Add protected namespaces by @hramezani in #5768
- More docstrings edits - json schema and functional serializers by @tpdorsey in #5762
- add api docs for pydantic-core by @samuelcolvin in #5695
- Remove dead code by @adriangb in #5775
- Copy edits for validation errors by @tpdorsey in #5777
- 🔥 Remove
_base_class_defined
hack in favor of an empty bases check by @lig in #5761 - Support recursive dataclasses by @dmontagu in #5760
- Update typo in computed_fields.md by @john-g-g in #5786
- Use uvicorn-style strings for ImportString by @dmontagu in #5776
- Add v1 namespace inside pydantic by @hramezani in #5780
- Add a convenience type to override JSON schema by @dmontagu in #5788
- Add a signature for init_subclass to typecheck class kwargs by @dmontagu in #5791
- BaseModel class attributes documented by @tpdorsey in #5787
- Add note about dynamically created model pickling by @hramezani in #5781
- Do not inherit config in model fields that are themselves of type model by @dmontagu in #5793
- Replace class Config with model_config by @hramezani in #5799
- Uprev pydantic-core to 0.32.0 by @adriangb in #5805
- Make decoratorinfos attributes plural by @dmontagu in #5802
- Rework
__prepare_pydantic_annotations__
to make it easier to wrap "known" types by @adriangb in #5801 - Remove various TODO comments by @dmontagu in #5806
- Address more todo comments by @dmontagu in #5809
- Add annotation that lets you skip validation by @dmontagu in #5583
- ✨ Add
RootModel
support by @lig in #5765 - Fix some issues with pydantic extra by @dmontagu in #5810
- Move error handling to Error Messages by @tpdorsey in #5794
- Fix json type json schema test by @dmontagu in #5808
- Fix tests for create_model title and description by @hramezani in #5796
- Improve typechecking, docs, and minor bugs with Field/FieldInfo by @dmontagu in #5800
- Add a convenience type for transforming a core schema via annotation by @dmontagu in #5819
- see what happens with cf pages by @samuelcolvin in #5828
- Do not automatically handle subclasses of Iterable by @dmontagu in #5834
- Improve contribution guidelines by @tpdorsey in #5817
- Use alias generator with computed fields by @dmontagu in #5836
- Address root model feedback by @dmontagu in #5820
- Ignore pytest warnings on 3.12 by @JelleZijlstra in #5849
- Change pydantic to be compatible with typing-extension==4.6.1 by @hramezani in #5843
- Add note about V1 PRs by @tpdorsey in #5855
- Fix bug partial get core schema by @adriangb in #5856
- Revise documentation landing page by @tpdorsey in #5835
- Add Kludex to reviewer list by @Kludex in #5862
- Use
duration
instead oftime-delta
type fortimedelta
on JSON schema by @Kludex in #5864 - Add InstanceOf type/annotation by @dmontagu in #5778
- Update pydantic-core to 0.34.0 by @adriangb in #5860
- Add a test demonstrating initvar works with inheritance by @dmontagu in #5859
- Disallow non-nested types as non-annotated values by @dmontagu in #5869
- Handle validators on vanilla dataclass fields by @dmontagu in #5857
- Refactor handling of Enum and IP types to homogenize known type handling by @adriangb in #5837
- move
ModelMetaclass
to_internal._model_construction
by @samuelcolvin in #5865 - Fix kw_only inheritance by @dmontagu in #5873
- ⚡ Optimize kw_only inheritance by @lig in #5878
- Fix dataclass stuff by @dmontagu in #5874
- Update pydantic-core to 0.35.0 by @hramezani in #5846
- Ensure
__get_pydantic_json_schema__
always gets the schema passed down from a wrapping handler by @adriangb in #5876 - Add hide_input_in_errors config by @hramezani in #5879
- ✅ Improve test coverage by @lig in #5885
- 🐛 Config option
allow_inf_nan
doesn't work forDecimal
by @lig in #5868 - Allow
__prepare_pydantic_annotations__
to exist without__get_pydantic_core_schema__
by @adriangb in #5886 - Bump pyright to 1.1.310 by @adriangb in #5887
- Fix botched merge, cleanup unused code by @adriangb in #5888
- prevent
_internal
objects becoming public by @samuelcolvin in #5892 - Use
__pydantic_private__
for storing private attributes by @dmontagu in #5891 - fixing xfails by @samuelcolvin in #5894
- Fix
@model_validator
on nested models by @adriangb in #5889 - Complete ConfigWrapper test coverage by @hramezani in #5900
- ✅ Improve test coverage by @lig in #5895
- Update typing-extensions to 4.6.1 by @adriangb in #5901
- Enforce constraints on arbitrary types via functional validators by @adriangb in #5883
- Add validators for TypedDict by @adriangb in #5877
- Add test for default values in annotated schema by @adriangb in #5902
- Uprev pydantic-core to 0.37.0 by @adriangb in #5905
- 🐛 Fix
AttributeError
on deleting a field of a Model having aPrivateAttr
defined by @lig in #5897 - 💚 Move email tests to "tests with deps" job by @lig in #5904
- Move model before validators by @samuelcolvin in #5898
- Feat/serialize import string by @ybressler in #5841
- remove xfails from docs by @samuelcolvin in #5910
- add compatibility shim for
__fields__
->model_fields
by @samuelcolvin in #5912 - improve coverage in main.py by @samuelcolvin in #5913
- Complete test coverage pydantic/_internal/_serializers.py by @hramezani in #5915
- Add
lenient_issubclass
andlenient_isinstance
toDEPRECATED_MOVED_IN_V2
by @Kludex in #5916 - Improve test coverage for pydantic._internal._utils by @hramezani in #5917
- Add most used imports to
DEPRECATED_MOVED_IN_V2
by @Kludex in #5926 - Hide pydantic*_ from @dataclass_transform by @dmontagu in #5923
- Fix mypy plugin for 1.4.0 by @cdce8p in #5927
- Improve test coverage for pydantic._internal._core_metadata by @hramezani in #5933
- support for
return_schema
on functional serializers by @samuelcolvin in #5920 - Support TypeAliasType for generic and recursive type aliases by @adriangb in #5861
- fix datetime parsing tests by @samuelcolvin in #5938
- Logo grid for pydantic users by @tpdorsey in #5880
- Disallow passing config to TypeAdapter for models and implement config for TypedDict by @adriangb in #5939
- fix dataclasses, uprev pydantic-core by @samuelcolvin in #5942
- Improve test coverage for pydantic.type_adapter by @hramezani in #5930
- Improve test coverage of pydantic._internal._core_utils by @hramezani in #5936
- Update docstrings - errors through functional serializers by @tpdorsey in #5940
- ✅ More
RootModel
tests by @lig in #5943 - Improve test coverage for pydantic.types by @hramezani in #5950
- Update docstrings - alias_generators through dataclasses by @tpdorsey in #5932
- Make instanceof schema work with arbitrary types by @dmontagu in #5947
- Improve test coverage for pydantic.functional_validator by @hramezani in #5955
- 🐛 Fix
RootModel
equality logic by @lig in #5948 - Increase coverage for
json_schema.py
by @Kludex in #5934 - Improve test coverage for pydantic._migration by @hramezani in #5964
- Increase coverage for
json_schema.py
by @Kludex in #5963 - Move
pydantic.annotated
to top level by @adriangb in #5954 - Rename old analyzed type variables name in test by @hramezani in #5965
- Fix Decimal trailing zero handling by @hramezani in #5962
- Docstrings updates for validation by @tpdorsey in #5967
- Prepare for Beta 1 release by @samuelcolvin in #5969
New Contributors
- @Viicos made their first contribution in #5712
- @rmargar made their first contribution in #5753
- @halfdanrump made their first contribution in #5756
- @john-g-g made their first contribution in #5786
- @JelleZijlstra made their first contribution in #5849
Full Changelog: v2.0a4...v2.0b1