-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (42 loc) · 1.54 KB
/
Makefile
File metadata and controls
57 lines (42 loc) · 1.54 KB
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
PROJECT := quantum-eigenfaces
PACKAGE := src
MODULES := $(wildcard $(PACKAGE)/*.py)
# MAIN TASKS ##################################################################
.PHONY: shell
shell: install ## Launch an IPython session
poetry run ipython --ipython-dir=notebooks
.PHONY: kernel
kernel: install
source .venv/bin/activate # or set VIRTUAL_ENV; use the proper activation method for things other than interactive shells
poetry install # will use the active environment
python -m ipykernel install --user --name $(PROJECT) --display-name "$(PROJECT)"
# PROJECT DEPENDENCIES ########################################################
VIRTUAL_ENV ?= .venv
DEPENDENCIES := $(VIRTUAL_ENV)/.poetry-$(shell bin/checksum pyproject.toml poetry.lock)
.PHONY: install
install: $(DEPENDENCIES) .cache
$(DEPENDENCIES): poetry.lock
@ rm -rf $(VIRTUAL_ENV)/.poetry-*
@ poetry config virtualenvs.in-project true
poetry install
@ touch $@
ifndef CI
poetry.lock: pyproject.toml
poetry lock --no-update
@ touch $@
endif
.cache:
@ mkdir -p .cache
# CLEANUP #####################################################################
.PHONY: clean-all
clean-all: .clean-install
rm -rf $(VIRTUAL_ENV)
.PHONY: .clean-install
.clean-install:
find $(PACKAGE) $(PACKAGE)/tests -name '__pycache__' -delete
rm -rf *.egg-info
# HELP ########################################################################
.PHONY: help
help: install
@ grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help