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

Revalidate parametrized generics if instance's origin is subclass of OG class #10666

Merged
merged 6 commits into from
Oct 23, 2024

Conversation

sydney-runkle
Copy link
Member

@sydney-runkle sydney-runkle commented Oct 20, 2024

Requires pydantic/pydantic-core#1489

Fixes #9414
Fixes #10359
Fixes #8071

See docs updates for a more thorough explanation of changes - basically, generic validation is in some cases less performant, but at the benefit of being much more intuitive.

Specifically, see the implementation details section here: https://generic-origin-addition.pydantic-docs.pages.dev/concepts/models/#generic-models

@github-actions github-actions bot added the relnotes-fix Used for bugfixes. label Oct 20, 2024
Copy link

cloudflare-workers-and-pages bot commented Oct 20, 2024

Deploying pydantic-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3b54ddb
Status: ✅  Deploy successful!
Preview URL: https://3b849e91.pydantic-docs.pages.dev
Branch Preview URL: https://generic-origin-addition.pydantic-docs.pages.dev

View logs

@sydney-runkle sydney-runkle added the relnotes-change Used for changes to existing functionality which don't have a better categorization. label Oct 20, 2024
tests/test_generics.py Outdated Show resolved Hide resolved
Copy link
Contributor

@dmontagu dmontagu left a comment

Choose a reason for hiding this comment

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

LGTM, I assume it's just failing because it doesn't have the necessary changes in pydantic-core.

Copy link

codspeed-hq bot commented Oct 23, 2024

CodSpeed Performance Report

Merging #10666 will not alter performance

Comparing generic-origin-addition (3b54ddb) with main (27afdfc)

Summary

✅ 44 untouched benchmarks

@sydney-runkle sydney-runkle enabled auto-merge (squash) October 23, 2024 15:42
@sydney-runkle sydney-runkle merged commit f3092b3 into main Oct 23, 2024
60 checks passed
@sydney-runkle sydney-runkle deleted the generic-origin-addition branch October 23, 2024 16:23
Copy link
Contributor

Coverage report

This PR does not seem to contain any modification to coverable code.

jvansanten added a commit to AmpelProject/Ampel-interface that referenced this pull request Nov 22, 2024
Obviated by pydantic/pydantic#10666, which
does the Right Thing with instances of unparameterized generics.
jvansanten added a commit to AmpelProject/Ampel-interface that referenced this pull request Nov 22, 2024
Obviated by pydantic/pydantic#10666, which
does the Right Thing with instances of unparameterized generics.
jvansanten added a commit to AmpelProject/Ampel-interface that referenced this pull request Nov 22, 2024
Obviated by pydantic/pydantic#10666, which
does the Right Thing with instances of unparameterized generics.
jvansanten added a commit to AmpelProject/Ampel-interface that referenced this pull request Nov 22, 2024
Obviated by pydantic/pydantic#10666, which
does the Right Thing with instances of unparameterized generics.
jvansanten added a commit to AmpelProject/Ampel-interface that referenced this pull request Nov 22, 2024
Obviated by pydantic/pydantic#10666, which
does the Right Thing with instances of unparameterized generics.
jvansanten added a commit to AmpelProject/Ampel-interface that referenced this pull request Nov 22, 2024
* chore(deps): update minor updates

* chore: use annotations from pydantic for overrides

IncEx is public as of pydantic 2.10

* fix: remove workarounds for generic validation

Obviated by pydantic/pydantic#10666, which
does the Right Thing with instances of unparameterized generics.

* chore(deps): remove ruff from poetry env

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jakob van Santen <jvansanten@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes-change Used for changes to existing functionality which don't have a better categorization. relnotes-fix Used for bugfixes.
Projects
None yet
2 participants