@@ -10,24 +10,93 @@ BUCKET = {{ cookiecutter.s3_bucket }}
10
10
# COMMANDS #
11
11
# ################################################################################
12
12
13
+ # # Install Python Dependencies
13
14
requirements :
14
15
pip install -q -r requirements.txt
15
16
17
+ # # Make Dataset
16
18
data : requirements
17
19
python src/data/make_dataset.py
18
20
21
+ # # Delete all compiled Python files
19
22
clean :
20
23
find . -name " *.pyc" -exec rm {} \;
21
24
25
+ # # Lint using flake8
22
26
lint :
23
27
flake8 --exclude=lib/,bin/,docs/conf.py .
24
28
29
+ # # Upload Data to S3
25
30
sync_data_to_s3 :
26
31
aws s3 sync data/ s3://$(BUCKET ) /data/
27
32
33
+ # # Download Data from S3
28
34
sync_data_from_s3 :
29
35
aws s3 sync s3://$(BUCKET ) /data/ data/
30
36
31
37
# ################################################################################
32
38
# PROJECT RULES #
33
39
# ################################################################################
40
+
41
+
42
+
43
+ # ################################################################################
44
+ # Self Documenting Commands #
45
+ # ################################################################################
46
+
47
+ .DEFAULT_GOAL := show-help
48
+
49
+ # Inspired by <http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html>
50
+ # sed script explained:
51
+ # /^##/:
52
+ # * save line in hold space
53
+ # * purge line
54
+ # * Loop:
55
+ # * append newline + line to hold space
56
+ # * go to next line
57
+ # * if line starts with doc comment, strip comment character off and loop
58
+ # * remove target prerequisites
59
+ # * append hold space (+ newline) to line
60
+ # * replace newline plus comments by `---`
61
+ # * print line
62
+ # Separate expressions are necessary because labels cannot be delimited by
63
+ # semicolon; see <http://stackoverflow.com/a/11799865/1968>
64
+ .PHONY : show-help
65
+ show-help :
66
+ @echo " $$ (tput bold)Available rules:$$ (tput sgr0)"
67
+ @echo
68
+ @sed -n -e " /^## / { \
69
+ h; \
70
+ s/.* //; \
71
+ :doc" \
72
+ -e " H; \
73
+ n; \
74
+ s/^# # //; \
75
+ t doc" \
76
+ -e " s/:.*//; \
77
+ G; \
78
+ s/\\ n## /---/; \
79
+ s/\\ n/ /g; \
80
+ p; \
81
+ }" ${MAKEFILE_LIST} \
82
+ | LC_ALL=' C' sort --ignore-case \
83
+ | awk -F ' ---' \
84
+ -v ncol=$$(tput cols ) \
85
+ -v indent=19 \
86
+ -v col_on=" $$ (tput setaf 6)" \
87
+ -v col_off=" $$ (tput sgr0)" \
88
+ ' { \
89
+ printf " %s%*s%s " , col_on, -indent, $$ 1, col_off; \
90
+ n = split($$ 2, words, " " ); \
91
+ line_length = ncol - indent; \
92
+ for (i = 1; i < = n; i++) { \
93
+ line_length -= length(words[i]) + 1; \
94
+ if (line_length < = 0) { \
95
+ line_length = ncol - indent - length(words[i]) - 1; \
96
+ printf " \n%*s " , -indent, " " ; \
97
+ } \
98
+ printf " %s " , words[i]; \
99
+ } \
100
+ printf " \n" ; \
101
+ }' \
102
+ | more $(shell test $(shell uname) == Darwin && echo '--no-init --raw-control-chars')
0 commit comments