Welcome to cattrs 23.2.0! Thanks to all our wonderful contributors, this release happens to have the largest changelog so far.
Here are some of the noteworthy additions, see below for the entire changelog.
More Powerful Unions in preconf
Courtesy of the union passthrough strategy, the following class (and others like it, this is just a complex example) will work out-of-the-box on any preconf converter:
@define
class MyClass:
my_field: str | Literal[1] | MyOtherClass
The strategy has been preapplied to all preconf converters, but it can be manually applied to any converter.
Default Disambiguation via Literals
When structuring a union of attrs classes, cattrs will default to the default union strategy.
This strategy works by finding required unique fields in the given classes.
It has been enhanced with support for matching on fields annotated as Literals.
Generate unique files only in case of linecache enabled.
(#445#441)
23.2.2 (2023-11-21)
Fix a regression when unstructuring Any | None.
(#453#454)
23.2.1 (2023-11-18)
Fix unnecessary typing_extensions import on Python 3.11.
(#446#447)
23.2.0 (2023-11-17)
Potentially breaking: skip attrs fields marked as init=False by default. This change is potentially breaking for unstructuring.
See here for instructions on how to restore the old behavior.
(#40#395)
Potentially breaking: {py:func}cattrs.gen.make_dict_structure_fn and {py:func}cattrs.gen.typeddicts.make_dict_structure_fn will use the values for the detailed_validation and forbid_extra_keys parameters from the given converter by default now.
If you're using these functions directly, the old behavior can be restored by passing in the desired values directly.
(#410#411)
Potentially breaking: The default union structuring strategy will also use fields annotated as typing.Literal to help guide structuring.
See here for instructions on how to restore the old behavior.
(#391)
Python 3.12 is now supported. Python 3.7 is no longer supported; use older releases there.
(#424)
Implement the union passthrough strategy, enabling much richer union handling for preconfigured converters. Learn more here.
Introduce the use_class_methods strategy. Learn more here.
(#405)
The omit parameter of {py:func}cattrs.override is now of type bool | None (from bool).
None is the new default and means to apply default cattrs handling to the attribute, which is to omit the attribute if it's marked as init=False, and keep it otherwise.
Add support for date to preconfigured converters.
(#420)
Add support for datetime.dates to the PyYAML preconfigured converter.
(#393)
Fix {py:func}format_exception() <cattrs.v.format_exception> parameter working for recursive calls to {py:func}transform_error <cattrs.transform_error>.
(#389)
attrs aliases are now supported, although aliased fields still map to their attribute name instead of their alias by default when un/structuring.
(#322#391)
Added "codecs" feature to separate data models from serialization and work with top-level lists, dataclasses without mixins etc. (#108, #69), see updated documentation
Added new allow_deserialization_not_by_alias config option to allow deserialization by both alias and field name, see documentation (Fatal1ty/mashumaro#175)
Fixed UnserializableDataError for generic serializable types and generic serialization strategies with postponed evaluation of annotations (#177)
Fixed regression when ValueError was not thrown if invalid value type was passed to from_* method
This is a patch release in the 2.1.x series and includes some regression and bug fixes, and a security fix. We recommend that all users upgrade to this version.
See the full whatsnew for a list of all the changes.
The release will be available on the defaults and conda-forge channels:
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
- `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
- `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency
- `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
Bumps the benchmark group in /benchmark with 6 updates:
23.1.2
23.2.3
3.10
3.11
3.8.0
3.8.2
2.1.1
2.1.3
2.4.2
2.5.2
0.12.3
0.12.6
Updates
cattrs
from 23.1.2 to 23.2.3Release notes
Sourced from cattrs's releases.
... (truncated)
Changelog
Sourced from cattrs's changelog.
... (truncated)
Commits
5dc43b3
v23.2.33f63212
Flesh out history48cb3d0
Fix unstructuring underspecified generics (#466)88d4758
Optimize linecaching (#464)5b1fa6a
Fix dict value unstructuring (#462)b47f446
Avoid linecache unique file generation in case of linecache disabled (#461)bed932c
v23.2.2281f324
Fix regression (#454)c098cd8
v23.2.125d15d6
Import typing_extensions.TypeAlias only on python < 3.11 (#447)Updates
mashumaro
from 3.10 to 3.11Release notes
Sourced from mashumaro's releases.
Commits
517d8d5
Bump versiond6b7e7e
Update benchmark in READMEd5f98a2
Update benchmarksd526eb4
Update README9b31554
Merge pull request #169 from Fatal1ty/top-level-serializationd1b9d0e
Merge remote-tracking branch 'origin/master' into top-level-serialization0489e8e
Update README2f6ff20
Update README558bd17
Update usage example660b35c
Fix link in READMEUpdates
matplotlib
from 3.8.0 to 3.8.2Release notes
Sourced from matplotlib's releases.
Commits
eb02b10
REL: v3.8.2dfb7a46
Github stats fo v3.8.28023978
Merge branch 'v3.8.1-doc' into v3.8.xacae9bf
Merge pull request #27339 from meeseeksmachine/auto-backport-of-pr-27299-on-v...95743f0
Merge pull request #27338 from meeseeksmachine/auto-backport-of-pr-27334-on-v...cfb494f
Backport PR #27299: [MNT] swap xkcd script for humor sans26fd30a
Backport PR #27334: Omit MOVETO lines from nearest contour logic38a0e94
Merge pull request #27324 from meeseeksmachine/auto-backport-of-pr-27323-on-v...2b58748
Backport PR #27323: [DOC] Minor fixes for savefig-docstring94c0cfe
Merge pull request #27314 from meeseeksmachine/auto-backport-of-pr-27312-on-v...Updates
pandas
from 2.1.1 to 2.1.3Release notes
Sourced from pandas's releases.
Commits
2a953cf
RLS: 2.1.3d9665ca
Backport PR #55911 on branch 2.1.x (DOC: convert outdated example of NumPy's ...92ce245
Backport PR #55907 on branch 2.1.x (DOC: Add release date for 2.1.3) (#55913)1691a51
Backport PR #55894 on 2.1.x: Parquet/Feather IO: disable PyExtensionType auto...4158666
Backport PR #55764 on branch 2.1.x (REGR: fix return class in _constructor_fr...de8af3c
Backport PR #55427 on branch 2.1.x (DOC: Remove outdated docs about NumPy's b...569f904
Backport PR #55227 on branch 2.1.x (BUG: Interchange object data buffer has t...c9854d9
TST: Make read_csv tests pyarrow 13 compatable on 2.1.x (#55855)7702f41
Backport PR #55853: DEPS: Use ipython run_cell instead of run_code; remove py...0bf70c7
Backport PR #55761 on branch 2.1.x (BUG: DatetimeIndex.diff raising TypeError...Updates
pydantic
from 2.4.2 to 2.5.2Release notes
Sourced from pydantic's releases.
... (truncated)
Changelog
Sourced from pydantic's changelog.
... (truncated)
Commits
b75cb28
updating history for patch release based on new core changes365e587
bumping core to 2.14.52033119
Fix:JsonValue
bool
serialization (#8190)34ef158
prep for 2.5.2 release (#8169)25d1197
uprev corecc168a8
AddConfigDict.ser_json_inf_nan
(#8159)01c970b
Fixmodel_validator
example usage code (#8141)4982d57
Prepare release 2.5.1 (#8132)0a13900
fix "from_json" docs5cd45f2
uprev pydantic-core to 2.14.3 (#8120)Updates
pyserde
from 0.12.3 to 0.12.6Release notes
Sourced from pyserde's releases.
Commits
7119be7
Merge pull request #446 from yukinarit/update-contributorsd19075e
:busts_in_silhouette: Add@maallaire
as a contributoree7edae
Merge pull request #445 from maallaire/fix-iter_types-set63b55e4
Removed List in iter_types if type is Set00b1cfb
Fix test for python3.879433a4
Added test coverage for Set handling with custom serializer/deserializersea8203f
Fix: Set handling in compat.py iter_types for custom serializer/deserializer1cba1da
Merge pull request #441 from yukinarit/fix-union-any596e7f6
Fix serializing union with Any76e919c
Merge pull request #439 from yukinarit/update-contributorsDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show