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
virtual: .venv/bin/pip # Creates an isolated python 3 environment
.PHONY: dev
dev: venv
$(VENV)/pre-commit install
.venv/bin/pip:
virtualenv -p /usr/bin/python3 .venv
.PHONY: docs
docs: venv
tox -edocs
.venv/bin/aprsd: virtual
test -s .venv/bin/aprsd || .venv/bin/pip install -q -e .
.PHONY: server
server: venv
$(VENV)/aprsd server --loglevel DEBUG
install: .venv/bin/aprsd
.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:
clean: clean-venv
rm -rf dist/*
rm -rf .venv
.PHONY: test
test: dev
.venv/bin/pre-commit run --all-files
tox -p all
build: test
rm -rf dist/*
.venv/bin/python3 setup.py sdist bdist_wheel
.venv/bin/twine check dist/*
$(VENV)/python3 setup.py sdist bdist_wheel
$(VENV)/twine check dist/*
upload: build
.venv/bin/twine upload dist/*
$(VENV)/twine upload dist/*
docker: test
docker build -t hemna6969/aprsd:latest -f docker/Dockerfile docker
update-requirements: dev pip-tools
.venv/bin/pip-compile -q -U requirements.in
.venv/bin/pip-compile -q -U dev-requirements.in
docker-dev: test
docker build -t hemna6969/aprsd:master -f docker/Dockerfile-dev docker
.venv/bin/tox: # install tox
test -s .venv/bin/tox || .venv/bin/pip install -q -U tox
update-requirements: dev
$(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 -epep8
fix: .venv/bin/tox # fixes code formatting with isort and black
fix: dev # fixes code formatting with isort and black
tox -efmt

View File

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

View File

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

View File

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

View File

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