Skip to content

Commit 9666369

Browse files
authored
[CI] Pass local python version explicitly to pre-commit mypy.sh (#12224)
Signed-off-by: Chen Zhang <[email protected]>
1 parent 18572e3 commit 9666369

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ repos:
4242
hooks:
4343
- id: mypy-local
4444
name: Run mypy for local Python installation
45-
entry: tools/mypy.sh
45+
entry: tools/mypy.sh 0 "local"
4646
language: python
4747
types: [python]
4848
additional_dependencies: &mypy_deps [mypy==1.11.1, types-setuptools, types-PyYAML, types-requests]

tools/mypy.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
#!/bin/bash
22

33
CI=${1:-0}
4-
PYTHON_VERSION=${2:-3.9}
4+
PYTHON_VERSION=${2:-local}
55

66
if [ "$CI" -eq 1 ]; then
77
set -e
88
fi
99

10+
if [ $PYTHON_VERSION == "local" ]; then
11+
PYTHON_VERSION=$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
12+
fi
13+
1014
run_mypy() {
1115
echo "Running mypy on $1"
1216
if [ "$CI" -eq 1 ] && [ -z "$1" ]; then

0 commit comments

Comments
 (0)