Upgrading attrs 22 to 23
Review needed22.2.0 → 23.2.0Deprecated2New4Changed7Fixed7Other1
Review neededUpgrade verdict
2 deprecations.
In plain terms
- Support for checking zope interfaces with attrs is going away after April 2024.
- attrs.evolve() can now change fields named inst when the instance is positional; passing the instance via the inst keyword is deprecated.
Must act 2 items need code or config changes
Python requirement changed in 23.1.0: >=3.6 → >=3.7.
Nothing in this upgrade needs a code or configuration change.
Deprecations to plan for
Deprecated2
Deprecates zope-interface support via the attrs.validators.provides validator, to be removed in or after April 2024.
attrs.validators.providesattrs.evolve() can now change fields named inst when the instance is positional; passing the instance via the inst keyword is deprecated.
attrs.evolve()attr.evolve()instAPI changes
Generated by DepDelta from published Python source. Not mixed with prose notes.
- removed:
variable frozen - changed:
function field(*, default: None=…, validator: None=…, repr: _ReprArgType=…, hash: Optional[bool]=…, init: bool=…, metadata: Optional[Mapping[Any, Any]]=…, converter: None=…, factory: None=…, kw_only: bool=…, eq: Optional[bool]=…, order: Optional[bool]=…, on_setattr: Optional[_OnSetAttrArgType]=…, alias: Optional[str]=…) -> Any | (*, default: None=…, validator: Optional[_ValidatorArgType[_T]]=…, r… → function field(*, default: None=…, validator: None=…, repr: _ReprArgType=…, hash: Optional[bool]=…, init: bool=…, metadata: Optional[Mapping[Any, Any]]=…, converter: None=…, factory: None=…, kw_only: bool=…, eq: Optional[bool]=…, order: Optional[bool]=…, on_setattr: Optional[_OnSetAttrArgType]=…, alias: Optional[str]=…, type: Optional[type]=…) -> Any | (*, default: None=…, validator: Optional[_Va… - changed:
function make_class(name: str, attrs: Union[List[str], Tuple[str, ...], Dict[str, Any]], bases: Tuple[type, ...]=…, repr_ns: Optional[str]=…, repr: bool=…, cmp: Optional[_EqOrderType]=…, hash: Optional[bool]=…, init: bool=…, slots: bool=…, frozen: bool=…, weakref_slot: bool=…, str: bool=…, auto_attribs: bool=…, kw_only: bool=…, cache_hash: bool=…, auto_exc: bool=…, eq: Optional[_EqOrderType]=…, o… → function make_class(name: str, attrs: Union[List[str], Tuple[str, ...], Dict[str, Any]], bases: Tuple[type, ...]=…, class_body: Optional[Dict[str, Any]]=…, repr_ns: Optional[str]=…, repr: bool=…, cmp: Optional[_EqOrderType]=…, hash: Optional[bool]=…, init: bool=…, slots: bool=…, frozen: bool=…, weakref_slot: bool=…, str: bool=…, auto_attribs: bool=…, kw_only: bool=…, cache_hash: bool=…, auto_exc:… - changed:
function resolve_types(cls: _C, globalns: Optional[Dict[str, Any]]=…, localns: Optional[Dict[str, Any]]=…, attribs: Optional[List[Attribute[Any]]]=…) -> _C → function resolve_types(cls: _A, globalns: Optional[Dict[str, Any]]=…, localns: Optional[Dict[str, Any]]=…, attribs: Optional[List[Attribute[Any]]]=…, include_extras: bool=…) -> _A - added:
function frozen(maybe_cls: _C, *, these: Optional[Dict[str, Any]]=…, repr: bool=…, unsafe_hash: Optional[bool]=…, hash: Optional[bool]=…, init: bool=…, slots: bool=…, frozen: bool=…, weakref_slot: bool=…, str: bool=…, auto_attribs: bool=…, kw_only: bool=…, cache_hash: bool=…, auto_exc: bool=…, eq: Optional[bool]=…, order: Optional[bool]=…, auto_detect: bool=…, getstate_setstate: Optional[bool]=…,…
- changed:
function exclude(*what: Union[type, Attribute[Any]]) -> _FilterType[Any] → function exclude(*what: Union[type, str, Attribute[Any]]) -> _FilterType[Any] - changed:
function include(*what: Union[type, Attribute[Any]]) -> _FilterType[Any] → function include(*what: Union[type, str, Attribute[Any]]) -> _FilterType[Any]
- changed:
function optional(validator: Union[_ValidatorType[_T], List[_ValidatorType[_T]]]) -> _ValidatorType[Optional[_T]] → function optional(validator: Union[_ValidatorType[_T], List[_ValidatorType[_T]], Tuple[_ValidatorType[_T]]]) -> _ValidatorType[Optional[_T]]
- changed:
function asdict(inst: Any, recurse: bool=…, filter: Optional[_FilterType[Any]]=…, dict_factory: Type[Mapping[Any, Any]]=…, retain_collection_types: bool=…, value_serializer: Optional[Callable[[type, Attribute[Any], Any], Any]]=…, tuple_keys: bool=…) -> Dict[str, Any] → function asdict(inst: AttrsInstance, recurse: bool=…, filter: Optional[_FilterType[Any]]=…, dict_factory: Type[Mapping[Any, Any]]=…, retain_collection_types: bool=…, value_serializer: Optional[Callable[[type, Attribute[Any], Any], Any]]=…, tuple_keys: bool=…) -> Dict[str, Any] - changed:
function astuple(inst: Any, recurse: bool=…, filter: Optional[_FilterType[Any]]=…, tuple_factory: Type[Sequence[Any]]=…, retain_collection_types: bool=…) -> Tuple[Any, ...] → function astuple(inst: AttrsInstance, recurse: bool=…, filter: Optional[_FilterType[Any]]=…, tuple_factory: Type[Sequence[Any]]=…, retain_collection_types: bool=…) -> Tuple[Any, ...]