Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump cattrs from 23.1.2 to 23.2.1 #325

Closed
wants to merge 1 commit into from

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Nov 20, 2023

Bumps cattrs from 23.1.2 to 23.2.1.

Release notes

Sourced from cattrs's releases.

v23.2.1

23.2.1 (2023-11-18)

  • Fix unnecessary typing_extensions import on Python 3.11. (#446 #447)

For the v23.2.0 release notes, see here.

v23.2.0

23.2.0 (2023-11-17)

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.

from typing import Literal
@​define
class ClassA:
field_one: Literal["one"]
@​define
class ClassB:
field_one: Literal["two"] = "two"

Un/structuring Hooks on Classes

cattrs defaults to having un/structuring hooks separate from the models. With the use class methods strategy, you are free to defy this design decision and configure a converter to look for hooks on the models themselves.

... (truncated)

Changelog

Sourced from cattrs's changelog.

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.
  • Converters can now be initialized with custom fallback hook factories for un/structuring. (#331 #441)
  • 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)
  • Fix TypedDicts with periods in their field names. (#376 #377)
  • Optimize and improve unstructuring of Optional (unions of one type and None). (#380 #381)
  • Fix {py:func}format_exception <cattrs.v.format_exception> and {py:func}transform_error <cattrs.transform_error> type annotations.
  • Improve the implementation of cattrs._compat.is_typeddict. The implementation is now simpler, and relies on fewer private implementation details from typing and typing_extensions. (#384)
  • Improve handling of TypedDicts with forward references.
  • Speed up generated attrs and TypedDict structuring functions by changing their signature slightly. (#388)
  • Fix copying of converters with function hooks. (#398 #399)
  • Broaden {py:func}loads' <cattrs.preconf.orjson.OrjsonConverter.loads> type definition for the preconf orjson converter. (#400)
  • {py:class}AttributeValidationNote <cattrs.AttributeValidationNote> and {py:class}IterableValidationNote <cattrs.IterableValidationNote> are now picklable. (#408)
  • Fix structuring Final lists.

... (truncated)

Commits

Dependabot compatibility score

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 <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [cattrs](https://github.com/python-attrs/cattrs) from 23.1.2 to 23.2.1.
- [Release notes](https://github.com/python-attrs/cattrs/releases)
- [Changelog](https://github.com/python-attrs/cattrs/blob/main/HISTORY.md)
- [Commits](python-attrs/cattrs@v23.1.2...v23.2.1)

---
updated-dependencies:
- dependency-name: cattrs
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added the dependencies Pull requests that update a dependency file label Nov 20, 2023
@charliermarsh
Copy link
Member

@dependabot ignore this dependency

@dependabot dependabot bot closed this Nov 20, 2023
Copy link
Contributor Author

dependabot bot commented on behalf of github Nov 20, 2023

OK, I won't notify you about cattrs again, unless you re-open this PR.

@dependabot dependabot bot deleted the dependabot/pip/cattrs-23.2.1 branch November 20, 2023 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant