Reworked Makefile to use Makefile.venv

Completely reworked the Makefile to make use
of an existing 'library' to manage python
virtual environments.

https://github.com/sio/Makefile.venv
This commit is contained in:
Hemna 2021-04-05 12:38:38 -04:00
parent 23c219f0d2
commit a4a06c9763
5 changed files with 70 additions and 74 deletions

View File

@ -1,61 +1,56 @@
.PHONY: virtual dev build-requirements black isort flake8 REQUIREMENTS_TXT ?= requirements.txt dev-requirements.txt
include Makefile.venv
Makefile.venv:
curl \
-o Makefile.fetched \
-L "https://github.com/sio/Makefile.venv/raw/v2020.08.14/Makefile.venv"
echo "5afbcf51a82f629cd65ff23185acde90ebe4dec889ef80bbdc12562fbd0b2611 *Makefile.fetched" \
| sha256sum --check - \
&& mv Makefile.fetched Makefile.venv
all: pip dev all: pip dev
virtual: .venv/bin/pip # Creates an isolated python 3 environment .PHONY: dev
dev: venv
$(VENV)/pre-commit install
.venv/bin/pip: .PHONY: docs
virtualenv -p /usr/bin/python3 .venv docs: venv
tox -edocs
.venv/bin/aprsd: virtual .PHONY: server
test -s .venv/bin/aprsd || .venv/bin/pip install -q -e . server: venv
$(VENV)/aprsd server --loglevel DEBUG
install: .venv/bin/aprsd clean: clean-venv
.venv/bin/pip install -Ur requirements.txt
dev-pre-commit:
test -s .git/hooks/pre-commit || .venv/bin/pre-commit install
dev-requirements:
test -s .venv/bin/twine || .venv/bin/pip install -q -r dev-requirements.txt
pip: virtual
.venv/bin/pip install -q -U pip
dev: pip .venv/bin/aprsd dev-requirements dev-pre-commit
pip-tools:
test -s .venv/bin/pip-compile || .venv/bin/pip install pip-tools
clean:
rm -rf dist/* rm -rf dist/*
rm -rf .venv
.PHONY: test
test: dev test: dev
.venv/bin/pre-commit run --all-files
tox -p all tox -p all
build: test build: test
rm -rf dist/* $(VENV)/python3 setup.py sdist bdist_wheel
.venv/bin/python3 setup.py sdist bdist_wheel $(VENV)/twine check dist/*
.venv/bin/twine check dist/*
upload: build upload: build
.venv/bin/twine upload dist/* $(VENV)/twine upload dist/*
docker: test docker: test
docker build -t hemna6969/aprsd:latest -f docker/Dockerfile docker docker build -t hemna6969/aprsd:latest -f docker/Dockerfile docker
update-requirements: dev pip-tools docker-dev: test
.venv/bin/pip-compile -q -U requirements.in docker build -t hemna6969/aprsd:master -f docker/Dockerfile-dev docker
.venv/bin/pip-compile -q -U dev-requirements.in
.venv/bin/tox: # install tox update-requirements: dev
test -s .venv/bin/tox || .venv/bin/pip install -q -U tox $(VENV)/pip-compile requirements.in
$(VENV)/pip-compile dev-requirements.in
check: .venv/bin/tox # Code format check with isort and black
check: dev # Code format check with isort and black
tox -efmt-check tox -efmt-check
tox -epep8 tox -epep8
fix: .venv/bin/tox # fixes code formatting with isort and black fix: dev # fixes code formatting with isort and black
tox -efmt tox -efmt

View File

@ -8,3 +8,5 @@ pep8-naming
Sphinx Sphinx
tox tox
twine twine
pre-commit
pip-tools

View File

@ -22,10 +22,14 @@ certifi==2020.12.5
# via requests # via requests
cffi==1.14.4 cffi==1.14.4
# via cryptography # via cryptography
cfgv==3.2.0
# via pre-commit
chardet==4.0.0 chardet==4.0.0
# via requests # via requests
click==7.1.2 click==7.1.2
# via black # via
# black
# pip-tools
colorama==0.4.4 colorama==0.4.4
# via twine # via twine
coverage==5.3.1 coverage==5.3.1
@ -48,6 +52,8 @@ flake8==3.8.4
# via # via
# -r dev-requirements.in # -r dev-requirements.in
# flake8-polyfill # flake8-polyfill
identify==2.2.2
# via pre-commit
idna==2.10 idna==2.10
# via requests # via requests
imagesize==1.2.0 imagesize==1.2.0
@ -74,6 +80,8 @@ mypy-extensions==0.4.3
# mypy # mypy
mypy==0.790 mypy==0.790
# via -r dev-requirements.in # via -r dev-requirements.in
nodeenv==1.5.0
# via pre-commit
packaging==20.8 packaging==20.8
# via # via
# bleach # bleach
@ -82,14 +90,20 @@ packaging==20.8
# tox # tox
pathspec==0.8.1 pathspec==0.8.1
# via black # via black
pep517==0.10.0
# via pip-tools
pep8-naming==0.11.1 pep8-naming==0.11.1
# via -r dev-requirements.in # via -r dev-requirements.in
pip-tools==6.0.1
# via -r dev-requirements.in
pkginfo==1.6.1 pkginfo==1.6.1
# via twine # via twine
pluggy==0.13.1 pluggy==0.13.1
# via # via
# pytest # pytest
# tox # tox
pre-commit==2.11.1
# via -r dev-requirements.in
py==1.10.0 py==1.10.0
# via # via
# pytest # pytest
@ -114,6 +128,8 @@ pytest==6.2.1
# pytest-cov # pytest-cov
pytz==2020.5 pytz==2020.5
# via babel # via babel
pyyaml==5.4.1
# via pre-commit
readme-renderer==28.0 readme-renderer==28.0
# via twine # via twine
regex==2020.11.13 regex==2020.11.13
@ -155,6 +171,8 @@ sphinxcontrib-serializinghtml==1.1.4
toml==0.10.2 toml==0.10.2
# via # via
# black # black
# pep517
# pre-commit
# pytest # pytest
# tox # tox
tox==3.21.0 tox==3.21.0
@ -174,9 +192,12 @@ typing-extensions==3.7.4.3
urllib3==1.26.3 urllib3==1.26.3
# via requests # via requests
virtualenv==20.4.0 virtualenv==20.4.0
# via tox # via
# pre-commit
# tox
webencodings==0.5.1 webencodings==0.5.1
# via bleach # via bleach
# The following packages are considered to be unsafe in a requirements file: # The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools # setuptools

View File

@ -1,18 +1,17 @@
aprslib
click click
click-completion click-completion
imapclient
pluggy
pbr
pyyaml
six
requests
thesmuggler
aprslib
py3-validate-email
pre-commit
pytz
opencage
flask flask
flask-classful flask-classful
flask-httpauth flask-httpauth
imapclient
opencage
pluggy
pbr
pyyaml
py3-validate-email
pytz
requests
six
thesmuggler
yfinance yfinance

View File

@ -4,8 +4,6 @@
# #
# pip-compile requirements.in # pip-compile requirements.in
# #
appdirs==1.4.4
# via virtualenv
aprslib==0.6.47 aprslib==0.6.47
# via -r requirements.in # via -r requirements.in
backoff==1.10.0 backoff==1.10.0
@ -14,8 +12,6 @@ certifi==2020.12.5
# via requests # via requests
cffi==1.14.4 cffi==1.14.4
# via cryptography # via cryptography
cfgv==3.2.0
# via pre-commit
chardet==4.0.0 chardet==4.0.0
# via requests # via requests
click-completion==0.5.2 click-completion==0.5.2
@ -27,14 +23,10 @@ click==7.1.2
# flask # flask
cryptography==3.3.2 cryptography==3.3.2
# via pyopenssl # via pyopenssl
distlib==0.3.1
# via virtualenv
dnspython==2.1.0 dnspython==2.1.0
# via py3-validate-email # via py3-validate-email
filelock==3.0.12 filelock==3.0.12
# via # via py3-validate-email
# py3-validate-email
# virtualenv
flask-classful==0.14.2 flask-classful==0.14.2
# via -r requirements.in # via -r requirements.in
flask-httpauth==4.2.0 flask-httpauth==4.2.0
@ -44,8 +36,6 @@ flask==1.1.2
# -r requirements.in # -r requirements.in
# flask-classful # flask-classful
# flask-httpauth # flask-httpauth
identify==1.5.13
# via pre-commit
idna==2.10 idna==2.10
# via # via
# py3-validate-email # py3-validate-email
@ -64,8 +54,6 @@ markupsafe==1.1.1
# via jinja2 # via jinja2
multitasking==0.0.9 multitasking==0.0.9
# via yfinance # via yfinance
nodeenv==1.5.0
# via pre-commit
numpy==1.20.1 numpy==1.20.1
# via # via
# pandas # pandas
@ -78,8 +66,6 @@ pbr==5.5.1
# via -r requirements.in # via -r requirements.in
pluggy==0.13.1 pluggy==0.13.1
# via -r requirements.in # via -r requirements.in
pre-commit==2.9.3
# via -r requirements.in
py3-validate-email==0.2.12 py3-validate-email==0.2.12
# via -r requirements.in # via -r requirements.in
pycparser==2.20 pycparser==2.20
@ -93,9 +79,7 @@ pytz==2020.5
# -r requirements.in # -r requirements.in
# pandas # pandas
pyyaml==5.4.1 pyyaml==5.4.1
# via # via -r requirements.in
# -r requirements.in
# pre-commit
requests==2.25.1 requests==2.25.1
# via # via
# -r requirements.in # -r requirements.in
@ -112,15 +96,10 @@ six==1.15.0
# opencage # opencage
# pyopenssl # pyopenssl
# python-dateutil # python-dateutil
# virtualenv
thesmuggler==1.0.1 thesmuggler==1.0.1
# via -r requirements.in # via -r requirements.in
toml==0.10.2
# via pre-commit
urllib3==1.26.3 urllib3==1.26.3
# via requests # via requests
virtualenv==20.4.0
# via pre-commit
werkzeug==1.0.1 werkzeug==1.0.1
# via flask # via flask
yfinance==0.1.55 yfinance==0.1.55