attrs v19.1.0 Release Notes
Release Date: 2019-03-03 // about 5 years ago-
Backward-incompatible Changes
- ๐ Fixed a bug where deserialized objects with
cache_hash=True
could have incorrect hash code values. This change breaks classes withcache_hash=True
when a custom__setstate__
is present. An exception will be thrown when applying theattrs
annotation to such a class. This limitation is tracked in issue#494 <https://github.com/python-attrs/attrs/issues/494>
.#482 <https://github.com/python-attrs/attrs/issues/482>
๐ Changes ^
Add
is_callable
,deep_iterable
, anddeep_mapping
validators.is_callable
: validates that a value is callabledeep_iterable
: Allows recursion down into an iterable, applying another validator to every member in the iterable as well as applying an optional validator to the iterable itself.deep_mapping
: Allows recursion down into the items in a mapping object, applying a key validator and a value validator to the key and value in every item. Also applies an optional validator to the mapping object itself.
You can find them in the
attr.validators
package.#425 <https://github.com/python-attrs/attrs/issues/425>
_- Fixed stub files to prevent errors raised by mypy's
disallow_any_generics = True
option.#443 <https://github.com/python-attrs/attrs/issues/443>
_ - Attributes with
init=False
now can follow afterkw_only=True
attributes.#450 <https://github.com/python-attrs/attrs/issues/450>
_ - ๐ป
attrs
now has first class support for defining exception classes.
If you define a class using
@attr.s(auto_exc=True)
and subclass an exception, the class will behave like a well-behaved exception class including an appropriate__str__
method, and all attributes additionally available in anargs
attribute.#500 <https://github.com/python-attrs/attrs/issues/500>
_- ๐ Clarified documentation for hashing to warn that hashable objects should be deeply immutable (in their usage, even if this is not enforced).
#503 <https://github.com/python-attrs/attrs/issues/503>
_
- ๐ Fixed a bug where deserialized objects with