-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (53 loc) · 1.81 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
#!/usr/bin/make -f console
MAKEFILE := $(realpath $(lastword $(MAKEFILE_LIST)))
MAKE := make
MAKEFLAGS += --no-print-directory
MAKEFLAGS += --warn-undefined-variables
.ONESHELL:
SHELL := /bin/bash
.SHELLFLAGS := -o errexit -o nounset -o pipefail -u -ec
PATH := $(PWD)/bin:$(PWD)/venv/bin:$(HOME)/go/bin:$(PATH)
PYTHONPATH := $(PWD)/venv
APT_INSTALL := sudo apt install -yyq --no-install-recommends --no-install-suggests
SYSTEM_PIP := pip3
PYTHON := $(PWD)/venv/bin/python3
PYTEST := $(PWD)/venv/bin/pytest
COVERAGE := $(PWD)/venv/bin/coverage
FLAKE8 := $(PWD)/venv/bin/flake8
BLACK := $(PWD)/venv/bin/flake8
PIP3 := $(PWD)/venv/bin/pip3
YQ := $(PWD)/venv/bin/yq -y
PIPREQS := $(PWD)/venv/bin/pipreqs
BLACK := $(PWD)/venv/bin/black
num_cpus = $(shell lscpu | awk '/^CPU.s/{ print $$2 }')
DEBUG ?= 0
ifeq ($(DEBUG), 1)
PYTESTFLAGS =-rA --log-cli-level=DEBUG
VERBOSITY=5
else
PYTESTFLAGS =--log-cli-level=CRITICAL
VERBOSITY=0
endif
.PHONY: init test requirements venv
init: venv dev requirements
source venv/bin/activate
poetry env info
lint:
poetry run black -q --check --exclude venv/ --color --diff .
test:
VERBOSE=$(VERBOSITY) $(PYTEST) -n $(num_cpus) $(PYTESTFLAGS) -vvvv tests/
# VERBOSE=$(VERBOSITY) $(PYTEST) -n $(num_cpus) $(PYTESTFLAGS) -rA -vvvv tests/ \
# --log-format="%(asctime)s %(levelname)s %(message)s" \
# --log-date-format="%Y-%m-%d %H:%M:%S" \
# --show-capture=all
venv:
pip3 install -U pip --break-system-packages
# --show-capture=all
python3 -mvenv venv/
requirements:
source venv/bin/activate
poetry install
dev:
source venv/bin/activate
$(PIP3) install poetry setuptools wheel pip
poetry check