Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

MoveMapping schema gen toGenerateSchema to complete removal ofprepare_annotations_for_known_type workaround#11247

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

Merged
sydney-runkle merged 6 commits intomainfromfinal-removal-of-prep-ann
Jan 10, 2025

Conversation

sydney-runkle
Copy link
Contributor

@sydney-runklesydney-runkle commentedJan 9, 2025
edited
Loading

Following up on removing_std_types_schema.py and removing prepare annotations logic to increase consistency of annotation application patterns across the codebase.

Specifically, the third and last in the series of#10846 and#11239.

Seeing marginal perf improvements inGenerateSchema._prepare_annotations, which is what we were hoping for:https://codspeed.io/pydantic/pydantic/branches/final-removal-of-prep-ann

I've attempted to keep the structure of the core schema gen + validators close to that of the original. I think this could be refactored, but I'd rather do that in a different PR, and have this just focus on movement of the logic.

@github-actionsgithub-actionsbot added the relnotes-fixUsed for bugfixes. labelJan 9, 2025
@sydney-runklesydney-runkle added relnotes-changeUsed for changes to existing functionality which don't have a better categorization. refactormodification of internal structures / patterns relnotes-performanceUsed for performance improvements. and removed relnotes-fixUsed for bugfixes. labelsJan 9, 2025
@cloudflare-workers-and-pagesCloudflare Workers and Pages
Copy link

cloudflare-workers-and-pagesbot commentedJan 9, 2025
edited
Loading

Deploying pydantic-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit:2b3bd7b
Status: ✅  Deploy successful!
Preview URL:https://5ba55455.pydantic-docs.pages.dev
Branch Preview URL:https://final-removal-of-prep-ann.pydantic-docs.pages.dev

View logs

@codspeed-hqCodSpeed HQ
Copy link

codspeed-hqbot commentedJan 9, 2025
edited
Loading

CodSpeed Performance Report

Merging#11247 willnot alter performance

Comparingfinal-removal-of-prep-ann (2b3bd7b) withmain (4e055d5)

Summary

✅ 46 untouched benchmarks

@sydney-runkle
Copy link
ContributorAuthor

I feel like test_nested_model_serialization might be flaky, this PR should be unrelated...

@sydney-runklesydney-runkle changed the titleDraft: moveMapping schema gen toGenerateSchemaMoveMapping schema gen toGenerateSchema to complete removal ofprepare_annotations_for_known_type workaroundJan 10, 2025
@github-actionsGitHub Actions
Copy link
Contributor

github-actionsbot commentedJan 10, 2025
edited
Loading

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic/_internal
  _generate_schema.py1031
  _validators.py457
Project Total 

This report was generated bypython-coverage-comment-action

Comment on lines -1090 to -1094
res = self._get_prepare_pydantic_annotations_for_known_type(obj, ())
if res is not None:
source_type, annotations = res
return self._apply_annotations(source_type, annotations)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yay! This is what we've been trying to remove for a long time :)


# Assume Annotated[..., Field(...)]
if _typing_extra.is_annotated(values_source_type):
# Important that we use typing_extensions.get_args here in order to support 3.8
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# Important that we use typing_extensions.get_args here in order to support 3.8

Or in the PR droping 3.8, as you wish

sydney-runkle reacted with thumbs up emoji
@sydney-runklesydney-runkle merged commitaac7a53 intomainJan 10, 2025
60 checks passed
@sydney-runklesydney-runkle deleted the final-removal-of-prep-ann branchJanuary 10, 2025 17:39
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ViicosViicosViicos approved these changes

Assignees
No one assigned
Labels
refactormodification of internal structures / patternsrelnotes-changeUsed for changes to existing functionality which don't have a better categorization.relnotes-performanceUsed for performance improvements.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@sydney-runkle@Viicos

[8]ページ先頭

©2009-2025 Movatter.jp