From 682aabbc38b80cbbc1bda347d3a37eba61022759 Mon Sep 17 00:00:00 2001 From: Ashwin Srinath Date: Mon, 10 Mar 2025 09:10:27 -0400 Subject: [PATCH 1/5] Initial commit --- .github/workflows/mypy-check.yml | 38 ++++++++++++++++++++++++++++++++ cuda_bindings/cuda/py.typed | 0 cuda_bindings/pyproject.toml | 6 +++++ 3 files changed, 44 insertions(+) create mode 100644 .github/workflows/mypy-check.yml create mode 100644 cuda_bindings/cuda/py.typed diff --git a/.github/workflows/mypy-check.yml b/.github/workflows/mypy-check.yml new file mode 100644 index 000000000..44d6c0551 --- /dev/null +++ b/.github/workflows/mypy-check.yml @@ -0,0 +1,38 @@ +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: | + mypy --no-namespace-packages . || true diff --git a/cuda_bindings/cuda/py.typed b/cuda_bindings/cuda/py.typed new file mode 100644 index 000000000..e69de29bb diff --git a/cuda_bindings/pyproject.toml b/cuda_bindings/pyproject.toml index 8921cc5a2..5f3a11205 100644 --- a/cuda_bindings/pyproject.toml +++ b/cuda_bindings/pyproject.toml @@ -109,3 +109,9 @@ exclude = ["cuda/bindings/_version.py"] "UP022", "E402", # module level import not at top of file "F841"] # F841 complains about unused variables, but some assignments have side-effects that could be useful for tests (func calls for example) + + +[[tool.mypy.overrides]] +module = ["Cython", "llvmlite"] +ignore_missing_imports = true +follow_imports = "skip" From dba834ab3cdba44751b405114776c24ee642f58c Mon Sep 17 00:00:00 2001 From: Ashwin Srinath Date: Mon, 10 Mar 2025 09:13:58 -0400 Subject: [PATCH 2/5] cd cuda_core first --- .github/workflows/mypy-check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/mypy-check.yml b/.github/workflows/mypy-check.yml index 44d6c0551..cc0789490 100644 --- a/.github/workflows/mypy-check.yml +++ b/.github/workflows/mypy-check.yml @@ -35,4 +35,5 @@ jobs: - name: Run Mypy run: | + cd cuda_core mypy --no-namespace-packages . || true From 761c4e142d545fc8af6f12b46afd05cb12794d05 Mon Sep 17 00:00:00 2001 From: Ashwin Srinath Date: Wed, 12 Mar 2025 14:38:40 -0400 Subject: [PATCH 3/5] Remove cuda_bindings/cuda/py.typed --- cuda_bindings/cuda/py.typed | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 cuda_bindings/cuda/py.typed diff --git a/cuda_bindings/cuda/py.typed b/cuda_bindings/cuda/py.typed deleted file mode 100644 index e69de29bb..000000000 From e2682ada08e8bd65bbc7b7209b339f1ccc4b4ea8 Mon Sep 17 00:00:00 2001 From: Ashwin Srinath Date: Wed, 12 Mar 2025 14:39:49 -0400 Subject: [PATCH 4/5] Add py.typed to cuda_core/cuda --- cuda_core/cuda/py.typed | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 cuda_core/cuda/py.typed diff --git a/cuda_core/cuda/py.typed b/cuda_core/cuda/py.typed new file mode 100644 index 000000000..e69de29bb From 12c62d33e2849005d0c965fbe3eb7d537a73552e Mon Sep 17 00:00:00 2001 From: Ashwin Srinath Date: Wed, 12 Mar 2025 14:41:22 -0400 Subject: [PATCH 5/5] Move pyproject.toml config --- cuda_bindings/pyproject.toml | 6 ------ cuda_core/pyproject.toml | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cuda_bindings/pyproject.toml b/cuda_bindings/pyproject.toml index 5f3a11205..8921cc5a2 100644 --- a/cuda_bindings/pyproject.toml +++ b/cuda_bindings/pyproject.toml @@ -109,9 +109,3 @@ exclude = ["cuda/bindings/_version.py"] "UP022", "E402", # module level import not at top of file "F841"] # F841 complains about unused variables, but some assignments have side-effects that could be useful for tests (func calls for example) - - -[[tool.mypy.overrides]] -module = ["Cython", "llvmlite"] -ignore_missing_imports = true -follow_imports = "skip" 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"