8000 Suggest using `prop-decorator` error code to ignore mypy errors with `@computed_field` by joren485 · Pull Request #11547 · pydantic/pydantic · GitHub
[go: up one dir, main page]

Skip to content

Suggest using prop-decorator error code to ignore mypy errors with @computed_field #11547

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

Merged
merged 1 commit into from
Mar 13, 2025

Conversation

joren485
Copy link
Contributor
@joren485 joren485 commented Mar 13, 2025

Change Summary

For property decorators, # type: ignore[prop-decorator] is the correct type ignore comment in Mypy, # type: ignore[misc] should only be used for backward compatibly.

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

Selected Reviewer: @sydney-runkle

@github-actions github-actions bot added the relnotes-fix Used for bugfixes. label Mar 13, 2025
Copy link
Contributor

Coverage report

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

@joren485
Copy link
Contributor Author

please review

Copy link
codspeed-hq bot commented Mar 13, 2025

CodSpeed Performance Report

Merging #11547 will not alter performance

Comparing joren485:mypy-prop-decorator (e4c76e8) with main (10af6a8)

Summary

✅ 46 untouched benchmarks

Copy link
Member
@Viicos Viicos left a comment

Choose a reason for hiding this comment

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

Thanks, let's not mention the backwards compatible code, users are strongly encouraged to update their type checker version.

@Viicos Viicos added awaiting author response awaiting response from issue opener and removed ready for review labels Mar 13, 2025
@joren485 joren485 force-pushed the mypy-prop-decorator branch from 9e4df6d to e4c76e8 Compare March 13, 2025 19:25
@Viicos Viicos added relnotes-ignore Omit this PR from the release notes. and removed relnotes-fix Used for bugfixes. awaiting author response awaiting response from issue opener labels Mar 13, 2025
@Viicos Viicos changed the title Document the narrowest type ignore comment for property decorators Suggest using prop-decorator error code to ignore mypy errors with @computed_field Mar 13, 2025
@Viicos Viicos merged commit b9fb3f1 into pydantic:main Mar 13, 2025
60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes-ignore Omit this PR from the release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0