-
Notifications
You must be signed in to change notification settings - Fork 116
Open
Labels
dataclassesIssues relating to dataclasses and dataclass_transformIssues relating to dataclasses and dataclass_transform
Milestone
Description
We already have initial support for dataclasses, but some more advanced features are still missing. The following list is most probably not complete:
- Make sure that
dataclass
can be used as a non-decorator:class C: …; C = dataclass(C)
. See empty test here. - Emit an error if >=2 variables in a dataclass class body are annotated with
KW_ONLY
(failing test here) - Support for
dataclasses.KW_ONLY
- Support for
Final[…]
fields andClassVar[Final[…]]
fields. - Improve support for frozen dataclasses to handle subclasses of frozen dataclasses also
- Support for
dataclasses.InitVar
[ty] Supportdataclasses.InitVar
ruff#19527 - Support for dataclass
field
s - Add support for other synthesized functions / arguments
- unsafe_hash
- match_args
- kw_only
- slots: [ty] initial support for
slots=True
in dataclasses ruff#20278 - weakref_slot
- The synthesized
__replace__
method on Python 3.13+ [ty] synthesize__replace__
for dataclasses (>=3.13) ruff#19545
- Emit diagnostic when defining a field without a default after a field with a default, see existing TODO: [ty] diagnostic for dataclass field order ruff#19825
- Emit diagnostic when setting
order=True
on a dataclass that has a custom__lt__
(or similar), see existing TODO - Verify signature of methods such as
__post_init__
, see this comment - Emit diagnostic if
frozen=True
but the class has a custom__setattr__
or__delattr__
method in the class body (this raisesTypeError
at runtime) - Add support for
dataclasses.field(kw_only=True)
AlexWaygood, carljm, henryiii, ROCKTAKEY, rosborn and 10 more
Metadata
Metadata
Assignees
Labels
dataclassesIssues relating to dataclasses and dataclass_transformIssues relating to dataclasses and dataclass_transform