Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ repos:
hooks:
- id: mypy-local
name: Run mypy for local Python installation
entry: tools/mypy.sh
entry: tools/mypy.sh 1 "local"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
entry: tools/mypy.sh 1 "local"
entry: tools/mypy.sh 0 "local"

Should be 0 here to indicate not running in CI

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done. But why does here use CI=1?

name: Run mypy for Python 3.9
entry: tools/mypy.sh 1 "3.9"

Copy link
Member

Choose a reason for hiding this comment

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

The version-locked steps are intended to be run in CI only.

language: python
types: [python]
additional_dependencies: &mypy_deps [mypy==1.11.1, types-setuptools, types-PyYAML, types-requests]
Expand Down
4 changes: 4 additions & 0 deletions tools/mypy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ if [ "$CI" -eq 1 ]; then
set -e
fi

if [ $PYTHON_VERSION == "local" ]; then
PYTHON_VERSION=$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
fi

run_mypy() {
echo "Running mypy on $1"
if [ "$CI" -eq 1 ] && [ -z "$1" ]; then
Expand Down
Loading