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

Make__signature__ a lazy property, do not deepcopy defaults#10818

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
Viicos merged 3 commits intomainfrommodel-signature
Nov 13, 2024

Conversation

Viicos
Copy link
Member

@ViicosViicos commentedNov 11, 2024
edited by sydney-runkle
Loading

Also follow stdlib dataclasses for signature parameter defaults. If a default factory is used, the placeholder'<factory>' is used.

Related issue number

Fixes#10771,#10656

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable
  • My PR is ready to review,please add a comment including the phrase "please review" to assign reviewers

Also follow stdlib dataclasses for signature parameter defaults.If a default factory is used, the placeholder `'<factory>'` isused.
@github-actionsgithub-actionsbot added the relnotes-fixUsed for bugfixes. labelNov 11, 2024
@cloudflare-workers-and-pagesCloudflare Workers and Pages
Copy link

cloudflare-workers-and-pagesbot commentedNov 11, 2024
edited
Loading

Deploying pydantic-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit:fda5e91
Status: ✅  Deploy successful!
Preview URL:https://232345cd.pydantic-docs.pages.dev
Branch Preview URL:https://model-signature.pydantic-docs.pages.dev

View logs

@codspeed-hqCodSpeed HQ
Copy link

codspeed-hqbot commentedNov 11, 2024
edited
Loading

CodSpeed Performance Report

Merging#10818 willimprove performances by 11.23%

Comparingmodel-signature (fda5e91) withmain (8bad227)

Summary

⚡ 9 improvements
✅ 35 untouched benchmarks

Benchmarks breakdown

Benchmarkmainmodel-signatureChange
test_model_validators_serializers1.1 ms1.1 ms+5.76%
test_nested_model_schema_generation1.4 ms1.4 ms+7.13%
test_recursive_model_schema_generation1.4 ms1.3 ms+7.45%
test_simple_model_schema_generation1,042.9 µs938.1 µs+11.17%
test_tagged_union_with_callable_discriminator_schema_generation2.1 ms2 ms+5.22%
test_tagged_union_with_str_discriminator_schema_generation2 ms1.9 ms+5.47%
test_deeply_nested_recursive_model_schema_generation1.7 ms1.6 ms+5.72%
test_generic_recursive_model_schema_generation1.2 ms1.1 ms+9.03%
test_simple_recursive_model_schema_generation1,003 µs901.8 µs+11.23%

Copy link
Contributor

@sydney-runklesydney-runkle left a comment

Choose a reason for hiding this comment

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

This is promising - are there more class attributes for which we could do this? Gives us a nice boost on schema builds :)

@sydney-runklesydney-runkle added awaiting author responseawaiting response from issue opener awaiting author revisionawaiting changes from the PR author and removed awaiting author responseawaiting response from issue opener labelsNov 11, 2024
@github-actionsGitHub Actions
Copy link
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic/_internal
  _model_construction.py
  _signature.py
  _utils.py
Project Total 

This report was generated bypython-coverage-comment-action

Copy link
Contributor

@sydney-runklesydney-runkle left a comment

Choose a reason for hiding this comment

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

Very impressed with this implementation, good find.

Feel free to merge at your leisure.

@ViicosViicos merged commit2899ca8 intomainNov 13, 2024
54 checks passed
@ViicosViicos deleted the model-signature branchNovember 13, 2024 10:26
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@sydney-runklesydney-runklesydney-runkle approved these changes

Assignees
No one assigned
Labels
awaiting author revisionawaiting changes from the PR authorrelnotes-fixUsed for bugfixes.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Default value can fail to be deepcopied during model signature generation
2 participants
@Viicos@sydney-runkle

[8]ページ先頭

©2009-2025 Movatter.jp