v2.2.0
版本发布时间: 2023-08-17 20:02:41
pydantic/pydantic最新发布版本:v2.9.2(2024-09-17 22:59:21)
What's Changed
- Split "pipx install" setup command into two commands on the documentation site by @nomadmtb in https://github.com/pydantic/pydantic/pull/6869
- Deprecate
Field.include
by @hramezani in https://github.com/pydantic/pydantic/pull/6852 - Fix typo in default factory error msg by @hramezani in https://github.com/pydantic/pydantic/pull/6880
- Simplify handling of typing.Annotated in GenerateSchema by @dmontagu in https://github.com/pydantic/pydantic/pull/6887
- Re-enable fastapi tests in CI by @dmontagu in https://github.com/pydantic/pydantic/pull/6883
- Make it harder to hit collisions with json schema defrefs by @dmontagu in https://github.com/pydantic/pydantic/pull/6566
- Cleaner error for invalid input to
Path
fields by @samuelcolvin in https://github.com/pydantic/pydantic/pull/6903 - :memo: support Coordinate Type by @yezz123 in https://github.com/pydantic/pydantic/pull/6906
- Fix
ForwardRef
wrapper for py 3.10.0 (shim until bpo-45166) by @randomir in https://github.com/pydantic/pydantic/pull/6919 - Fix misbehavior related to copying of RootModel by @dmontagu in https://github.com/pydantic/pydantic/pull/6918
- Fix issue with recursion error caused by ParamSpec by @dmontagu in https://github.com/pydantic/pydantic/pull/6923
- Add section about Constrained classes to the Migration Guide by @Kludex in https://github.com/pydantic/pydantic/pull/6924
- Use
main
branch for badge links by @Viicos in https://github.com/pydantic/pydantic/pull/6925 - Add test for v1/v2 Annotated discrepancy by @carlbordum in https://github.com/pydantic/pydantic/pull/6926
- Make the v1 mypy plugin work with both v1 and v2 by @dmontagu in https://github.com/pydantic/pydantic/pull/6921
- Fix issue where generic models couldn't be parametrized with BaseModel by @dmontagu in https://github.com/pydantic/pydantic/pull/6933
- Remove xfail for discriminated union with alias by @dmontagu in https://github.com/pydantic/pydantic/pull/6938
- add field_serializer to computed_field by @andresliszt in https://github.com/pydantic/pydantic/pull/6965
- Use union_schema with Type[Union[...]] by @JeanArhancet in https://github.com/pydantic/pydantic/pull/6952
- Fix inherited typeddict attributes / config by @adriangb in https://github.com/pydantic/pydantic/pull/6981
- fix dataclass annotated before validator called twice by @davidhewitt in https://github.com/pydantic/pydantic/pull/6998
- Update test-fastapi deselected tests by @hramezani in https://github.com/pydantic/pydantic/pull/7014
- Fix validator doc format by @hramezani in https://github.com/pydantic/pydantic/pull/7015
- Fix typo in docstring of model_json_schema by @AdamVinch-Federated in https://github.com/pydantic/pydantic/pull/7032
- remove unused "type ignores" with pyright by @samuelcolvin in https://github.com/pydantic/pydantic/pull/7026
- Add benchmark representing FastAPI startup time by @adriangb in https://github.com/pydantic/pydantic/pull/7030
- Fix json_encoders for Enum subclasses by @adriangb in https://github.com/pydantic/pydantic/pull/7029
- Update docstring of
ser_json_bytes
regarding base64 encoding by @Viicos in https://github.com/pydantic/pydantic/pull/7052 - Allow
@validate_call
to work on async methods by @adriangb in https://github.com/pydantic/pydantic/pull/7046 - Fix: mypy error with
Settings
andSettingsConfigDict
by @JeanArhancet in https://github.com/pydantic/pydantic/pull/7002 - Fix some typos (repeated words and it's/its) by @eumiro in https://github.com/pydantic/pydantic/pull/7063
- Fix the typo in docstring by @harunyasar in https://github.com/pydantic/pydantic/pull/7062
- Docs: Fix broken URL in the pydantic-settings package recommendation by @swetjen in https://github.com/pydantic/pydantic/pull/6995
- Handle constraints being applied to schemas that don't accept it by @adriangb in https://github.com/pydantic/pydantic/pull/6951
- Replace almost_equal_floats with math.isclose by @eumiro in https://github.com/pydantic/pydantic/pull/7082
- bump pydantic-core to 2.5.0 by @davidhewitt in https://github.com/pydantic/pydantic/pull/7077
- Add
short_version
and use it in links by @hramezani in https://github.com/pydantic/pydantic/pull/7115 - 📝 Add usage link to
RootModel
by @Kludex in https://github.com/pydantic/pydantic/pull/7113 - Revert "Fix default port for mongosrv DSNs (#6827)" by @Kludex in https://github.com/pydantic/pydantic/pull/7116
- Clarify validate_default and _Unset handling in usage docs and migration guide by @benbenbang in https://github.com/pydantic/pydantic/pull/6950
- Tweak documentation of
Field.exclude
by @Viicos in https://github.com/pydantic/pydantic/pull/7086 - Do not require
validate_assignment
to useField.frozen
by @Viicos in https://github.com/pydantic/pydantic/pull/7103 - tweaks to
_core_utils
by @samuelcolvin in https://github.com/pydantic/pydantic/pull/7040 - Make DefaultDict working with set by @hramezani in https://github.com/pydantic/pydantic/pull/7126
- Don't always require typing.Generic as a base for partially parametrized models by @dmontagu in https://github.com/pydantic/pydantic/pull/7119
- Fix issue with JSON schema incorrectly using parent class core schema by @dmontagu in https://github.com/pydantic/pydantic/pull/7020
- Fix xfailed test related to TypedDict and alias_generator by @dmontagu in https://github.com/pydantic/pydantic/pull/6940
- Improve error message for NameEmail by @dmontagu in https://github.com/pydantic/pydantic/pull/6939
- Fix generic computed fields by @dmontagu in https://github.com/pydantic/pydantic/pull/6988
- Reflect namedtuple default values during validation by @dmontagu in https://github.com/pydantic/pydantic/pull/7144
- Update dependencies, fix pydantic-core usage, fix CI issues by @dmontagu in https://github.com/pydantic/pydantic/pull/7150
- Add mypy 1.5.0 by @hramezani in https://github.com/pydantic/pydantic/pull/7118
- Handle non-json native enum values by @adriangb in https://github.com/pydantic/pydantic/pull/7056
- document
round_trip
in Json type documentation by @jc-louis in https://github.com/pydantic/pydantic/pull/7137 - Relax signature checks to better support builtins and C extension functions as validators by @adriangb in https://github.com/pydantic/pydantic/pull/7101
- add union_mode='left_to_right' by @davidhewitt in https://github.com/pydantic/pydantic/pull/7151
- Include an error message hint for inherited ordering by @yvalencia91 in https://github.com/pydantic/pydantic/pull/7124
- Fix one docs link and resolve some warnings for two others by @dmontagu in https://github.com/pydantic/pydantic/pull/7153
- Include Field extra keys name in warning by @hramezani in https://github.com/pydantic/pydantic/pull/7136
- Prepare for v2.2.0 by @dmontagu in https://github.com/pydantic/pydantic/pull/7157
New Contributors
- @nomadmtb made their first contribution in https://github.com/pydantic/pydantic/pull/6869
- @RS-Credentive made their first contribution in https://github.com/pydantic/pydantic/pull/6878
- @ialarmedalien made their first contribution in https://github.com/pydantic/pydantic/pull/6886
- @randomir made their first contribution in https://github.com/pydantic/pydantic/pull/6919
- @carlbordum made their first contribution in https://github.com/pydantic/pydantic/pull/6926
- @vishallama made their first contribution in https://github.com/pydantic/pydantic/pull/6947
- @andresliszt made their first contribution in https://github.com/pydantic/pydantic/pull/6965
- @AdamVinch-Federated made their first contribution in https://github.com/pydantic/pydantic/pull/7032
- @eumiro made their first contribution in https://github.com/pydantic/pydantic/pull/7063
- @harunyasar made their first contribution in https://github.com/pydantic/pydantic/pull/7062
- @mo1ein made their first contribution in https://github.com/pydantic/pydantic/pull/7074
- @swetjen made their first contribution in https://github.com/pydantic/pydantic/pull/6995
- @benbenbang made their first contribution in https://github.com/pydantic/pydantic/pull/6950
- @jc-louis made their first contribution in https://github.com/pydantic/pydantic/pull/7137
- @yvalencia91 made their first contribution in https://github.com/pydantic/pydantic/pull/7124
Full Changelog: https://github.com/pydantic/pydantic/compare/v2.1.1...v2.2.0