diff --git a/MANIFEST.in b/MANIFEST.in index b77b762b48529..a1c15446de3fa 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -34,7 +34,6 @@ include build-requirements.txt include test-requirements.txt include mypy_self_check.ini prune misc -include misc/proper_plugin.py graft test-data include conftest.py include runtests.py diff --git a/docs/source/extending_mypy.rst b/docs/source/extending_mypy.rst index 506f548db687e..bbbec2ad3880d 100644 --- a/docs/source/extending_mypy.rst +++ b/docs/source/extending_mypy.rst @@ -237,3 +237,12 @@ mypy's cache for that module so that it can be rechecked. This hook should be used to report to mypy any relevant configuration data, so that mypy knows to recheck the module if the configuration changes. The hooks should return data encodable as JSON. + +Useful tools +************ + +Mypy ships ``mypy.plugins.proper_plugin`` plugin which can be useful +for plugin authors, since it finds missing ``get_proper_type()`` calls, +which is a pretty common mistake. + +It is recommended to enable it is a part of your plugin's CI. diff --git a/misc/proper_plugin.py b/mypy/plugins/proper_plugin.py similarity index 95% rename from misc/proper_plugin.py rename to mypy/plugins/proper_plugin.py index a6e6dc03b6256..ab93f0d126db0 100644 --- a/misc/proper_plugin.py +++ b/mypy/plugins/proper_plugin.py @@ -1,3 +1,12 @@ +""" +This plugin is helpful for mypy development itself. +By default, it is not enabled for mypy users. + +It also can be used by plugin developers as a part of their CI checks. + +It finds missing ``get_proper_type()`` call, which can lead to multiple errors. +""" + from __future__ import annotations from typing import Callable diff --git a/mypy_self_check.ini b/mypy_self_check.ini index fcdbe641d6d6f..6e1ad8187b7a7 100644 --- a/mypy_self_check.ini +++ b/mypy_self_check.ini @@ -5,7 +5,7 @@ disallow_any_unimported = True show_traceback = True pretty = True always_false = MYPYC -plugins = misc/proper_plugin.py +plugins = mypy.plugins.proper_plugin python_version = 3.8 exclude = mypy/typeshed/|mypyc/test-data/|mypyc/lib-rt/ new_type_inference = True