Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.3k
Supportdefer_build for Pydantic dataclasses#10313
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Also return early if `defer_build` is set for Pydantic models.
cloudflare-workers-and-pagesbot commentedSep 5, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Deploying pydantic-docs with |
| Latest commit: | 7ae6da8 |
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c4413a6e.pydantic-docs.pages.dev |
| Branch Preview URL: | https://dc-defer-build.pydantic-docs.pages.dev |
codspeed-hqbot commentedSep 5, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
CodSpeed Performance ReportMerging#10313 willnot alter performanceComparing Summary
|
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
github-actionsbot commentedSep 5, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Coverage reportClick to see where and how coverage changed
This report was generated bypython-coverage-comment-action | ||||||||||||||||||||||||||||||||||||||||||
sydney-runkle left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Looks great, left one comment re the_force_build argument - would like to avoid that if possible.
I've submitted#10329, which we can probably merge + rebase with to make this PR just a bit more simple.
Uh oh!
There was an error while loading.Please reload this page.
Viicos commentedSep 18, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
So the reason why the added
So that the following works as expected: @pydantic_dataclass(config={'strict':True})classDC:a:intassertDC.__pydantic_config__== {'strict':True} If in pydantic/pydantic/dataclasses.py Lines 338 to 345 inc2a325b
The following will happen: @pydantic_dataclassclassDC:__pydantic_config__= {'defer_build':True}# or as a decorator parameter, doesn't matterassertDC.__pydantic_config__== {'defer_build':True}rebuild_dataclass(DC)assertDC.__pydantic_config__== {'defer_build':True}# AssertionError, `'defer_build'` is now set to `False` And is inconsistent with the |
sydney-runkle commentedSep 18, 2024
I see, makes sense. Let's revert back then to use the |
sydney-runkle left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Nice work!
defer_build for Pydantic dataclassesdefer_build for Pydantic dataclasses
Also return early if
defer_buildis set for Pydantic models.Change Summary
Related issue number
Checklist