forked from noverde/columba
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (36 loc) · 1.26 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
# project settings
PROJECT_PATH := $(shell grep -m1 'name' setup.py | cut -f2 -d'"')
# venv settings
export PYTHONPATH := $(PROJECT_PATH)
export VIRTUALENV := $(PWD)/.venv
export PATH := $(VIRTUALENV)/bin:$(PATH)
# fix make < 3.81 (macOS and old Linux distros)
ifeq ($(filter undefine,$(value .FEATURES)),)
SHELL = env PATH="$(PATH)" /bin/bash
endif
all:
.env:
echo 'PYTHONPATH="$(PROJECT_PATH)"' > .env
.venv:
python3.7 -m venv $(VIRTUALENV)
pip install --upgrade pip
clean:
rm -rf dependencies .pytest_cache .coverage .aws-sam
find $(PROJECT_PATH) -name __pycache__ | xargs rm -rf
find tests -name __pycache__ | xargs rm -rf
install-hook:
@echo "make lint" > .git/hooks/pre-commit
@chmod +x .git/hooks/pre-commit
install-dev: .venv .env install install-hook
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
install:
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
lint:
black --line-length=100 --target-version=py38 --check .
flake8 --max-line-length=100 --ignore=E402,W503,E712 --exclude .venv,dependencies
format:
black --line-length=100 --target-version=py38 .
test:
coverage run --source=$(PROJECT_PATH) --omit=dependencies -m unittest
coverage: test .coverage
coverage report -m --fail-under=15