Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds dataclass_transform to dataclass #4007

Merged
merged 3 commits into from May 18, 2022

Conversation

giuliano-macedo
Copy link
Contributor

@giuliano-macedo giuliano-macedo commented Apr 24, 2022

Change Summary

This PR continues #2721 by adding __dataclass_transform__ decorator to the pydantic dataclass decorator so that pyright can infer the __init__ method as well as the instance attributes and types.

For more info about this decorator make sure to check out #2721.

Related issue number

Fixes #4006

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes where applicable
  • changes/<pull request or issue id>-<github username>.md file added describing change
    (see changes/README.md for details)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

@giuliano-macedo
Copy link
Contributor Author

giuliano-macedo commented Apr 24, 2022

@samuelcolvin make docs aren't working in the current master branch, it seems the last two commits (b25e22f, 8997cc5) made it stopped working, don't know what to do here...

@samuelcolvin
Copy link
Member

I'll look soon, might be after pycon though.

@giuliano-macedo
Copy link
Contributor Author

please review

Copy link

@abelroes abelroes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@samuelcolvin
Copy link
Member

this needs to be rebased from msater to fix CI.

@samuelcolvin samuelcolvin added this to the v1.9.1 milestone May 15, 2022
@samuelcolvin samuelcolvin mentioned this pull request May 15, 2022
11 tasks
@samuelcolvin samuelcolvin merged commit 5a61292 into pydantic:master May 18, 2022
ntaylorwss pushed a commit to nicejobinc/pydantic that referenced this pull request Jun 24, 2022
* ✨ Adds dataclass_transform to dataclasses

* ✨ Adds dataclass_transform to dataclasses

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request] [VS Code] No auto complete when using pydantic.dataclasses.dataclass
4 participants