-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
97 lines (92 loc) · 3.61 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Makefile for the data_mining module
SHELL=/bin/bash
PYTHON_VERSION=3.6
# You can use either venv (virtualenv) or conda env by specifying the correct argument (server=<prod, circleci, local>)
ifeq ($(server),prod)
# Use Conda
BASE=~/anaconda3/envs/data_mining
BIN=$(BASE)/bin
CLEAN_COMMAND="conda env remove -p $(BASE)"
CREATE_COMMAND="conda create --prefix $(BASE) python=$(PYTHON_VERSION) -y"
SETUP_FLAG=
DEBUG=False
else ifeq ($(server),circleci)
# Use Venv
BASE=venv
BIN=$(BASE)/bin
CLEAN_COMMAND="rm -rf $(BASE)"
CREATE_COMMAND="python$(PYTHON_VERSION) -m venv $(BASE)"
SETUP_FLAG=
DEBUG=True
else ifeq ($(server),local)
# Use Conda
BASE=~/anaconda3/envs/data_mining
BIN=$(BASE)/bin
CLEAN_COMMAND="conda env remove -p $(BASE)"
CREATE_COMMAND="conda create --prefix $(BASE) python=$(PYTHON_VERSION) -y"
# SETUP_FLAG='--local' # If you want to use this, you change it in setup.py too
DEBUG=True
else
# Use Conda
BASE=~/anaconda3/envs/data_mining
BIN=$(BASE)/bin
CLEAN_COMMAND="conda env remove -p $(BASE)"
CREATE_COMMAND="conda create --prefix $(BASE) python=$(PYTHON_VERSION) -y"
# SETUP_FLAG='--local' # If you want to use this, you change it in setup.py too
DEBUG=True
endif
all:
$(MAKE) help
help:
@echo
@echo "-----------------------------------------------------------------------------------------------------------"
@echo " DISPLAYING HELP "
@echo "-----------------------------------------------------------------------------------------------------------"
@echo "Use make <make recipe> [server=<prod|circleci|local>] to specify the server"
@echo "Prod, and local are using conda env, circleci uses virtualenv. Default: local"
@echo
@echo "make help"
@echo " Display this message"
@echo "make install [server=<prod|circleci|local>]"
@echo " Call clean delete_conda_env create_conda_env setup run_tests download_dataset"
@echo "make clean [server=<prod|circleci|local>]"
@echo " Delete all './build ./dist ./*.pyc ./*.tgz ./*.egg-info' files"
@echo "make delete_env [server=<prod|circleci|local>]"
@echo " Delete the current conda env or virtualenv"
@echo "make create_env [server=<prod|circleci|local>]"
@echo " Create a new conda env or virtualenv for the specified python version"
@echo "make setup [server=<prod|circleci|local>]"
@echo " Call setup.py install"
@echo "make run_tests [server=<prod|circleci|local>]"
@echo " Run all the tests from the specified folder"
@echo "make download_dataset [server=<prod|circleci|local>]"
@echo " Download the covid world vaccination progress dataset"
@echo "-----------------------------------------------------------------------------------------------------------"
install:
$(MAKE) clean
$(MAKE) delete_env
$(MAKE) create_env
$(MAKE) setup
$(MAKE) run_tests
$(MAKE) download_dataset
@echo "Installation Successful!"
clean:
$(PYTHON_BIN)python setup.py clean
delete_env:
@echo "Deleting virtual environment.."
eval $(DELETE_COMMAND)
create_env:
@echo "Creating virtual environment.."
eval $(CREATE_COMMAND)
run_tests:
$(BIN)/python setup.py test $(SETUP_FLAG)
setup:
$(BIN)/pip install cython
$(BIN)/python setup.py install $(SETUP_FLAG)
download_dataset:
rm -rf datasets/covid-world-vaccination-progress
install -d datasets/covid-world-vaccination-progress
$(BIN)/kaggle datasets download -d gpreda/covid-world-vaccination-progress
unzip covid-world-vaccination-progress.zip -d datasets/covid-world-vaccination-progress
rm covid-world-vaccination-progress.zip
.PHONY: help install clean delete_env create_env setup run_tests