Skip to content

Commit

Permalink
make mypy_3.6: Still check the types in a Python 3.6 context, but usi…
Browse files Browse the repository at this point in the history
…ng Py 3.7+
  • Loading branch information
mr-c committed Sep 27, 2022
1 parent f9b2897 commit e423028
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
py-ver-major: [3]
py-ver-minor: [6, 7, 8, 9, 10]
step: [lint, unit, bandit, mypy]
exclude:
- py-ver-major: 3
py-ver-minor: 6
step: mypy

env:
py-semver: ${{ format('{0}.{1}', matrix.py-ver-major, matrix.py-ver-minor) }}
Expand Down
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,16 @@ mypy: $(filter-out setup.py gittagger.py,$(PYSOURCES))
fi # if minimally required ruamel.yaml version is 0.15.99 or greater, than the above can be removed
MYPYPATH=$$MYPYPATH:mypy-stubs mypy $^

mypy_3.6: $(filter-out setup.py gittagger.py,$(PYSOURCES))
if ! test -f $(shell python -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))')/py.typed ; \
then \
rm -Rf mypy-stubs/ruamel/yaml ; \
ln -s $(shell python -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))') \
mypy-stubs/ruamel/ ; \
fi # if minimally required ruamel.yaml version is 0.15.99 or greater, than the above can be removed
MYPYPATH=$$MYPYPATH:mypy-stubs mypy --python-version 3.6 $^


mypyc: $(PYSOURCES)
MYPYPATH=mypy-stubs CWLTOOL_USE_MYPYC=1 pip install --verbose -e . \
&& pytest -rs -vv ${PYTEST_EXTRA}
Expand Down
9 changes: 5 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ envlist =
py3{6,7,8,9,10}-lint
py3{6,7,8,9,10}-unit
py3{6,7,8,9,10}-bandit
py3{6,7,8,9,10}-mypy
py3{7,8,9,10}-mypy
py39-lintreadme
py39-shellcheck
py39-pydocstyle
Expand All @@ -30,7 +30,7 @@ description =
py3{6,7,8,9,10}-unit: Run the unit tests
py3{6,7,8,9,10}-lint: Lint the Python code
py3{6,7,8,9,10}-bandit: Search for common security issues
py3{6,7,8,9,10}-mypy: Check for type safety
py3{7,8,9,10}-mypy: Check for type safety
py39-pydocstyle: docstring style checker
py39-shellcheck: syntax check for shell scripts
py39-lintreadme: Lint the README.rst→.md conversion
Expand All @@ -49,7 +49,7 @@ deps =
py3{6,7,8,9,10}-lint: -rlint-requirements.txt
py3{6,7,8,9,10}-bandit: bandit
py3{6,7,8,9,10}-bandit: importlib_metadata != 4.8.0
py3{6,7,8,9,10}-mypy: -rmypy-requirements.txt
py3{7,8,9,10}-mypy: -rmypy-requirements.txt
py39-pydocstyle: pydocstyle
py39-pydocstyle: diff-cover
py39-lintreadme: twine
Expand All @@ -68,7 +68,8 @@ commands =
py3{6,7,8,9,10}-unit: make coverage-report coverage.xml PYTEST_EXTRA={posargs}
py3{6,7,8,9,10}-bandit: bandit -r cwltool
py3{6,7,8,9,10}-lint: make flake8 format-check codespell
py3{6,7,8,9,10}-mypy: make mypy mypyc PYTEST_EXTRA={posargs}
py3{7,8,9,10}-mypy: make mypy mypyc PYTEST_EXTRA={posargs}
py37-mypy: make mypy_3.6
py39-shellcheck: make shellcheck
py39-pydocstyle: make diff_pydocstyle_report
py39-lintreadme: twine check {distdir}/*
Expand Down

0 comments on commit e423028

Please sign in to comment.