Skip to content

Add frozen_default parameter on dataclass_transform #99957

Closed
@debonte

Description

@debonte

Feature or enhancement

Add a new frozen_default parameter to dataclass_transform similar to the existing eq_default and order_default parameters.

Pitch

  • Frozen dataclasses are very popular when working with Jax (flax.struct.dataclass and tjax.dataclass), so being able to indicate that they are frozen by default would improve the user experience.
  • dataclass_transform is currently supported by Pyright/Pylance and Pyre. Both teams are in favor of implementing this new parameter. Since dataclass_transform supports kwargs for experimentation/extensibility, Pyright was already able to add support for frozen_default.
  • All feedback on typing-sig has been in favor of this enhancement.

Previous discussion

Discussed in typing-sig.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions