-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (42 loc) · 1.15 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
SHELL = /bin/bash
VENV_DIR = .venv
POETRY_DIR = .poetry
PYTHON_VERSION = 3.11
PYTHON = $(VENV_DIR)/bin/python
POETRY = $(POETRY_DIR)/bin/poetry
PIP = $(POETRY_DIR)/bin/pip
# COLOURS
COLOUR_GREEN=\033[0;32m
COLOUR_RED=\033[0;31m
COLOUR_BLUE=\033[0;34m
COLOUR_END=\033[0m
.DEFAULT_GOAL = help
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; \
printf "\nUsage: make\n\nTargets:\n"} \
/^[a-zA-Z_-]+:.*?##/ \
{ printf "$(COLOUR_BLUE)%-15s$(COLOUR_END) %s\n", $$1, $$2 }' \
$(MAKEFILE_LIST)
.python-version:
@brew upgrade pyenv --quiet
@pyenv install $(PYTHON_VERSION) --skip-existing
@pyenv local $(PYTHON_VERSION)
$(POETRY_DIR):
@python -m venv $(POETRY_DIR)
@$(PIP) install pip --upgrade --quiet
@$(PIP) install wheel --quiet
@$(PIP) install poetry==1.4.1 --quiet
$(VENV_DIR): $(POETRY_DIR)
@$(POETRY) install --no-interaction
.PHONY = _venv venv
_venv: .python-version \
$(VENV_DIR)
venv: _venv ## Create environment
.PHONY = clean
clean: ## Clean up environment
@rm -rf $(VENV_DIR)
@rm -rf $(POETRY_DIR)
@rm -f poetry.lock
@rm -f .python-version
@find . | grep __pycache__ | xargs rm -rf
@find . | grep .ipynb_checkpoints | xargs rm -rf