Remove mypy from pre-commit hooks
As of now, pre-commit hooks are not used by developers.
I see 2 reasons for dropping mypy hooks at this point:

mypy command line use setup.cfg as configuration file. It is fine when used alone to get configuration and list of files. But when running with pre-commit, pre-commit add at files in the command line, which overrides the list of files with provided configuration. So when running, pre-commit run --all-files mypy runs on all python files (not the one given in setup.cfg). Since in general, you may want to add pre-commit checks in your CI to enforce pre-commit usage, it will dramatically fail with the following errors:


mypy.....................................................................Failed

hook id: mypy
exit code: 1

docs/source/conf.py:28: error: Module has no attribute "LIGHTNING_SETUP"  [attr-defined]
docs/source/conf.py:277: error: Function is missing a type annotation  [no-untyped-def]
docs/source/conf.py:295: error: Function is missing a type annotation  [no-untyped-def]
setup.py:24: error: Name 'builtins' already defined (by an import)  [no-redef]
setup.py:29: error: Module has no attribute "LIGHTNING_SETUP"  [attr-defined]
tests/models/data/horovod/train_default_model.py:25: error: Item "None" of "Optional[str]" has no attribute "split"  [union-attr]
tests/models/data/horovod/train_default_model.py:46: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:36: error: Function is missing a type annotation for one or more arguments  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:52: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:64: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:74: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:110: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:123: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:126: error: Function is missing a return type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:133: error: Function is missing a return type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:133: note: Use "-> None" if function does not return a value
tests/trainer/logging/test_logger_connector.py:139: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:160: error: Function is missing a return type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:168: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:205: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:216: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:226: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:230: error: Function is missing a return type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:230: note: Use "-> None" if function does not return a value
tests/trainer/logging/test_logger_connector.py:234: error: Function is missing a return type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:271: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:373: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:379: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:384: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:388: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:392: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:397: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:401: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:406: error: Function is missing a type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:410: error: Function is missing a return type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:413: error: Function is missing a return type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:416: error: Function is missing a return type annotation  [no-untyped-def]
tests/trainer/logging/test_logger_connector.py:433: error: Function is missing a type annotation  [no-untyped-def]
Found 36 errors in 4 files (checked 372 source files)


In my humble opinion, you want to keep git pre-commit hooks light. Formatting, removing trailing spaces, sorting import are definitively OK, but running static analysis, unit tests can last long and can discourage people from contributing to the projects. It is rather a blocking experience rather than helping one. So I would recommend removing mypy hooks from pre-commit but makes sure it is part of the script to be used before a submission or executed by the CI.

What do you think?