diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 30dac07..0ea8faf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,15 +86,17 @@ jobs: git config --global --add safe.directory $PWD git clean -xdf - name: Update mypy configuration - if: startsWith(matrix.backend, 'none') == true - run: | - sed -i 's@\[tool\.mypy\]@[tool.mypy]\nexclude = "(^rbnicsx/backends|^tests/unit/backends)"@g' pyproject.toml - echo "[[tool.mypy.overrides]]" >> pyproject.toml - echo 'module = "dolfinx"' >> pyproject.toml - echo "ignore_missing_imports = true" >> pyproject.toml - echo "[[tool.mypy.overrides]]" >> pyproject.toml - echo 'module = "dolfinx.*"' >> pyproject.toml - echo "ignore_missing_imports = true" >> pyproject.toml + run: | + if [[ "${{ matrix.backend }}" == "dolfinx-"* ]]; then + : + elif [[ "${{ matrix.backend }}" == "none-"* ]]; then + sed -i 's@\[tool\.mypy\]@[tool.mypy]\nexclude = "(^rbnicsx/backends|^tests/unit/backends)"@g' pyproject.toml + sed -i 's@ # "dolfinx",@ "dolfinx",@g' pyproject.toml + sed -i 's@ # "dolfinx.*",@ "dolfinx.*",@g' pyproject.toml + else + echo "Invalid backend" + exit 1 + fi - name: Run ruff on python files run: | python3 -m ruff . diff --git a/pyproject.toml b/pyproject.toml index d9383d2..0e32993 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -103,51 +103,22 @@ warn_return_any = true warn_unused_ignores = true [[tool.mypy.overrides]] -module = "gmsh" -ignore_missing_imports = true - -[[tool.mypy.overrides]] -module = "ipyparallel" -ignore_missing_imports = true - -[[tool.mypy.overrides]] -module = "petsc4py" -ignore_missing_imports = true - -[[tool.mypy.overrides]] -module = "petsc4py.PETSc" -ignore_missing_imports = true - -[[tool.mypy.overrides]] -module = "plotly" -ignore_missing_imports = true - -[[tool.mypy.overrides]] -module = "plotly.*" -ignore_missing_imports = true - -[[tool.mypy.overrides]] -module = "plum" -ignore_missing_imports = true - -[[tool.mypy.overrides]] -module = "scipy" -ignore_missing_imports = true - -[[tool.mypy.overrides]] -module = "scipy.*" -ignore_missing_imports = true - -[[tool.mypy.overrides]] -module = "slepc4py" -ignore_missing_imports = true - -[[tool.mypy.overrides]] -module = "slepc4py.SLEPc" -ignore_missing_imports = true - -[[tool.mypy.overrides]] -module = "ufl" +module = [ + # "dolfinx", + # "dolfinx.*", + "gmsh", + "ipyparallel", + "petsc4py", + "petsc4py.PETSc", + "plotly", + "plotly.*", + "plum", + "scipy", + "scipy.*", + "slepc4py", + "slepc4py.SLEPc", + "ufl" +] ignore_missing_imports = true [tool.ruff]