|
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 |
12 | 3 |
|
13 | 4 | default: precommit |
14 | 5 |
|
15 | 6 | precommit: docstyle flake8 |
16 | 7 |
|
17 | 8 | test: |
18 | | - ${RUN_VENV_ACTIVATE} |
19 | | - ${PYTHON} -m pytest test --cov=notecard --ignore=test/hitl |
| 9 | + pipenv run pytest test --cov=notecard --ignore=test/hitl |
20 | 10 |
|
21 | 11 | docstyle: |
22 | | - ${RUN_VENV_ACTIVATE} |
23 | | - ${PYTHON} -m pydocstyle notecard/ examples/ mpy_board/ |
| 12 | + pipenv run pydocstyle notecard/ examples/ mpy_board/ |
24 | 13 |
|
25 | 14 | flake8: |
26 | | - ${RUN_VENV_ACTIVATE} |
27 | 15 | # E722 Do not use bare except, specify exception instead https://www.flake8rules.com/rules/E722.html |
28 | 16 | # F401 Module imported but unused https://www.flake8rules.com/rules/F401.html |
29 | 17 | # F403 'from module import *' used; unable to detect undefined names https://www.flake8rules.com/rules/F403.html |
30 | 18 | # W503 Line break occurred before a binary operator https://www.flake8rules.com/rules/W503.html |
31 | 19 | # 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 |
33 | 21 |
|
34 | 22 | coverage: |
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 |
37 | 24 |
|
38 | 25 | run_build: |
39 | | - ${RUN_VENV_ACTIVATE} |
40 | | - ${PYTHON} -m setup sdist bdist_wheel |
| 26 | + pipenv run python -m build |
41 | 27 |
|
42 | 28 | deploy: |
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/*' |
45 | 30 |
|
46 | | -.PHONY: precommit venv test coverage run_build deploy |
| 31 | +.PHONY: precommit test coverage run_build deploy |
0 commit comments