-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
75 lines (60 loc) · 1.68 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Default
all: test
.PHONY: all
CURRENT_DIR=$(shell pwd)
ifeq (,$(shell which conda))
HAS_CONDA=False
else
HAS_CONDA=True
endif
ifeq (,$(shell which git))
HAS_GIT=False
else
HAS_GIT=True
endif
## Install conda environment
install:
ifeq (True,$(HAS_CONDA))
@echo ">>> Detected conda, creating conda environment."
conda env create -f environment.yml
@echo ">>> Conda env created."
else
@echo ">>> Please install conda first: brew cask install anaconda"
endif
ifeq (True,$(HAS_GIT))
@echo ">>> Cloning numpy stubs."
git clone git@github.com:numpy/numpy-stubs.git git-deps/.
else
@echo ">>> Please install git first: brew install git"
endif
## Export conda environment
export_env:
ifeq (True,$(HAS_CONDA))
@echo ">>> Detected conda, exporting conda environment."
conda env export -n mlexps | grep -v "^prefix: " > environment.yml
@echo ">>> Conda env exported."
else
@echo ">>> Please install conda first: brew cask install anaconda"
endif
.PHONY: install export_env
typecheck:
mypy $(CURRENT_DIR)/04-exp-dde-elite
lint:
flake8
yapf:
yapf --style tox.ini -r -i .
test:
pytest 04-exp-dde-elite/
pytest 05-exp-mdn/
ci: lint typecheck test
.PHONY: typecheck yapf lint test ci
# RELEASE
release:
# The eval function evaluates a string as if it had been typed into the makefile manually
# Useful to set Makefile variable inside recipes
$(eval EXP_NUMBER := $(shell sh -c 'read -p "Experiment number: " EN; echo $$EN'))
$(eval FOLDER := $(shell ls | grep $(EXP_NUMBER)-))
zip -r $(FOLDER)/$(FOLDER).zip $(FOLDER)/results
$(eval TAG := exp-$(shell echo $(FOLDER) | cut -d'-' -f 1 ))
# hub release create -a $(FOLDER)/$(FOLDER).zip -m "results data from experiment $(FOLDER)" $(TAG)
.PHONY: release