diff --git a/.github/workflows/tidy3d-python-client-tests.yml b/.github/workflows/tidy3d-python-client-tests.yml index 879f8d6b8e..010e0fb1b6 100644 --- a/.github/workflows/tidy3d-python-client-tests.yml +++ b/.github/workflows/tidy3d-python-client-tests.yml @@ -171,7 +171,33 @@ jobs: run: ruff format --check --diff - name: Run ruff check run: ruff check tidy3d - + + mypy: + name: static-type-checks (mypy) + needs: determine-test-scope + if: needs.determine-test-scope.outputs.code_quality_tests == 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + submodules: false + persist-credentials: false + + - name: set-python-3.10 + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install mypy + run: | + python -m pip install --upgrade pip + pip install "mypy==1.13.0" + + - name: Run mypy + run: | + mypy --config-file=pyproject.toml + zizmor: name: Run zizmor 🌈 runs-on: ubuntu-latest @@ -637,6 +663,7 @@ jobs: - local-tests - remote-tests - lint + - mypy - verify-schema-change - lint-commit-messages - lint-branch-name @@ -656,6 +683,12 @@ jobs: run: | echo "❌ Linting failed." exit 1 + + - name: check-mypy-result + if: ${{ needs.determine-test-scope.outputs.code_quality_tests == 'true' && needs.mypy.result != 'success' }} + run: | + echo "❌ Mypy type checking failed." + exit 1 - name: check-schema-change-verification if: ${{ needs.verify-schema-change.result != 'success' }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fffa49b721..fce5cbc0cc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,6 +29,6 @@ repos: hooks: - id: mypy name: mypy (type signatures) - files: ^tidy3d/web + pass_filenames: false args: - --config-file=pyproject.toml diff --git a/pyproject.toml b/pyproject.toml index 6783ab8382..a66e2aa67e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -317,6 +317,9 @@ python_files = "*.py" [tool.mypy] python_version = "3.10" +files = [ + "tidy3d/web", +] ignore_missing_imports = true follow_imports = "skip" disallow_untyped_defs = true