Upgrading pydantic 0.16 to 0.17
Breaking0.16.1 → 0.17Breaking1Deprecated1New3Changed1Fixed4Other1
BreakingUpgrade verdict
1 breaking change.
In plain terms
- The dataclasses decorator now takes a Config class instead of the validate_assignment argument.
- The get_validators method is now named __get_validators__; the old name still works but warns.
Must act 2 items need code or config changes
What you must change
Breaking1
Supports passing a Config class in the dataclasses decorator, superseding the
validate_assignment argument with config.Configvalidate_assignmentconfigDeprecations to plan for
Deprecated1
Renames
get_validators to __get_validators__, with a deprecation warning on use of the old name.get_validators__get_validators__API changes
Generated by DepDelta from published Python source. Not mixed with prose notes.
- changed:
function dataclass(_cls=…, *, init=…, repr=…, eq=…, order=…, unsafe_hash=…, frozen=…, validate_assignment=…) → function dataclass(_cls=…, *, init=…, repr=…, eq=…, order=…, unsafe_hash=…, frozen=…, config=…)
- added:
class DataclassTypeError(PydanticTypeError) - added:
field DataclassTypeError.code - added:
field DataclassTypeError.msg_template
- changed:
constructor Field(*, name: str, type_: Type, class_validators: List[Validator], default: Any, required: bool, model_config: Any, alias: str=…, allow_none: bool=…, schema=…) → constructor Field(*, name: str, type_: Type, class_validators: Dict[str, Validator], default: Any, required: bool, model_config: Any, alias: str=…, allow_none: bool=…, schema=…)
- removed:
static method BaseModel.get_validators() - changed:
function create_model(model_name: str, *, __config__: Type[BaseConfig]=…, __base__: Type[BaseModel]=…, **field_definitions) → function create_model(model_name: str, *, __config__: Type=…, __base__: Type[BaseModel]=…, **field_definitions) - changed:
function inherit_config(self_config: Type[BaseConfig], parent_config: Type[BaseConfig]) -> Type[BaseConfig] → function inherit_config(self_config: Type, parent_config: Type[BaseConfig]) -> Type[BaseConfig]
- removed:
static method ConstrainedDecimal.get_validators() - removed:
static method ConstrainedFloat.get_validators() - removed:
static method ConstrainedInt.get_validators() - removed:
static method ConstrainedStr.get_validators() - removed:
static method DSN.get_validators() - removed:
static method DirectoryPath.get_validators() - removed:
static method EmailStr.get_validators() - removed:
static method FilePath.get_validators() - removed:
static method Json.get_validators() - removed:
static method NameEmail.get_validators() - removed:
static method PyObject.get_validators() - removed:
static method StrictStr.get_validators() - removed:
static method UrlStr.get_validators()
- added:
function in_ipython()