1616 Without the plugin the type will default to `ctypes.c_int64`.
1717
1818 .. versionadded:: 1.22
19+ .. deprecated:: 2.3
1920
2021Examples
2122--------
3536
3637import numpy as np
3738
38- __all__ = ()
39+ __all__ : list [ str ] = []
3940
4041
4142def _get_precision_dict () -> dict [str , str ]:
@@ -111,18 +112,15 @@ def _get_c_intp_name() -> str:
111112 from mypy .nodes import MypyFile , ImportFrom , Statement
112113 from mypy .build import PRI_MED
113114
114-
115115 _HookFunc : TypeAlias = Callable [[AnalyzeTypeContext ], mypy .types .Type ]
116116
117-
118117 def _hook (ctx : AnalyzeTypeContext ) -> mypy .types .Type :
119118 """Replace a type-alias with a concrete ``NBitBase`` subclass."""
120119 typ , _ , api = ctx
121120 name = typ .name .split ("." )[- 1 ]
122121 name_new = _PRECISION_DICT [f"{ _MODULE } ._nbit.{ name } " ]
123122 return cast ("TypeAnalyser" , api ).named_type (name_new )
124123
125-
126124 def _index (iterable : Iterable [Statement ], id : str ) -> int :
127125 """Identify the first ``ImportFrom`` instance the specified `id`."""
128126 for i , value in enumerate (iterable ):
@@ -146,7 +144,6 @@ def _override_imports(
146144 i = _index (lst , module )
147145 lst [i ] = import_obj
148146
149-
150147 class _NumpyPlugin (Plugin ):
151148 """A mypy plugin for handling versus numpy-specific typing tasks."""
152149
@@ -186,9 +183,15 @@ def get_additional_deps(
186183 )
187184 return [(PRI_MED , fullname , - 1 )]
188185
189-
190186 def plugin (version : str ) -> type :
191- """An entry-point for mypy."""
187+ import warnings
188+
189+ warnings .warn (
190+ "`numpy.typing.mypy_plugin` is deprecated, and will be removed in "
191+ "a future release." ,
192+ category = DeprecationWarning ,
193+ stacklevel = 3 ,
194+ )
192195 return _NumpyPlugin
193196
194197except ModuleNotFoundError as e :
0 commit comments