-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
57 lines (43 loc) · 1.74 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
.DEFAULT_GOAL:=help
PACKAGE = oda_wd_client
POETRY = poetry
TEST_COV_REP ?= html
# Print commands if env variable V=1
Q = $(if $(filter 1,$V),,@)
# Prefix all info lines with a blue triangle
M = $(shell printf "\033[34;1m▶\033[0m")
$POETRY: ; $(info $(M) checking POETRY...)
.venv: pyproject.toml poetry.lock ; $(info $(M) retrieving dependencies...) @ ## Install python dependencies
$Q $(POETRY) run pip install -U pip
$Q $(POETRY) install --all-extras --no-interaction
@touch $@
.PHONY: lint
lint: .venv lint-isort lint-black lint-flake8 lint-mypy ## Run all linters
.PHONY: lint-isort
lint-isort: .venv ; $(info $(M) running isort...) @ ## Run isort linter
$Q $(POETRY) run isort -c --diff $(PACKAGE)
.PHONY: lint-black
lint-black: .venv ; $(info $(M) running black...) @ ## Run black linter
$Q $(POETRY) run black --check $(PACKAGE)
.PHONY: lint-flake8
lint-flake8: .venv ; $(info $(M) running flake8...) @ ## Run flake8 linter
$Q $(POETRY) run flake8 $(PACKAGE)
.PHONY: lint-mypy
lint-mypy: .venv ; $(info $(M) running mypy...) @ ## Run mypy linter
$Q $(POETRY) run mypy $(PACKAGE)
.PHONY: fix
fix: .venv fix-isort fix-black ## Run all fixers
.PHONY: fix-isort
fix-isort: .venv ; $(info $(M) running isort...) @ ## Run isort fixer
$Q $(POETRY) run isort $(PACKAGE)
.PHONY: fix-black
fix-black: .venv ; $(info $(M) running black...) @ ## Run black fixer
$Q $(POETRY) run black $(PACKAGE)
.PHONY: test
test: .venv ; $(info $(M) running tests...) @ ## Run tests
# Placeholder for our testing
# TODO: Setup pytest and some tests
$Q $(POETRY) run python -c "import sys; sys.exit(0)"
.PHONY: release
release: lint test ; $(info $(M) running tests...) @ ## Release to PYPI
$Q $(POETRY) publish --build --username=__token__ --password=$(PYPI_TOKEN)