All Versions
27
Latest Version
Avg Release Cycle
83 days
Latest Release
543 days ago
Changelog History
Page 1
Changelog History
Page 1
-
v22.2.0 Changes
October 03, 2022- Potentially breaking:
cattrs.Converter
has been renamed tocattrs.BaseConverter
, andcattrs.GenConverter
tocattrs.Converter
. TheGenConverter
name is still available for backwards compatibility, but is deprecated. If you were depending on functionality specific to the oldConverter
, change your import tofrom cattrs import BaseConverter
. - ๐
NewTypes <https://docs.python.org/3/library/typing.html#newtype>
_ are now supported by thecattrs.Converter
. (#255 <https://github.com/python-attrs/cattrs/pull/255>
,#94 <https://github.com/python-attrs/cattrs/issues/94>
,#297 <https://github.com/python-attrs/cattrs/issues/297>
_) cattrs.Converter
andcattrs.BaseConverter
can now copy themselves using thecopy
method. (#284 <https://github.com/python-attrs/cattrs/pull/284>
_)- ๐ Python 3.11 support.
- ๐ cattrs now supports un/structuring
kw_only
fields on attrs classes into/from dictionaries. (#247 <https://github.com/python-attrs/cattrs/pull/247>
_) - โช PyPy support (and tests, using a minimal Hypothesis profile) restored.
(
#253 <https://github.com/python-attrs/cattrs/issues/253>
_) - ๐ Fix propagating the
detailed_validation
flag to mapping and counter structuring generators. - Fix
typing.Set
applying too broadly when used with theGenConverter.unstruct_collection_overrides
parameter on Python versions below 3.9. Switch totyping.AbstractSet
on those versions to restore the old behavior. (#264 <https://github.com/python-attrs/cattrs/issues/264>
_) - ๐ Uncap the required Python version, to avoid problems detailed in https://iscinumpy.dev/post/bound-version-constraints/#pinning-the-python-version-is-special
(
#275 <https://github.com/python-attrs/cattrs/issues/275>
_) - Fix
Converter.register_structure_hook_factory
andcattrs.gen.make_dict_unstructure_fn
type annotations. (#281 <https://github.com/python-attrs/cattrs/issues/281>
_) - ๐ฆ Expose all error classes in the
cattr.errors
namespace. Note that it is deprecated, just usecattrs.errors
. (#252 <https://github.com/python-attrs/cattrs/issues/252>
_) - ๐ Fix generating structuring functions for types with quotes in the name.
(
#291 <https://github.com/python-attrs/cattrs/issues/291>
_#277 <https://github.com/python-attrs/cattrs/issues/277>
_) - ๐ Fix usage of notes for the final version of
PEP 678 <https://peps.python.org/pep-0678/>
, supported sinceexceptiongroup>=1.0.0rc4
. (#303 <303 <https://github.com/python-attrs/cattrs/pull/303>
)
- Potentially breaking:
-
v22.1.0 Changes
April 03, 2022- cattrs now uses the CalVer versioning convention.
- โ
cattrs now has a detailed validation mode, which is enabled by default. Learn more
here <https://cattrs.readthedocs.io/en/latest/validation.html>
_. The old behavior can be restored by creating the converter withdetailed_validation=False
. attrs
and dataclass structuring is now ~25% faster.- ๐ Fix an issue structuring bare
typing.List
s on Pythons lower than 3.9. (#209 <https://github.com/python-attrs/cattrs/issues/209>
_) - ๐ Fix structuring of non-parametrized containers like
list/dict/...
on Pythons lower than 3.9. (#218 <https://github.com/python-attrs/cattrs/issues/218>
_) - ๐ Fix structuring bare
typing.Tuple
on Pythons lower than 3.9. (#218 <https://github.com/python-attrs/cattrs/issues/218>
_) - Fix a wrong
AttributeError
of an missing__parameters__
attribute. This could happen when inheriting certain generic classes โ for exampletyping.*
classes are affected. (#217 <https://github.com/python-attrs/cattrs/issues/217>
_) - ๐ Fix structuring of
enum.Enum
instances intyping.Literal
types. (#231 <https://github.com/python-attrs/cattrs/pull/231>
_) - ๐ Fix unstructuring all tuples - unannotated, variable-length, homogenous and heterogenous - to
list
. (#226 <https://github.com/python-attrs/cattrs/issues/226>
_) - For
forbid_extra_keys
raise customForbiddenExtraKeyError
instead of genericException
. (#225 <https://github.com/python-attrs/cattrs/pull/225>
_) - ๐ All preconf converters now support
loads
anddumps
directly. See an examplehere <https://cattrs.readthedocs.io/en/latest/preconf.html>
_. - ๐ Fix mappings with byte keys for the orjson, bson and tomlkit converters.
(
#241 <https://github.com/python-attrs/cattrs/issues/241>
_)
-
v1.10.0 Changes
January 04, 2022- โ Add PEP 563 (string annotations) support for dataclasses.
(
#195 <https://github.com/python-attrs/cattrs/issues/195>
_) - ๐ Fix handling of dictionaries with string Enum keys for bson, orjson, and tomlkit.
- Rename the
cattr.gen.make_dict_unstructure_fn.omit_if_default
parameter to_cattrs_omit_if_default
, for consistency. Theomit_if_default
parameters toGenConverter
andoverride
are unchanged. - ๐ฆ Following the changes in
attrs
21.3.0, add acattrs
package mirroring the existingcattr
package. Both package names may be used as desired, and thecattr
package isn't going away.
- โ Add PEP 563 (string annotations) support for dataclasses.
(
-
v1.9.0 Changes
December 06, 2021- ๐ Python 3.10 support, including support for the new union syntax (
A | B
vsUnion[A, B]
). - The
GenConverter
can now properly structure generic classes with generic collection fields. (#149 <https://github.com/python-attrs/cattrs/issues/149>
_) omit=True
now also affects generated structuring functions. (#166 <https://github.com/python-attrs/cattrs/issues/166>
_)cattr.gen.{make_dict_structure_fn, make_dict_unstructure_fn}
now resolve type annotations automatically when PEP 563 is used. (#169 <https://github.com/python-attrs/cattrs/issues/169>
_)- Protocols are now unstructured as their runtime types.
(
#177 <https://github.com/python-attrs/cattrs/pull/177>
_) - Fix an issue generating structuring functions with renaming and
_cattrs_forbid_extra_keys=True
. (#190 <https://github.com/python-attrs/cattrs/issues/190>
_)
- ๐ Python 3.10 support, including support for the new union syntax (
-
v1.8.0 Changes
August 13, 2021- ๐ Fix
GenConverter
mapping structuring for unannotated dicts on Python 3.8. (#151 <https://github.com/python-attrs/cattrs/issues/151>
_) - The source code for generated un/structuring functions is stored in the
linecache
cache, which enables more informative stack traces when un/structuring errors happen using theGenConverter
. This behavior can optionally be disabled to save memory. - ๐ Support using the attr converter callback during structure.
By default, this is a method of last resort, but it can be elevated to the default by setting
prefer_attrib_converters=True
onConverter
orGenConverter
. (#138 <https://github.com/python-attrs/cattrs/issues/138>
_) - ๐ Fix structuring recursive classes.
(
#159 <https://github.com/python-attrs/cattrs/issues/159>
_) - ๐ Converters now support un/structuring hook factories. This is the most powerful and complex venue for customizing un/structuring. This had previously been an internal feature.
- ๐ The
Common Usage Examples <https://cattrs.readthedocs.io/en/latest/usage.html#using-factory-hooks>
_ documentation page now has a section on advanced hook factory usage. - ๐
cattr.override
now supports theomit
parameter, which makescattrs
skip the atribute entirely when unstructuring. - ๐ฆ The
cattr.preconf.bson
module is now tested against thebson
module bundled with thepymongo
package, because that package is much more popular than the standalone PyPIbson
package.
- ๐ Fix
-
v1.7.1 Changes
May 28, 2021- ๐
Literal
s are not supported on Python 3.9.0 (supported on 3.9.1 and later), so we skip importing them there. (#150 <https://github.com/python-attrs/cattrs/issues/150>
_)
- ๐
-
v1.7.0 Changes
May 26, 2021cattr.global_converter
(which providescattr.unstructure
,cattr.structure
etc.) is now an instance ofcattr.GenConverter
.- ๐
Literal
s are now supported and validated when structuring. - ๐ Fix dependency metadata information for
attrs
. (#147 <https://github.com/python-attrs/cattrs/issues/147>
_) - ๐ Fix
GenConverter
mapping structuring for unannotated dicts. (#148 <https://github.com/python-attrs/cattrs/issues/148>
_)
-
v1.6.0 Changes
April 28, 2021cattrs
now uses Poetry.GenConverter
mapping structuring is now ~25% faster, and unstructuring heterogenous tuples is significantly faster.- โ Add
cattr.preconf
. This package contains modules for making converters for particular serialization libraries. We currently support the standard libraryjson
, and third-partyujson
,orjson
,msgpack
,bson
,pyyaml
andtomlkit
libraries.
-
v1.5.0 Changes
April 15, 2021- ๐ Fix an issue with
GenConverter
unstructuringattrs
classes and dataclasses with generic fields. (#65 <https://github.com/python-attrs/cattrs/issues/65>
_) GenConverter
has support for easy overriding of collection unstructuring types (for example, unstructure all sets to lists) through itsunstruct_collection_overrides
argument. (#137 <https://github.com/python-attrs/cattrs/pull/137>
_)- Unstructuring mappings with
GenConverter
is significantly faster. GenConverter
supports strict handling of unexpected dictionary keys through itsforbid_extra_keys
argument. (#142 <https://github.com/python-attrs/cattrs/pull/142>
_)
- ๐ Fix an issue with
-
v1.4.0 Changes
March 21, 2021- ๐ Fix an issue with
GenConverter
un/structuring hooks when a function hook is registered after the converter has already been used. - โ Add support for
collections.abc.{Sequence, MutableSequence, Set, MutableSet}
. These should be used on 3.9+ instead of theirtyping
alternatives, which are deprecated. (#128 <https://github.com/python-attrs/cattrs/issues/128>
_) - The
GenConverter
will unstructure iterables (list[T]
,tuple[T, ...]
,set[T]
) using their type argument instead of the runtime class if its elements, if possible. These unstructuring operations are up to 40% faster. (#129 <https://github.com/python-attrs/cattrs/issues/129>
_) - Flesh out
Converter
andGenConverter
initializer type annotations. (#131 <https://github.com/python-attrs/cattrs/issues/131>
_) - โ Add support for
typing.Annotated
on Python 3.9+.cattrs
will use the first annotation present.cattrs
specific annotations may be added in the future. (#127 <https://github.com/python-attrs/cattrs/issues/127>
_) - โ Add support for dataclasses.
(
#43 <https://github.com/python-attrs/cattrs/issues/43>
_)
- ๐ Fix an issue with