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

Support initializing root model fields with values of theroot type in the mypy plugin#11212

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 1 commit intomainfromroot-model-plugin
Jan 8, 2025

Conversation

Viicos
Copy link
Member

Also use theTypeInfo.has_base method instead of iterating over the MRO in various places.

Closes#11203.

Change Summary

Related issue number

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

… in the mypy pluginAlso use the `TypeInfo.has_base` method instead of iterating over the MROin various places.
@github-actionsgithub-actionsbot added the relnotes-fixUsed for bugfixes. labelJan 3, 2025
@cloudflare-workers-and-pagesCloudflare Workers and Pages

Deploying pydantic-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit:9dd8b0a
Status: ✅  Deploy successful!
Preview URL:https://37172f3c.pydantic-docs.pages.dev
Branch Preview URL:https://root-model-plugin.pydantic-docs.pages.dev

View logs

@codspeed-hqCodSpeed HQ
Copy link

CodSpeed Performance Report

Merging#11212 willnot alter performance

Comparingroot-model-plugin (9dd8b0a) withmain (aa85c3a)

Summary

✅ 46 untouched benchmarks

@github-actionsGitHub Actions
Copy link
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic
  mypy.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.

This LGTM overall (thanks for adding the tests, those made the impact here quite clear), but let's have@dmontagu take a look as well given his familiarity with themypy plugin.

@ViicosViicos merged commitbfeca9b intomainJan 8, 2025
62 checks passed
@ViicosViicos deleted the root-model-plugin branchJanuary 8, 2025 16:02
@antoniogamizdelgado

Hello! We have started noticing these errors:

monolith/records2/company_definition/domain/badger_object/fields/field_error.py:26: error: Item "str" of "FieldName | str" has no attribute "root"  [union-attr]

Can this change be the cause of these new error? It was working fine last week.

@antoniogamizdelgado

Indeed, rolling back to 2.10.6 and this problem does not appear. So I guess this has pretty much broken our mypy checks :(

@Viicos
Copy link
MemberAuthor

@antoniogamizdelgado please open a new issue with a MRE.

@antoniogamizdelgado

@Viicos done (#11657)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dmontagudmontagudmontagu approved these changes

@sydney-runklesydney-runklesydney-runkle approved these changes

Assignees
No one assigned
Labels
relnotes-fixUsed for bugfixes.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Enable mypy plugin to support initializing RootModel fields with values of the generic's type wheninit_typed=True
4 participants
@Viicos@antoniogamizdelgado@dmontagu@sydney-runkle

[8]ページ先頭

©2009-2025 Movatter.jp