Skip to content

Commit

Permalink
adding note to developer documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
luk-f-a committed Jul 17, 2020
1 parent 2619721 commit 321feaf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/source/developer/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,20 @@ and then running::
from the root of the Numba repository. Now ``flake8`` will be run each time
you commit changes. You can skip this check with ``git commit --no-verify``.

Numba has started the process of using `type hints <https://www.python.org/dev/peps/pep-0484/>`_ in its code base. This
will be a gradual process of extending the number of files that use type hints, as well as going from voluntary to
mandatory type hints for new features. `Mypy <http://mypy-lang.org/>`_ is used for automated static checking.

At the moment, only certain files are checked by mypy. The list can be found in ``mypy.ini``. When making changes to
those files, it is necessary to add the required type hints such that mypy tests will pass. Only in exceptional
circumstances should ``type: ignore`` comments be used.

If you are contributing a new feature, we encourage you to use type hints, even if the file is not currently in the
checklist. If you want to contribute type hints to enable a new file to be in the checklist, please add the file to the
``files`` variable in ``mypy.ini``, and decide what level of compliance you are targetting. Level 3 is basic static
checks, while levels 2 and 1 represent stricter checking. The levels are described in details in ``mypy.ini``.


Stability
'''''''''

Expand Down
1 change: 1 addition & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ show_error_context = True
files = **/numba/core/types/*.py, **/numba/core/datamodel/*.py, **/numba/core/rewrites/*.py, **/numba/core/unsafe/*.py

# Per-module options:
# To classify a given module as Level 1, 2 or 3 it must be added both in files (variable above) and in the lists below.
# Level 1 - modules checked on the strictest settings.
;[mypy-]
;warn_return_any = True
Expand Down

0 comments on commit 321feaf

Please sign in to comment.