Discuss: adding `converter` to `dataclass_transform`

Now that PEP 712: Adding a "converter" parameter to dataclasses.field is dead (long live converters :crown: ) I would like to propose adding them to dataclass_transform’s field_specifiers’ parameters (these bad boys).

Do we even need a PEP? If not, what’s the next step (just this thread)?


I think this wouldn’t need a PEP; it can be done with a change to the spec section you linked, following the process in GitHub - python/typing-council: Decisions by the Python Typing Council.

The main thing we’d need is a concrete proposed change to the spec, so we know exactly what is being proposed. Before we incorporate the change into the spec, ideally there should also be an implementation in at least one type checker.

1 Like

Will do, thanks!

Add support for PEP 712 by debonte · Pull Request #5034 · microsoft/pyright · GitHub h/t @debonte @erictraut

1 Like

Ok here’s the typing council issue: Typing spec update: PEP 712 `converter` in `dataclasses` Field spec params · Issue #33 · python/typing-council · GitHub

Which kinks to the change in spec here: Add PEP 712 converters to the `dataclasses` spec by thejcannon · Pull Request #1783 · python/typing · GitHub

1 Like

The typing council has approved this change.

@thejcannon, there are a few unresolved comments in the PR. Could you please address those? Once they’re resolved, we can formally incorporate the change into the spec.

I will work on augmenting the conformance test to cover this new functionality.

Thanks Josh for driving this effort! And thanks to everyone else who contributed feedback and suggestions along the way.