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

Bundle misc/proper_plugin.py as a part of mypy #16036

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions docs/source/extending_mypy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
9 changes: 9 additions & 0 deletions misc/proper_plugin.py → mypy/plugins/proper_plugin.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion mypy_self_check.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down