Skip to content

On Python 3.11 pydantic's use of dataclass_transform is incorrect #4500

@erictraut

Description

@erictraut

Initial Checks

  • I have searched GitHub for a duplicate issue and I'm sure this is something new
  • I have searched Google & StackOverflow for a solution and couldn't find anything
  • I have read and followed the docs and still think this is a bug
  • I am confident that the issue is with pydantic (not my code, or another library in the ecosystem like FastAPI or mypy)

Description

Pydantic uses PEP 681's dataclass_transform for compatibility with static type checkers. One of the features described in PEP 681 is the ability to describe a set of custom "field specifier" classes. In an early version of PEP 681, these were specified using a parameter named field_descriptors, but based on feedback the parameter name was changed to field_specifiers for the final version of the PEP. Pydantic is still using the (now obsolete) parameter name.

See microsoft/pyright#3912 for details.

Example Code

No response

Python, Pydantic & OS Version

Python 3.11
Pydantic 1.10.2

Affected Components

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug V1Bug related to Pydantic V1.X

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions