Skip to content

Commit fb816b4

Browse files
committed
make mypy_3.6: Still check the types in a Python 3.6 context, but using Py 3.7+
1 parent e264ca2 commit fb816b4

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

.github/workflows/ci-tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ jobs:
2626
py-ver-major: [3]
2727
py-ver-minor: [6, 7, 8, 9, 10]
2828
step: [lint, unit, bandit, mypy]
29+
exclude:
30+
- py-ver-major: 3
31+
py-ver-minor: 6
32+
step: mypy
2933

3034
env:
3135
py-semver: ${{ format('{0}.{1}', matrix.py-ver-major, matrix.py-ver-minor) }}

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,16 @@ mypy: $(filter-out setup.py gittagger.py,$(PYSOURCES))
186186
fi # if minimally required ruamel.yaml version is 0.15.99 or greater, than the above can be removed
187187
MYPYPATH=$$MYPYPATH:mypy-stubs mypy $^
188188

189+
mypy_3.6: $(filter-out setup.py gittagger.py,$(PYSOURCES))
190+
if ! test -f $(shell python -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))')/py.typed ; \
191+
then \
192+
rm -Rf mypy-stubs/ruamel/yaml ; \
193+
ln -s $(shell python -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))') \
194+
mypy-stubs/ruamel/ ; \
195+
fi # if minimally required ruamel.yaml version is 0.15.99 or greater, than the above can be removed
196+
MYPYPATH=$$MYPYPATH:mypy-stubs mypy --python-version 3.6 $^
197+
198+
189199
mypyc: $(PYSOURCES)
190200
MYPYPATH=mypy-stubs CWLTOOL_USE_MYPYC=1 pip install --verbose -e . \
191201
&& pytest -rs -vv ${PYTEST_EXTRA}

tox.ini

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ envlist =
33
py3{6,7,8,9,10}-lint
44
py3{6,7,8,9,10}-unit
55
py3{6,7,8,9,10}-bandit
6-
py3{6,7,8,9,10}-mypy
6+
py3{7,8,9,10}-mypy
77
py39-lintreadme
88
py39-shellcheck
99
py39-pydocstyle
@@ -30,7 +30,7 @@ description =
3030
py3{6,7,8,9,10}-unit: Run the unit tests
3131
py3{6,7,8,9,10}-lint: Lint the Python code
3232
py3{6,7,8,9,10}-bandit: Search for common security issues
33-
py3{6,7,8,9,10}-mypy: Check for type safety
33+
py3{7,8,9,10}-mypy: Check for type safety
3434
py39-pydocstyle: docstring style checker
3535
py39-shellcheck: syntax check for shell scripts
3636
py39-lintreadme: Lint the README.rst→.md conversion
@@ -49,7 +49,7 @@ deps =
4949
py3{6,7,8,9,10}-lint: -rlint-requirements.txt
5050
py3{6,7,8,9,10}-bandit: bandit
5151
py3{6,7,8,9,10}-bandit: importlib_metadata != 4.8.0
52-
py3{6,7,8,9,10}-mypy: -rmypy-requirements.txt
52+
py3{7,8,9,10}-mypy: -rmypy-requirements.txt
5353
py39-pydocstyle: pydocstyle
5454
py39-pydocstyle: diff-cover
5555
py39-lintreadme: twine
@@ -68,7 +68,8 @@ commands =
6868
py3{6,7,8,9,10}-unit: make coverage-report coverage.xml PYTEST_EXTRA={posargs}
6969
py3{6,7,8,9,10}-bandit: bandit -r cwltool
7070
py3{6,7,8,9,10}-lint: make flake8 format-check codespell
71-
py3{6,7,8,9,10}-mypy: make mypy mypyc PYTEST_EXTRA={posargs}
71+
py3{7,8,9,10}-mypy: make mypy mypyc PYTEST_EXTRA={posargs}
72+
py37-mypy: make mypy_3.6
7273
py39-shellcheck: make shellcheck
7374
py39-pydocstyle: make diff_pydocstyle_report
7475
py39-lintreadme: twine check {distdir}/*

0 commit comments

Comments
 (0)