KEMBAR78
Correct docs, logic for `model_construct` behavior with `extra` by sydney-runkle · Pull Request #8807 · pydantic/pydantic · GitHub
Skip to content

Conversation

@sydney-runkle
Copy link
Contributor

@sydney-runkle sydney-runkle commented Feb 13, 2024

Fix #8266

  1. Correct + expand on docs re model_construct behavior based on a model's extra setting
  2. Correct behavior in the case of model_config.extra == 'ignore'

Selected Reviewer: @adriangb

@sydney-runkle sydney-runkle added the relnotes-change Used for changes to existing functionality which don't have a better categorization. label Feb 13, 2024
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 13, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: b195e7d
Status: ✅  Deploy successful!
Preview URL: https://ad0bef4f.pydantic-docs2.pages.dev
Branch Preview URL: https://fix-model-construct-doc.pydantic-docs2.pages.dev

View logs

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 13, 2024

CodSpeed Performance Report

Merging #8807 will not alter performance

Comparing fix-model-construct-doc (b195e7d) with main (071c2c8)

Summary

✅ 10 untouched benchmarks

@sydney-runkle
Copy link
Contributor Author

Please review

Copy link
Member

@adriangb adriangb left a comment

Choose a reason for hiding this comment

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

This makes sense, but like you say it is technically a breaking change. Is there a strong justification to make this change?

@sydney-runkle
Copy link
Contributor Author

This makes sense, but like you say it is technically a breaking change. Is there a strong justification to make this change?

I think it's a minor enough breaking change that we can include it in a minor release, and I'd rather have strong documentation + correct behavior sooner rather than later. The sooner we fix this, the fewer people a change would impact down the line. But other than one person reporting the inconsistency in the docs / behavior, there's no strong justification.

@adriangb
Copy link
Member

I think the fact that the runtime behavior is different than the documented behavior is a good start to justify the change.

@sydney-runkle sydney-runkle merged commit e99bf8a into main Feb 14, 2024
@sydney-runkle sydney-runkle deleted the fix-model-construct-doc branch February 14, 2024 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review relnotes-change Used for changes to existing functionality which don't have a better categorization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected inconsistent behaviour when using 'model_construct'

2 participants