forked from pola-rs/polars-book
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (48 loc) · 1.44 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
.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: node_modules
node_modules:
npm install
.PHONY: requirements
requirements: .venv
$(VENV_BIN)/python -m pip install --upgrade pip
$(VENV_BIN)/pip install -r requirements.txt
.PHONY: serve
serve: .venv
@unset CONDA_PREFIX && source $(VENV_BIN)/activate && mkdocs serve
.PHONY: lint
lint: .venv node_modules
# python
$(VENV_BIN)/black --check .
# js
npx rome format docs/src/node/
.PHONY: test-python
test-python: .venv
find docs/src/ -name "*.py" | xargs -n 1 sh -c 'python $$0 || exit 255'
.PHONY: test-node
test-node: node_modules
find docs/src/ -name "*.js" | xargs -n 1 sh -c 'node $$0 || exit 255'