1- # define VENV_NAME to use a specific virtual environment. It defaults to `env`.
2- VENV_NAME? =env
3- VENV_ACTIVATE =$(VENV_NAME ) /bin/activate
4- PYTHON =python
5- # the target to activate the virtual environment. Only defined if it exists.
6-
7- # check if the VENV file exists, if it does assume that's been made active
8- ifneq ("$(wildcard ${VENV_ACTIVATE}) ","")
9- RUN_VENV_ACTIVATE=. ${VENV_ACTIVATE}
10- PYTHON = ${VENV_NAME}/bin/python3
11- endif
1+ # Use pipenv for virtual environment management
2+ PYTHON =python3
123
134default : precommit
145
156precommit : docstyle flake8
167
178test :
18- ${RUN_VENV_ACTIVATE}
19- ${PYTHON} -m pytest test --cov=notecard --ignore=test/hitl
9+ pipenv run pytest test --cov=notecard --ignore=test/hitl
2010
2111docstyle :
22- ${RUN_VENV_ACTIVATE}
23- ${PYTHON} -m pydocstyle notecard/ examples/ mpy_board/
12+ pipenv run pydocstyle notecard/ examples/ mpy_board/
2413
2514flake8 :
26- ${RUN_VENV_ACTIVATE}
2715 # E722 Do not use bare except, specify exception instead https://www.flake8rules.com/rules/E722.html
2816 # F401 Module imported but unused https://www.flake8rules.com/rules/F401.html
2917 # F403 'from module import *' used; unable to detect undefined names https://www.flake8rules.com/rules/F403.html
3018 # W503 Line break occurred before a binary operator https://www.flake8rules.com/rules/W503.html
3119 # E501 Line too long (>79 characters) https://www.flake8rules.com/rules/E501.html
32- ${PYTHON} -m flake8 --exclude=notecard/md5.py test/ notecard/ examples/ mpy_board/ --count --ignore=E722,F401,F403,W503,E501,E502 --show-source --statistics
20+ pipenv run flake8 --exclude=notecard/md5.py test/ notecard/ examples/ mpy_board/ --count --ignore=E722,F401,F403,W503,E501,E502 --show-source --statistics
3321
3422coverage :
35- ${RUN_VENV_ACTIVATE}
36- ${PYTHON} -m pytest test --ignore=test/hitl --doctest-modules --junitxml=junit/test-results.xml --cov=notecard --cov-report=xml --cov-report=html
23+ pipenv run pytest test --ignore=test/hitl --doctest-modules --junitxml=junit/test-results.xml --cov=notecard --cov-report=xml --cov-report=html
3724
3825run_build :
39- ${RUN_VENV_ACTIVATE}
40- ${PYTHON} -m setup sdist bdist_wheel
26+ pipenv run python -m build
4127
4228deploy :
43- ${RUN_VENV_ACTIVATE}
44- ${PYTHON} -m twine upload -r " pypi" --config-file .pypirc ' dist/*'
29+ pipenv run python -m twine upload -r " pypi" --config-file .pypirc ' dist/*'
4530
46- .PHONY : precommit venv test coverage run_build deploy
31+ .PHONY : precommit test coverage run_build deploy
0 commit comments