diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 6390ded903..5a2fa36bba 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -64,6 +64,8 @@ concurrency: jobs: test_linux: + # UNDO ME, don't need this for this PR + if: false name: Build and test Firedrake (Linux) strategy: # We want to know all of the tests which fail, so don't kill real if @@ -481,11 +483,15 @@ jobs: - name: Setup flake8 annotations uses: rbialon/flake8-annotations@v1 - name: Install linting packages - run: pip install flake8 pylint + run: pip install flake8 mypy pylint - name: Lint codebase run: make lint GITHUB_ACTIONS_FORMATTING=1 + - name: Run type checks + run: mypy -p firedrake -p pyop2 -p tsfc build_docs: + # UNDO ME + if: false name: Build documentation runs-on: [self-hosted, Linux] container: diff --git a/firedrake/external_operators/abstract_external_operators.py b/firedrake/external_operators/abstract_external_operators.py index 789e1fccb9..61530c1846 100644 --- a/firedrake/external_operators/abstract_external_operators.py +++ b/firedrake/external_operators/abstract_external_operators.py @@ -91,6 +91,7 @@ def __init__(self, *operands, function_space, derivatives=None, argument_slots=( def function_space(self): return self._function_space + @staticmethod def assemble_method(derivs, args): """Decorator helper function to specify the type of external operator type associated with each assembly methods. diff --git a/pyproject.toml b/pyproject.toml index b6e7a4acc7..2b6d9b9450 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -169,3 +169,24 @@ pyop2 = [ "*.pyx", "codegen/c/*.c", ] + +[tool.mypy] +# from https://quantlane.com/blog/type-checking-large-codebase/ + +# TODO: enable at some point +# disallow_untyped_calls = true +# disallow_untyped_defs = true +# disallow_incomplete_defs = true +# disallow_untyped_decorators = true +# check_untyped_defs = true + +# warn_redundant_casts = true +# warn_unused_ignores = true +# warn_unused_configs = true +# show_error_codes = true + +ignore_missing_imports = true +follow_imports = "silent" +disable_error_code = ["attr-defined", "import-untyped"] + +exclude = ["firedrake/_check"]