Add option to selectively disable deprecation warnings by cdce8p · Pull Request #18641 · python/mypy

@cdce8p

@cdce8p

@github-actions

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)

tyralla

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,

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 ","?

Choose a reason for hiding this comment

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

@cdce8p

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.

hauntsaninja

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

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.

@cdce8p cdce8p deleted the deprecated-calls-exclude branch

February 10, 2025 11:03

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