Skip to content

Commit d40ca16

Browse files
debonteJelleZijlstraAA-TurnerAlexWaygood
authored
PEP 681: Address Steering Council feedback (#2555)
Co-authored-by: Jelle Zijlstra <[email protected]> Co-authored-by: Adam Turner <[email protected]> Co-authored-by: Alex Waygood <[email protected]>
1 parent 4233ef7 commit d40ca16

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

pep-0681.rst

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ sync will make it easier for dataclass users to understand and use
8080
``dataclass_transform`` and will simplify the maintenance of dataclass
8181
support in type checkers.
8282

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

8488
Specification
8589
=============
@@ -607,10 +611,7 @@ annotations but with no assignment should be treated as data fields.
607611

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

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

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

628629
Automatic field name aliasing
@@ -682,9 +683,9 @@ Class-wide default values
682683
-------------------------
683684

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

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

732-
We chose not to support this feature and recommend that attrs users
733-
avoid converters.
734-
735733

736734
References
737735
==========

0 commit comments

Comments
 (0)