-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
101 lines (75 loc) · 2.45 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
PROEJECT_NAME := unicef-dssg
PROJECT_VERSION := $(shell python setup.py --version)
SHELL := /bin/bash
BOLD := \033[1m
DIM := \033[2m
RESET := \033[0m
help:
@echo "run - use this command to find help on running commands"
@echo "clean - remove all build, test, coverage and Python artifacts"
@echo "clean-build - remove build artifacts"
@echo "clean-pyc - remove Python file artifacts"
@echo "docs - generate Sphinx HTML documentation, including API docs"
@echo "dist - package"
@echo "install - install the package to the active Python's site-packages"
@echo "lint-pylama - test linting againt pylama"
@echo "lint-black - test linting againt black"
@echo "bandit - analyze code for security issues"
.PHONY: all, install, uninstall, doc, dist
all: uninstall install clean
install:
@echo -e "$(BOLD)installing $(PROEJECT_NAME) $(PROJECT_VERSION)$(RESET)"
@echo -e -n "$(DIM)"
@pip install .
@echo -e -n "$(RESET)"
uninstall:
@echo -e "$(BOLD)uninstalling '$(PROEJECT_NAME)'$(RESET)"
-@pip uninstall -y $(PROEJECT_NAME) 2> /dev/null
doc:
@echo -e "$(BOLD)building documentation for $(PROEJECT_NAME) $(PROJECT_VERSION)$(RESET)"
@echo -e -n "$(DIM)"
@cd docs && $(MAKE) html
@echo -e -n "$(RESET)"
dist:
@echo -e "$(BOLD)packaging $(PROEJECT_NAME) $(PROJECT_VERSION)$(RESET)"
@echo -e -n "$(DIM)"
@python setup.py sdist --dist-dir=dist
@echo -e -n "$(RESET)"
.PHONY: clean, clean-pyc, clean-build
clean: clean-pyc clean-build
clean-pyc:
@echo -e "Cleaning python file artefacts"
@find . -name '*.pyc' -exec rm -f {} +
@find . -name '*.pyo' -exec rm -f {} +
@find . -name '*~' -exec rm -f {} +
@find . -name '__pycache__' -exec rm -fr {} +
clean-build:
@echo -e "Removing build.."
@rm -fr build/
@echo -e "Removing dist.."
@rm -fr dist/
@echo -e "Removing eggs.."
@rm -fr .eggs/
@find . -name '*.egg-info' -exec rm -fr {} +
@find . -name '*.egg' -exec rm -rf {} +
.PHONY: lint, lint-black, lint-pylama, isort
lint: lint-pylama lint-black isort
lint-black:
@echo -e "linting with black.."
@pipenv run black . --line-length=100 --check --exclude /migrations
lint-pylama:
@echo -e "linting with pylama.."
@pipenv run pylama
isort:
@echo -e "Sorting all imports.."
@pipenv run isort . --settings-path=setup.cfg
.PHONY: bandit
bandit:
@echo -e "analysing code for security issues.."
@pipenv run bandit -r unicef-dssg -ll -ii
test:
pytest -vv -s -vv tests/
test-db:
pytest -vv -s -vv tests/
test-cov:
pytest -vv -s --cov=unicef-dssg --cov-report html