Gagan Bhatia commited on
Commit
838350e
1 Parent(s): 30beefa

Create Makefile

Browse files
Files changed (1) hide show
  1. Makefile +94 -0
Makefile ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .PHONY: clean dirs virtualenv lint requirements push pull reproduce
2
+
3
+ #################################################################################
4
+ # GLOBALS #
5
+ #################################################################################
6
+
7
+ PROJECT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
8
+ PYTHON_INTERPRETER = python
9
+
10
+ #################################################################################
11
+ # COMMANDS #
12
+ #################################################################################
13
+
14
+ ## Create virtualenv.
15
+ ## Activate with the command:
16
+ ## source env/bin/activate
17
+ virtualenv:
18
+ virtualenv -p $(PYTHON_INTERPRETER) env
19
+
20
+ ## Install Python Dependencies.
21
+ ## Make sure you activate the virtualenv first!
22
+ requirements:
23
+ $(PYTHON_INTERPRETER) -m pip install -U pip setuptools wheel
24
+ $(PYTHON_INTERPRETER) -m pip install -r requirements.txt
25
+
26
+ ## Create directories that are ignored by git but required for the project
27
+ dirs:
28
+ mkdir -p data/raw data/processed models
29
+
30
+ ## Delete all compiled Python files
31
+ clean:
32
+ find . -type f -name "*.py[co]" -delete
33
+ find . -type d -name "__pycache__" -delete
34
+
35
+ ## Lint using flake8
36
+ lint:
37
+ flake8 src
38
+
39
+ ## Upload Data to default DVC remote
40
+ push:
41
+ dvc push
42
+
43
+ ## Download Data from default DVC remote
44
+ pull:
45
+ dvc pull
46
+
47
+ ## Reproduce the DVC pipeline - recompute any modified outputs such as processed data or trained models
48
+ reproduce:
49
+ dvc repro eval.dvc
50
+
51
+ #################################################################################
52
+ # PROJECT RULES #
53
+ #################################################################################
54
+
55
+
56
+
57
+ #################################################################################
58
+ # Self Documenting Commands #
59
+ #################################################################################
60
+
61
+ .DEFAULT_GOAL := help
62
+
63
+ # Inspired by <http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html>
64
+ # sed script explained:
65
+ # /^##/:
66
+ # * save line in hold space
67
+ # * purge line
68
+ # * Loop:
69
+ # * append newline + line to hold space
70
+ # * go to next line
71
+ # * if line starts with doc comment, strip comment character off and loop
72
+ # * remove target prerequisites
73
+ # * append hold space (+ newline) to line
74
+ # * replace newline plus comments by `---`
75
+ # * print line
76
+ # Separate expressions are necessary because labels cannot be delimited by
77
+ # semicolon; see <http://stackoverflow.com/a/11799865/1968>
78
+ .PHONY: help
79
+ help:
80
+ @echo "$$(tput bold)Available rules:$$(tput sgr0)"
81
+ @echo
82
+ @sed -n -e "/^## / Missing" $Missing \
83
+ | LC_ALL='C' sort --ignore-case \
84
+ | awk -F '---' \
85
+ -v ncol=$$(tput cols) \
86
+ -v indent=19 \
87
+ -v col_on="$$(tput setaf 6)" \
88
+ -v col_off="$$(tput sgr0)" \
89
+ 'Missing \
90
+ printf "%s ", words[i]; \
91
+ } \
92
+ printf "\n"; \
93
+ }' \
94
+ | more $(shell test $(shell uname) = Darwin && echo '--no-init --raw-control-chars')