diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml new file mode 100644 index 0000000000..1c1b960db9 --- /dev/null +++ b/.github/workflows/mypy.yml @@ -0,0 +1,26 @@ +name: Run mypy + +on: + push: + pull_request: + +jobs: + OSX: + runs-on: macos-latest + strategy: + matrix: + python: ["3.10", 3.14] + steps: + - name: Checkout + uses: actions/checkout@v4.2.2 + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v5.4.0 + with: + python-version: ${{ matrix.python }} + - name: Install mypy + run: | + pip install mypy + - name: Run mypy + run: | + mypy python + diff --git a/.mypy.ini b/.mypy.ini new file mode 100644 index 0000000000..9033030a48 --- /dev/null +++ b/.mypy.ini @@ -0,0 +1,17 @@ +[mypy] +python_version = 3.10 +warn_return_any = False +warn_unused_configs = True + +# Files to exclude +exclude = (?x)( + python/lwt_interface/cython_example/setup.py| + python/lwt_interface/setup.py| + python/setup.py + ) + +namespace_packages = False + + +# Suppressing errors +disable_error_code = assignment,attr-defined,index,empty-body,var-annotated,call-overload,syntax,union-attr,misc,import-not-found,import-untyped diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5269301e47..0241013cb8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,3 +42,11 @@ repos: args: [--skip-errors] additional_dependencies: [black==22.3.0] language_version: python3 + - repo: local + hooks: + - id: mypy + name: mypy + language: system + entry: mypy + files: \.py$ +