diff --git a/.github/workflows/mypy-check.yml b/.github/workflows/mypy-check.yml new file mode 100644 index 000000000..cc0789490 --- /dev/null +++ b/.github/workflows/mypy-check.yml @@ -0,0 +1,39 @@ +name: "Optional mypy check" + +on: + push: + branches: + - "pull-request/[0-9]+" + - "main" + required: false + +jobs: + mypy: + runs-on: ubuntu-latest + + steps: + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # WAR: setup-python is not relocatable... + # see https://github.com/actions/setup-python/issues/871 + - name: Set up Python ${{ matrix.python-version }} + if: ${{ startsWith(matrix.host-platform, 'linux') }} + id: setup-python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + cd cuda_core + python -m pip install --upgrade pip + pip install -e . + pip install mypy + + - name: Run Mypy + run: | + cd cuda_core + mypy --no-namespace-packages . || true diff --git a/cuda_core/cuda/py.typed b/cuda_core/cuda/py.typed new file mode 100644 index 000000000..e69de29bb diff --git a/cuda_core/pyproject.toml b/cuda_core/pyproject.toml index 74820761c..c58b05342 100644 --- a/cuda_core/pyproject.toml +++ b/cuda_core/pyproject.toml @@ -105,3 +105,8 @@ exclude = ["cuda/core/_version.py"] [tool.ruff.lint.per-file-ignores] "__init__.py" = ["F401"] "setup.py" = ["F401"] + +[[tool.mypy.overrides]] +module = ["Cython", "llvmlite"] +ignore_missing_imports = true +follow_imports = "skip"