This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 115
/
Makefile
53 lines (44 loc) · 1.49 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
.DEFAULT_GOAL := help
PYTHONPATH=
SHELL=/bin/bash
VENV = .venv
ifeq ($(OS),Windows_NT)
VENV_BIN=$(VENV)/Scripts
else
VENV_BIN=$(VENV)/bin
endif
install-graphviz:
ifeq ($(shell uname), Darwin) # MacOS
brew install graphviz
else ifeq ($(shell uname -o), Cygwin) # Windows
choco install graphviz
else ifeq ($(shell uname -o), GNU/Linux) # Linux
if command -v apt-get >/dev/null; then sudo apt-get install -y graphviz; fi
if command -v yum >/dev/null; then sudo yum install -y graphviz; fi
if command -v dnf >/dev/null; then sudo dnf install -y graphviz; fi
if command -v pacman >/dev/null; then sudo pacman -S --noconfirm graphviz; fi
else
@echo "Could not identify OS or appropriate package manager."
endif
.venv: ## Set up virtual environment and install requirements
python3 -m venv $(VENV)
$(MAKE) requirements
$(MAKE) install-graphviz
.PHONY: requirements
requirements: .venv ## Install/refresh all project requirements
$(VENV_BIN)/python -m pip install --upgrade pip
$(VENV_BIN)/pip install --upgrade -r requirements.txt
.PHONY: serve
serve: .venv ## Serve the docs locally
$(VENV_BIN)/mkdocs serve
.PHONY: lint
lint: .venv ## Lint code examples
# python
$(VENV_BIN)/black --check .
.PHONY: test
test: .venv ## Test Python code examples
$(VENV_BIN)/pytest
.PHONY: help
help: ## Display this help screen
@echo -e "\033[1mAvailable commands:\033[0m"
@grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}' | sort