Skip to content

Commit

Permalink
Collapse multiple tool.mypy.overrides into a single section
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-ballarin committed Dec 5, 2023
1 parent 9944a3a commit 69d7ae1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 54 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down
61 changes: 16 additions & 45 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 69d7ae1

Please sign in to comment.