-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from kammala/fix/refactor-makefile
OPT: use black and optimize build process
- Loading branch information
Showing
19 changed files
with
140 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,76 @@ | ||
# This Makefile requires the following commands to be available: | ||
# * virtualenv | ||
# * python2.7 | ||
# * python3.6 | ||
# * docker | ||
# * docker-compose | ||
|
||
DEPS:=requirements.txt | ||
DOCKER_COMPOSE:=$(shell which docker-compose) | ||
|
||
PIP:="venv/bin/pip" | ||
CMD_FROM_VENV:=". venv/bin/activate; which" | ||
TOX=$(shell "$(CMD_FROM_VENV)" "tox") | ||
PYTHON=$(shell "$(CMD_FROM_VENV)" "python") | ||
TOX_PY_LIST="$(shell $(TOX) -l | grep ^py | xargs | sed -e 's/ /,/g')" | ||
|
||
.PHONY: clean docsclean pyclean test lint isort docs docker setup.py requirements | ||
|
||
tox: clean requirements | ||
$(TOX) | ||
|
||
.PHONY: pyclean | ||
pyclean: | ||
@find . -name *.pyc -delete | ||
@rm -rf *.egg-info build | ||
@rm -rf coverage.xml .coverage | ||
find . -name "*.pyc" -delete | ||
rm -rf *.egg-info build | ||
rm -rf coverage.xml .coverage | ||
|
||
.PHONY: docsclean | ||
docsclean: | ||
@rm -fr docs/_build/ | ||
@rm -fr docs/api/ | ||
rm -rf docs/_build/ | ||
rm -rf docs/api/ | ||
|
||
.PHONY: clean | ||
clean: pyclean docsclean | ||
@rm -rf venv | ||
@rm -rf .tox | ||
|
||
venv: | ||
@python3.6 -m venv venv | ||
@$(PIP) install -U "pip>=7.0" -q | ||
@$(PIP) install -r $(DEPS) | ||
python3.6 -m venv venv | ||
venv/bin/pip install -U pip -q | ||
venv/bin/pip install -r requirements.txt | ||
|
||
.PHONY: test | ||
test: venv pyclean | ||
$(TOX) -e $(TOX_PY_LIST) | ||
venv/bin/tox | ||
|
||
test/%: venv pyclean | ||
$(TOX) -e $(TOX_PY_LIST) -- $* | ||
venv/bin/tox -- $* | ||
|
||
.PHONY: lint | ||
lint: venv | ||
@$(TOX) -e lint | ||
@$(TOX) -e isort-check | ||
venv/bin/flake8 time_execution tests | ||
venv/bin/isort -rc -c time_execution tests | ||
venv/bin/black --check time_execution tests | ||
|
||
isort: venv | ||
@$(TOX) -e isort-fix | ||
.PHONY: format | ||
format: venv | ||
venv/bin/isort -rc time_execution tests | ||
venv/bin/black --verbose time_execution tests | ||
|
||
.PHONY: docs | ||
docs: venv docsclean | ||
@$(TOX) -e docs | ||
venv/bin/python docs/apidoc.py -T -M -d 2 -o docs/api time_execution | ||
venv/bin/sphinx-build -W -b html docs docs/_build/html | ||
|
||
.PHONY: docker | ||
docker: | ||
$(DOCKER_COMPOSE) run --rm --service-ports app bash | ||
|
||
docker/%: | ||
$(DOCKER_COMPOSE) run --rm --service-ports app make $* | ||
|
||
setup.py: venv | ||
@$(PYTHON) setup_gen.py | ||
@$(PYTHON) setup.py check --restructuredtext | ||
venv/bin/python setup_gen.py | ||
venv/bin/python setup.py sdist | ||
venv/bin/twine check dist/* | ||
|
||
.PHONY: publish | ||
publish: setup.py | ||
@$(PYTHON) setup.py sdist upload | ||
-rm setup.py | ||
$(MAKE) setup.py | ||
venv/bin/twine upload dist/* | ||
|
||
build: clean venv tox setup.py | ||
.PHONY: build | ||
build: clean venv lint test setup.py | ||
|
||
changelog: | ||
gitchangelog | ||
venv/bin/gitchangelog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[tool.black] | ||
line-length = 119 | ||
target_version = ['py27', 'py36', 'py37'] | ||
skip-string-normalization = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Additional packages | ||
-r requirements/requirements-base.txt | ||
-r requirements/requirements-elasticsearch.txt | ||
-r requirements/requirements-influxdb.txt | ||
-r requirements/requirements-kafka.txt | ||
-r requirements/requirements-testing.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
tox | ||
isort | ||
flake8==3.6.0 | ||
black; python_version >= "3.6" | ||
flake8 | ||
twine | ||
pkgversion | ||
|
||
freezegun>=0.3.7,<0.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.