Skip to content

Add optional mypy check #505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/mypy-check.yml
Original file line number Diff line number Diff line change
@@ -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
Empty file added cuda_core/cuda/py.typed
Empty file.
5 changes: 5 additions & 0 deletions cuda_core/pyproject.toml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this overrides section do?

Original file line number Diff line number Diff line change
Expand Up @@ -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"
Loading