Skip to content

Commit

Permalink
PEP 681: Address Steering Council feedback (#2555)
Browse files Browse the repository at this point in the history
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
  • Loading branch information
4 people authored Apr 25, 2022
1 parent 4233ef7 commit d40ca16
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions pep-0681.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ sync will make it easier for dataclass users to understand and use
``dataclass_transform`` and will simplify the maintenance of dataclass
support in type checkers.

Additionally, we will consider adding ``dataclass_transform`` support
in the future for features that have been adopted by multiple
third-party libraries but are not supported by dataclasses.


Specification
=============
Expand Down Expand Up @@ -607,10 +611,7 @@ annotations but with no assignment should be treated as data fields.

We considered supporting ``auto_attribs`` and a corresponding
``auto_attribs_default`` parameter, but decided against this because it
is specific to attrs and appears to be a legacy behavior. Instead of
supporting this in the new standard, we recommend that the maintainers
of attrs move away from the legacy semantics and adopt
``auto_attribs`` behaviors by default.
is specific to attrs.

Django does not support declaring fields using type annotations only,
so Django users who leverage ``dataclass_transform`` should be aware
Expand All @@ -621,8 +622,8 @@ that they should always supply assigned values.

The attrs library supports a bool parameter ``cmp`` that is equivalent
to setting both ``eq`` and ``order`` to True. We chose not to support
a ``cmp`` parameter, since it only applies to attrs. Attrs users
should use the dataclass-standard ``eq`` and ``order`` parameter names
a ``cmp`` parameter, since it only applies to attrs. Users can emulate
the ``cmp`` behaviour by using the ``eq`` and ``order`` parameter names
instead.

Automatic field name aliasing
Expand Down Expand Up @@ -682,9 +683,9 @@ Class-wide default values
-------------------------

SQLAlchemy requested that we expose a way to specify that the default
value of all fields in the transformed class is None. It is typical
that all of their fields are optional, and None indicates that the
field is not set.
value of all fields in the transformed class is ``None``. It is typical
that all SQLAlchemy fields are optional, and ``None`` indicates that
the field is not set.

We chose not to support this feature, since it is specific to
SQLAlchemy. Users can manually set ``default=None`` on these fields
Expand Down Expand Up @@ -729,9 +730,6 @@ solution would be to add support for a ``converter`` field specifier
parameter but then use the ``Any`` type for the corresponding
parameter in the ``__init__`` method.

We chose not to support this feature and recommend that attrs users
avoid converters.


References
==========
Expand Down

0 comments on commit d40ca16

Please sign in to comment.