diff options
author | Bas van Beek <b.f.van.beek@vu.nl> | 2021-06-22 09:21:50 +0200 |
---|---|---|
committer | Bas van Beek <b.f.van.beek@vu.nl> | 2021-06-22 11:29:35 +0200 |
commit | fbe39c404c194f2ea4283bfba2a786ac01cedf03 (patch) | |
tree | b90187ab7eac7e15793b6a5d69e1e560f622c1f8 /numpy/typing/mypy_plugin.py | |
parent | 80b387c66e4f10faafdb1a21c011c173f77b0942 (diff) | |
download | numpy-fbe39c404c194f2ea4283bfba2a786ac01cedf03.tar.gz |
DOC: Move the `mypy`-plugin docs to its respective module
Diffstat (limited to 'numpy/typing/mypy_plugin.py')
-rw-r--r-- | numpy/typing/mypy_plugin.py | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/numpy/typing/mypy_plugin.py b/numpy/typing/mypy_plugin.py index 74dcd7a85..d698673fc 100644 --- a/numpy/typing/mypy_plugin.py +++ b/numpy/typing/mypy_plugin.py @@ -1,4 +1,34 @@ -"""A module containing `numpy`-specific plugins for mypy.""" +"""A mypy_ plugin for managing a number of platform-specific annotations. +Its functionality can be split into three distinct parts: + +* Assigning the (platform-dependent) precisions of certain `~numpy.number` + subclasses, including the likes of `~numpy.int_`, `~numpy.intp` and + `~numpy.longlong`. See the documentation on + :ref:`scalar types <arrays.scalars.built-in>` for a comprehensive overview + of the affected classes. Without the plugin the precision of all relevant + classes will be inferred as `~typing.Any`. +* Removing all extended-precision `~numpy.number` subclasses that are + unavailable for the platform in question. Most notably this includes the + likes of `~numpy.float128` and `~numpy.complex256`. Without the plugin *all* + extended-precision types will, as far as mypy is concerned, be available + to all platforms. +* Assigning the (platform-dependent) precision of `~numpy.ctypeslib.c_intp`. + Without the plugin aforementioned type will default to `ctypes.c_int64`. + + +Examples +-------- +To enable the plugin, one must add it to their mypy `configuration file`_: + +.. code-block:: ini + + [mypy] + plugins = numpy.typing.mypy_plugin + +.. _mypy: http://mypy-lang.org/ +.. _configuration file: https://mypy.readthedocs.io/en/stable/config_file.html + +""" from __future__ import annotations |