Skip to content

Commit

Permalink
[CI/Build] Improve mypy + python version matrix (#10041)
Browse files Browse the repository at this point in the history
Signed-off-by: Russell Bryant <[email protected]>
  • Loading branch information
russellb authored Nov 7, 2024
1 parent 6192e9b commit e036e52
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mypy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:
- name: Mypy
run: |
echo "::add-matcher::.github/workflows/matchers/mypy.json"
tools/mypy.sh 1
tools/mypy.sh 1 ${{ matrix.python-version }}
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,12 @@ ignore = [
]

[tool.mypy]
python_version = "3.9"

ignore_missing_imports = true
check_untyped_defs = true
follow_imports = "silent"

# After fixing type errors resulting from follow_imports: "skip" -> "silent",
# move the directory here and remove it from format.sh and mypy.yaml
# move the directory here and remove it from tools/mypy.sh
files = [
"vllm/*.py",
"vllm/adapter_commons",
Expand Down
5 changes: 3 additions & 2 deletions tools/mypy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

CI=${1:-0}
PYTHON_VERSION=${2:-3.9}

if [ $CI -eq 1 ]; then
set -e
Expand All @@ -9,10 +10,10 @@ fi
run_mypy() {
echo "Running mypy on $1"
if [ $CI -eq 1 ] && [ -z "$1" ]; then
mypy "$@"
mypy --python-version "${PYTHON_VERSION}" "$@"
return
fi
mypy --follow-imports skip "$@"
mypy --follow-imports skip --python-version "${PYTHON_VERSION}" "$@"
}

run_mypy # Note that this is less strict than CI
Expand Down

0 comments on commit e036e52

Please sign in to comment.