Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (68 loc) · 2.32 KB
/
Copy pathMakefile
File metadata and controls
76 lines (68 loc) · 2.32 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# .ONESHELL tells make to run each recipe line in a single shell
.ONESHELL:
# .DEFAULT_GOAL tells make which target to run when no target is specified
.DEFAULT_GOAL := all
# Specify python location in virtual environment
# Specify pip location in virtual environment
PYTHON := .venv/bin/python3
PIP := .venv/bin/pip3
venv/bin/activate: requirements.txt
# create virtual environment
python3 -m venv .venv
# make command executable
chmod +x .venv/bin/activate
# activate virtual environment
. .venv/bin/activate
activate:
# activate virtual environment
. .venv/bin/activate
install: requirements.txt # prerequisite
# install commands
# in local use
# $(PIP) install --no-cache-dir --upgrade pip &&\
# $(PIP) install --no-cache-dir -r requirements.txt
pip --no-cache-dir install --upgrade pip &&\
pip --no-cache-dir install -r requirements.txt
format: install
#format code
$(PYTHON) black *.py utils/*.py testing/*.py
clean:
# clean directory of cache files, virtual environment, and data
rm -rf __pycache__ &&\
rm -rf utils/__pycache__ &&\
rm -rf testing/__pycache__ &&\
rm -rf .pytest_cache &&\
rm -rf .venv &&\
rm updated_data/sequences.fasta
rm updated_data/sequence_metrics.csv
docstring: activate install
# format docstring
pyment -w -o numpydoc *.py
lint: activate install format
#flake8 or #pylint
$(PYTHON) pylint --disable=R,C --errors-only *.py utils/*.py testing/*.py
test: activate install format lint
#test
python -m pytest testing/*.py
run_script:
# run script: load fasta, create sequence_metrics
# calculate cosine similiarity averages
python multifastaloader.py
python load_multifasta_metrics.py
python tokenize_compare_sequences.py
docker_build: Dockerfile requirements.txt
# build the container: More important for the CI/CD
sudo docker build -t phylo-exp .
docker_run_test: Dockerfile
# linting Dockerfile
sudo docker run --rm -i hadolint/hadolint < Dockerfile
docker_run: docker_build
# run the container
sudo docker run -it -p 8888:8888 --rm phylo-exp:latest
deploy:
# add step to deploy to cloud provider if any
echo "todo"
# .PHONY tells make that these targets do not represent actual files
.PHONY: activate format clean lint test build run docker_build docker_run docker_push docker_clean docker_run_test
# what all steps to run
all: install docstring format lint test docker_build docker_run