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

Add option to selectively disable deprecation warnings #18641

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

cdce8p
Copy link
Collaborator

@cdce8p cdce8p commented Feb 9, 2025

Suggested in #18192 (comment)

Fixes #18435

@cdce8p cdce8p added the topic-pep-702 PEP 702, @deprecated label Feb 9, 2025
@cdce8p cdce8p requested a review from tyralla February 9, 2025 13:35
Copy link
Contributor

github-actions bot commented Feb 9, 2025

Diff from mypy_primer, showing the effect of this PR on open source code:

django-stubs (https://github.com/typeddjango/django-stubs): 1.44x faster (35.2s -> 24.4s in a single noisy sample)

@cdce8p cdce8p added the topic-configuration Configuration files and flags label Feb 9, 2025
Copy link
Collaborator

@tyralla tyralla left a comment

Choose a reason for hiding this comment

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

Thanks for implementing this! I think it should close #18435. I only left a very minor remark.

Selectively excludes functions and methods defined in specific packages,
modules, and classes from the :ref:`deprecated<code-deprecated>` error code.
This also applies to all submodules of packages (i.e. everything inside
a given prefix). Note, this option does not support per-file configuration,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe end with ";" instead of ","?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Tbh I mostly copied the contents from the untyped_calls_exclude option. So I'd leave it as is. https://mypy.readthedocs.io/en/stable/config_file.html#confval-untyped_calls_exclude

@cdce8p
Copy link
Collaborator Author

cdce8p commented Feb 9, 2025

Thanks for implementing this! I think it should close #18435.

Yeah, added it to the PR description.

Btw. I'm open to suggestion for a better option name. deprecated_calls_exclude works but doesn't sound that good IMO. Although I suspect it's primarily going to be used in config files, so it might not matter much.

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Cool, want to make a changelog entry as well?

@cdce8p
Copy link
Collaborator Author

cdce8p commented Feb 9, 2025

Cool, want to make a changelog entry as well?

Yeah, let's do that in a followup if that's all right. I've a few more topics in mind for already merged PRs. E.g. different property getter / setter types, stubgen decorator improvements, mypyc support for frozenset.

@hauntsaninja hauntsaninja merged commit f74f818 into python:master Feb 10, 2025
19 checks passed
@cdce8p cdce8p deleted the deprecated-calls-exclude branch February 10, 2025 11:03
hauntsaninja pushed a commit that referenced this pull request Feb 11, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Create changelog entries for
- #18510
- #18641
ericmarkmartin pushed a commit to ericmarkmartin/mypy that referenced this pull request Feb 19, 2025
ericmarkmartin pushed a commit to ericmarkmartin/mypy that referenced this pull request Feb 19, 2025
x612skm pushed a commit to x612skm/mypy-dev that referenced this pull request Feb 24, 2025
x612skm pushed a commit to x612skm/mypy-dev that referenced this pull request Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-configuration Configuration files and flags topic-pep-702 PEP 702, @deprecated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support package ignores for deprecated
3 participants