-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
58 lines (42 loc) · 1.38 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
# project settings
PROJECT_PATH := serpens
# venv settings
export PYTHONPATH := $(PROJECT_PATH):tests/fixtures
export VIRTUALENV := $(PWD)/.venv
export PATH := $(VIRTUALENV)/bin:$(PATH)
# unittest logging level
test: export LOG_LEVEL=CRITICAL
# fix make < 3.81 (macOS and old Linux distros)
ifeq ($(filter undefine,$(value .FEATURES)),)
SHELL = env PATH="$(PATH)" /bin/bash
endif
.PHONY: .env .venv
build:
python -m build
.env:
echo 'PYTHONPATH="$(PYTHONPATH)"' > .env
.venv:
python -m venv $(VIRTUALENV)
pip install --upgrade pip
clean:
rm -rf dependencies .pytest_cache .coverage .aws-sam build dist .mypy_cache *.egg-info
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=90
check:
twine check dist/*