-
Notifications
You must be signed in to change notification settings - Fork 135
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
dataclasscan 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.InitVarruff#19527 - Support for dataclass
fields - Add support for other synthesized functions / arguments
- unsafe_hash
- match_args
- kw_only
- slots: [ty] initial support for
slots=Truein 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=Trueon 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=Truebut the class has a custom__setattr__or__delattr__method in the class body (this raisesTypeErrorat 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