Skip to content

Commit

Permalink
Specify Python version to Mypy and PyType
Browse files Browse the repository at this point in the history
Also enable verbosity for `make` commands to see more information to help
debugging in case there are errors.
  • Loading branch information
mbrukman committed Nov 11, 2024
1 parent 2e95d06 commit d137ca0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ jobs:
if: ${{ matrix.python == '3.12' }}

- name: Run Python tests
run: make py-test
run: make py-test VERBOSE=1

- name: Check types with Mypy
run: make mypy-test
run: make mypy-test PYTHON_VERSION=${{ matrix.python }} VERBOSE=1

- name: Check types with PyType
run: make pytype-test
run: make pytype-test PYTHON_VERSION=${{ matrix.python }} VERBOSE=1
# https://github.com/google/pytype/issues/1475
#
# PyType does not yet support Python 3.12; if this step is enabled, it
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ ifeq ($(VERBOSE),1)
endif

SRC_DIR ?= .
PYTHON_VERSION ?= $(shell python -c 'import platform; print(platform.python_version())')

.PHONY: test clean

Expand Down Expand Up @@ -45,7 +46,7 @@ py-test:
$(VERB) $(SRC_DIR)/run_python_tests.sh

mypy-test:
$(VERB) python -m mypy --ignore-missing-imports `find . -name 'third_party' -prune -o -name '*.py' -print`
$(VERB) python -m mypy --python-version=$(PYTHON_VERSION) --ignore-missing-imports `find . -name 'third_party' -prune -o -name '*.py' -print`

pytype-test:
$(VERB) python -m pytype -k `find . -name 'third_party' -prune -o -name '*.py' -print`
$(VERB) python -m pytype --python-version=$(PYTHON_VERSION) -k `find . -name 'third_party' -prune -o -name '*.py' -print`

0 comments on commit d137ca0

Please sign in to comment.