diff --git a/.github/workflows/code-format.yml b/.github/workflows/code-format.yml index 7a34da2561..2eee8ea489 100644 --- a/.github/workflows/code-format.yml +++ b/.github/workflows/code-format.yml @@ -38,3 +38,18 @@ jobs: - name: isort run: | isort . --check --diff + + typing-check-mypy: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@master + - uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install mypy + run: | + pip install mypy + pip list + - name: mypy + run: | + mypy diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62224b800d..15b0f8b175 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,4 +2,8 @@ repos: - repo: https://github.com/pycqa/isort rev: 5.5.2 hooks: - - id: isort \ No newline at end of file + - id: isort + + - repo: https://github.com/pre-commit/mirrors-mypy + hooks: + - id: mypy diff --git a/setup.cfg b/setup.cfg index 178e0e91f5..7e5b819628 100644 --- a/setup.cfg +++ b/setup.cfg @@ -61,3 +61,65 @@ license_file = LICENSE description-file = README.md # long_description = file:README.md # long_description_content_type = text/markdown + +[mypy] +# Typing tests is low priority, but enabling type checking on the +# untyped test functions (using `--check-untyped-defs`) is still +# high-value because it helps test the typing. +files = pl_bolts, tests +disallow_untyped_defs = True +ignore_missing_imports = True + +[mypy-pl_bolts.*] +ignore_errors = True + +[mypy-pl_bolts.callbacks.*] +ignore_errors = True + +[mypy-pl_bolts.datamodules.*] +ignore_errors = True + +[mypy-pl_bolts.datasets.*] +ignore_errors = True + +[mypy-pl_bolts.losses.*] +ignore_errors = True + +[mypy-pl_bolts.metrics.*] +ignore_errors = True + +[mypy-pl_bolts.models.*] +ignore_errors = True + +[mypy-pl_bolts.models.autoencoders.*] +ignore_errors = True + +[mypy-pl_bolts.models.detection.*] +ignore_errors = True + +[mypy-pl_bolts.models.gans.*] +ignore_errors = True + +[mypy-pl_bolts.models.regression.*] +ignore_errors = True + +[mypy-pl_bolts.models.rl.*] +ignore_errors = True + +[mypy-pl_bolts.models.self_supervised.*] +ignore_errors = True + +[mypy-pl_bolts.models.vision.*] +ignore_errors = True + +[mypy-pl_bolts.optimizers.*] +ignore_errors = True + +[mypy-pl_bolts.transforms.*] +ignore_errors = True + +[mypy-pl_bolts.utils.*] +ignore_errors = True + +[mypy-tests.*] +ignore_errors = True