2222
2323MODULE =cwl_utils
2424PACKAGE =cwl-utils
25- EXTRAS =
25+ EXTRAS ="[testing]"
2626
2727# `SHELL=bash` doesn't work for some, so don't use BASH-isms like
2828# `[[` conditional expressions.
2929PYSOURCES =$(filter-out $(MODULE ) /parser/cwl_v% ,$(shell find $(MODULE ) -name "* .py") ) \
30- $( wildcard tests/ * .py) create_cwl_from_objects.py load_cwl_by_path.py \
30+ create_cwl_from_objects.py load_cwl_by_path.py \
3131 ${MODULE}/parser/cwl_v1_?_utils.py docs/conf.py
32- DEVPKGS =build diff_cover pylint pep257 ruff 'tox<4' tox-pyenv \
32+ DEVPKGS =build diff_cover pylint pep257 ruff 'tox>=4' \
3333 wheel autoflake pyupgrade bandit auto-walrus \
34- -rlint-requirements.txt -rtest-requirements.txt - rmypy-requirements.txt
34+ -rlint-requirements.txt -rmypy-requirements.txt
3535DEBDEVPKGS =pep8 python-autopep8 pylint python-coverage ruff sloccount \
3636 python-flake8 python-mock shellcheck
3737VERSION =v$(shell echo $$(tail -n 1 cwl_utils/__meta__.py | awk '{print $$3}' ) )
@@ -52,7 +52,7 @@ cleanup: sort_imports format flake8 pydocstyle
5252install-dep : install-dependencies
5353
5454install-dependencies :
55- pip install -U pip setuptools wheel
55+ pip install -U pip wheel build
5656 pip install --upgrade $(DEVPKGS )
5757
5858# # install-deb-dep : install many of the dev dependencies via apt-get
@@ -65,57 +65,57 @@ install: FORCE
6565
6666# # dev : install the cwl-utils package in dev mode
6767dev : install-dep
68- pip install -U pip setuptools wheel
68+ pip install -U pip wheel
6969 pip install -e .$(EXTRAS )
7070
7171# # dist : create a module package for distribution
7272dist : dist/${MODULE}-$(VERSION ) .tar.gz
7373
7474dist/${MODULE}-$(VERSION ) .tar.gz : $(SOURCES )
75- python -m build
75+ python3 -m build
7676
7777# # docs : make the docs
7878docs : FORCE
7979 cd docs && $(MAKE ) html
8080
8181# # clean : clean up all temporary / machine-generated files
8282clean : FORCE
83- rm -f ${MODULE} /* .pyc tests/* .pyc
83+ rm -f ${MODULE} /* .pyc ${MODULE} / tests/* .pyc
8484 rm -Rf .coverage
8585 rm -f diff-cover.html
8686
8787# Linting and code style related targets
8888# # sort_import : sorting imports using isort: https://github.com/timothycrosley/isort
89- sort_imports : $( PYSOURCES )
90- isort $^
89+ sort_imports : FORCE
90+ isort $( PYSOURCES )
9191
92- remove_unused_imports : $( PYSOURCES )
93- autoflake --in-place --remove-all-unused-imports $^
92+ remove_unused_imports : FORCE
93+ autoflake --in-place --remove-all-unused-imports $( PYSOURCES )
9494
9595pep257 : pydocstyle
9696# # pydocstyle : check Python docstring style
97- pydocstyle : $( PYSOURCES )
98- ruff check $^
97+ pydocstyle : FORCE
98+ ruff check $( PYSOURCES )
9999
100100# # codespell : check for common misspellings
101- codespell :
101+ codespell : FORCE
102102 codespell -w $(shell git ls-files | grep -v mypy-stubs)
103103
104104# # format : check/fix all code indentation and formatting (runs black)
105- format : $( PYSOURCES ) FORCE
105+ format : FORCE
106106 black $(PYSOURCES )
107107
108- format-check : $( PYSOURCES )
109- black --diff --check $^
108+ format-check : FORCE
109+ black --diff --check $( PYSOURCES )
110110
111111# # pylint : run static code analysis on Python code
112- pylint : $( PYSOURCES )
112+ pylint : FORCE
113113 pylint --msg-template=" {path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
114- $^ -j0|| true
114+ $(PYSOURCES) -j0|| true
115115
116- pylint_report.txt : $( PYSOURCES )
116+ pylint_report.txt : FORCE
117117 pylint --msg-template=" {path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
118- $^ -j0> $@ || true
118+ $( PYSOURCES ) -j0> $@ || true
119119
120120diff_pylint_report : pylint_report.txt
121121 diff-quality --compare-branch=main --violations=pylint pylint_report.txt
@@ -144,34 +144,37 @@ diff-cover.html: coverage.xml
144144 diff-cover --compare-branch=main $^ --html-report $@
145145
146146# # test : run the cwl-utils test suite
147- test : $( PYSOURCES )
148- python -m pytest ${PYTEST_EXTRA}
147+ test : FORCE
148+ python3 -m pytest ${PYTEST_EXTRA}
149149
150150# # testcov : run the cwl-utils test suite and collect coverage
151- testcov : $( PYSOURCES )
152- python -m pytest --cov ${PYTEST_EXTRA}
151+ testcov : FORCE
152+ python3 -m pytest --cov ${PYTEST_EXTRA}
153153
154- sloccount.sc : $( PYSOURCES ) Makefile
155- sloccount --duplicates --wide --details $^ > $@
154+ sloccount.sc : FORCE
155+ sloccount --duplicates --wide --details $( PYSOURCES ) Makefile > $@
156156
157157# # sloccount : count lines of code
158- sloccount : $( PYSOURCES ) Makefile
159- sloccount $^
158+ sloccount : FORCE
159+ sloccount $( PYSOURCES ) Makefile
160160
161161list-author-emails :
162162 @echo ' name, E-Mail Address'
163163 @git log --format=' %aN,%aE' | sort -u | grep -v ' root'
164164
165- mypy3 : mypy
166- mypy : ${PYSOURCES}
167- MYPYPATH=$$ MYPYPATH:mypy-stubs mypy $^
165+ mypy : FORCE
166+ MYPYPATH=$$ MYPYPATH:mypy-stubs mypy $(PYSOURCES )
167+
168+ mypyc : FORCE
169+ MYPYPATH=mypy-stubs HATCH_BUILD_HOOKS_ENABLE=1 pip install --verbose -e . \
170+ && pytest " ${PYTEST_EXTRA} "
168171
169172shellcheck : FORCE
170173 shellcheck release-test.sh
171174
172- pyupgrade : $( PYSOURCES )
173- pyupgrade --exit-zero-even-if-changed --py310-plus $^
174- auto-walrus $^
175+ pyupgrade : FORCE
176+ pyupgrade --exit-zero-even-if-changed --py310-plus $( PYSOURCES )
177+ auto-walrus $( PYSOURCES )
175178
176179release-test : FORCE
177180 git diff-index --quiet HEAD -- || ( echo You have uncommitted changes, please commit them and try again; false )
@@ -180,13 +183,13 @@ release-test: FORCE
180183release : release-test
181184 . testenv2/bin/activate && \
182185 pip install build && \
183- python -m build testenv2/src/${PACKAGE} && \
186+ python3 -m build testenv2/src/${PACKAGE} && \
184187 pip install twine && \
185188 twine upload testenv2/src/${PACKAGE} /dist/* && \
186189 git tag ${VERSION} && git push --tags
187190
188- flake8 : $( PYSOURCES )
189- flake8 $^
191+ flake8 : FORCE
192+ flake8 $( PYSOURCES )
190193
191194cwl_utils/parser/cwl_v1_0.py : FORCE
192195 schema-salad-tool --codegen python \
0 commit comments