-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
65 lines (49 loc) · 2.09 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
TEST_PATH=./tests
.DEFAULT_GOAL := help
.PHONY: help clean-pyc build clean-build deployment-package venv dependencies test-dependencies clean-venv test test-reports clean-test check-codestyle check-docstyle
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
clean-pyc: ## Remove python artifacts.
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
build: ## build a package
python setup.py sdist bdist_wheel
clean-build: ## clean build artifacts
rm -rf build
rm -rf dist
rm -rf model_task_queue.egg-info
deployment-package: ## makes a deployment package with all dependencies
# installing all dependencies to the vendors directory
mkdir vendors
pip install --target vendors -r requirements.txt
python setup.py sdist --create_deployment_package
rm -rf vendors
rm -rf build
rm -rf model_task_queue.egg-info
venv: ## create virtual environment
python3 -m venv venv
venv/bin/pip install --upgrade pip
venv/bin/pip install --upgrade setuptools
venv/bin/pip install --upgrade wheel
dependencies: ## install dependencies from requirements.txt
pip install -r requirements.txt
test-dependencies: ## install dependencies from test_requirements.txt
pip install -r test_requirements.txt
clean-venv: ## remove all packages from virtual environment
pip freeze | grep -v "^-e" | xargs pip uninstall -y
test: clean-pyc ## Run unit test suite.
pytest --verbose --color=yes $(TEST_PATH)
test-reports: clean-pyc ## Run unit test suite with reporting
mkdir -p reports
python -m coverage run --source model_task_queue -m pytest --verbose --color=yes --junitxml=./reports/unit_tests.xml $(TEST_PATH)
coverage xml -o ./reports/coverage.xml
rm -rf .coverage
clean-test: ## Remove test artifacts
rm -rf .pytest_cache
rm -rf .coverage
rm -rf reports
check-codestyle: ## checks the style of the code against PEP8
pycodestyle model_task_queue --max-line-length=120
check-docstyle: ## checks the style of the docstrings against PEP257
pydocstyle model_task_queue