Kaynağa Gözat

feat: enable mypy type checker

trgiangdo 1 yıl önce
ebeveyn
işleme
64478fffc5

+ 0 - 1
.github/workflows/partial-tests.yml

@@ -19,7 +19,6 @@ jobs:
           use-isort: false
           use-isort: false
           use-pycodestyle: false
           use-pycodestyle: false
           use-pylint: false
           use-pylint: false
-          use-mypy: false  # TODO: re-enable mypy
           extra-mypy-options: "--ignore-missing-imports --implicit-optional --no-namespace-packages --exclude (taipy/templates/|generate_pyi.py|tools) --follow-imports skip"
           extra-mypy-options: "--ignore-missing-imports --implicit-optional --no-namespace-packages --exclude (taipy/templates/|generate_pyi.py|tools) --follow-imports skip"
 
 
       - uses: chartboost/ruff-action@v1
       - uses: chartboost/ruff-action@v1

+ 16 - 0
.pre-commit-config.yaml

@@ -1,4 +1,20 @@
 repos:
 repos:
+-   repo: https://github.com/pre-commit/mirrors-mypy
+    rev: v1.8.0
+    hooks:
+    -   id: mypy
+        additional_dependencies: [
+                'types-Markdown',
+                'types-python-dateutil',
+                'types-pytz',
+                'types-tzlocal',
+        ]
+        args:
+        - --ignore-missing-imports
+        - --implicit-optional
+        - --no-namespace-packages
+        - --exclude=(taipy/templates/|generate_pyi.py|tools)
+        - --follow-imports=skip
 -   repo: https://github.com/Lucas-C/pre-commit-hooks
 -   repo: https://github.com/Lucas-C/pre-commit-hooks
     rev: v1.1.10
     rev: v1.1.10
     hooks:
     hooks:

+ 7 - 0
pyproject.toml

@@ -51,6 +51,13 @@ max-complexity = 18
 [tool.ruff.lint.pydocstyle]
 [tool.ruff.lint.pydocstyle]
 convention = "google"
 convention = "google"
 
 
+[tool.mypy]
+ignore_missing_imports = true
+implicit_optional = true
+namespace_packages = false
+exclude = "(taipy/templates/|generate_pyi.py|tools)"
+follow_imports = "skip"
+
 [tool.pyright]
 [tool.pyright]
 
 
 [tool.codespell]
 [tool.codespell]