-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
180 lines (147 loc) · 4.62 KB
/
Makefile
File metadata and controls
180 lines (147 loc) · 4.62 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# Makefile for Python project
.DELETE_ON_ERROR:
.PHONY: FORCE
.PRECIOUS:
.SUFFIXES:
SHELL:=/bin/bash -e -o pipefail
SELF:=$(firstword $(MAKEFILE_LIST))
PKG=anyvlm
PKGD=$(subst .,/,${PKG})
PYV:=3.11
VEDIR=venv/${PYV}
UNAME = $(shell uname)
ifeq (${UNAME},Darwin)
_XRM_R:=
else
_XRM_R:=r
endif
XRM=xargs -0${_XRM_R} rm
############################################################################
#= BASIC USAGE
default: help
#=> help: display this help message
help:
@echo ""
@echo "Available targets:"
@echo ""
@grep -E '^#=> ' $(SELF) | \
sed -E 's/^#=>[[:space:]]*//' | \
awk -F: '{ printf " %-20s %s\n", $$1, $$2 }'
@echo ""
############################################################################
#= SETUP, INSTALLATION, PACKAGING
#=> venv: make a Python 3 virtual environment & install basic dependencies
.PHONY: venv/%
venv/%:
python$* -m venv $@; \
. $@/bin/activate; \
python -m ensurepip --upgrade; \
pip install --upgrade pip setuptools; \
pip install .
#=> develop: install package in develop mode
.PHONY: develop
develop:
pip install -e .[test]
#=> devready: create venv, install prerequisites, install pkg in develop mode
.PHONY: devready
devready:
make ${VEDIR} && source ${VEDIR}/bin/activate && make develop
@echo '################################################################'
@echo '### `source ${VEDIR}/bin/activate` to use this environment ###'
@echo '################################################################'
#=> install: install package
#=> bdist bdist_egg bdist_wheel build sdist: distribution options
.PHONY: bdist bdist_egg bdist_wheel build build_sphinx sdist install
bdist bdist_egg bdist_wheel build sdist install: %:
python setup.py $@
############################################################################
#= TESTING
# see test configuration in setup.cfg
.PHONY: testready
testready:
pip install -e '.[postgres,queueing,test]'
#=> test: execute tests
.PHONY: test
test:
python -m pytest tests
#=> cqa: execute code quality tests
cqa:
ruff format --check
ruff check
#=> reformat: reformat code
.PHONY: reformat
reformat:
ruff check --fix
ruff format
############################################################################
#= CLEANUP
#=> clean: remove temporary and backup files
.PHONY: clean
clean:
find . \( -name \*~ -o -name \*.bak \) -print0 | ${XRM}
#=> cleaner: remove files and directories that are easily rebuilt
.PHONY: cleaner
cleaner: clean
rm -rf .cache *.egg-info .pytest_cache build dist doc/_build htmlcov
find . \( -name \*.pyc -o -name \*.orig -o -name \*.rej \) -print0 | ${XRM} -fr
find . -name __pycache__ -print0 | ${XRM} -fr
rm -fvr .ruff_cache
#=> cleanest: remove files and directories that require more time/network fetches to rebuild
.PHONY: cleanest
cleanest: cleaner
rm -fr .eggs .venv
############################################################################
#= DOCKER COMPOSE
#=> volumes: create required Docker volumes
.PHONY: volumes
volumes:
docker volume create anyvlm_vol
docker volume create seqrepo_vol
docker volume create uta_vol
docker volume create anyvar_vol
#=> up: start AnyVLM and required AnyVar services (foreground)
.PHONY: up
up:
docker compose -f compose.yaml -f compose.anyvar.yaml up
#=> up-d: start AnyVLM and required AnyVar services (detached)
.PHONY: up-d
up-d:
docker compose -f compose.yaml -f compose.anyvar.yaml up -d
#=> up-dev: start development stack for AnyVLM and required AnyVar services (foreground)
.PHONY: up-dev
up-dev:
docker compose -f compose.dev.yaml -f compose.anyvar.yaml up
#=> up-dev-d: start development stack for AnyVLM and required AnyVar services (detached)
.PHONY: up-dev-d
up-dev-d:
docker compose -f compose.dev.yaml -f compose.anyvar.yaml up -d
#=> up-dev-build: rebuild image and start development stack for AnyVLM and required AnyVar services (foreground)
.PHONY: up-dev-build
up-dev-build:
docker compose -f compose.dev.yaml -f compose.anyvar.yaml up --build
#=> up-dev-build: rebuild image and start development stack for AnyVLM and required AnyVar services (foreground)
.PHONY: up-dev-build-d
up-dev-build-d:
docker compose -f compose.dev.yaml -f compose.anyvar.yaml up -d --build
#=> up-test: start services required for tests
.PHONY: up-test
up-test:
docker compose -f compose.test.yaml up
#=> stop: stop all AnyVLM-related services (containers preserved)
.PHONY: stop
stop:
docker compose \
-f compose.yaml \
-f compose.dev.yaml \
-f compose.anyvar.yaml \
-f compose.test.yaml \
stop
#=> down: stop and remove all AnyVLM-related containers
.PHONY: down
down:
docker compose \
-f compose.yaml \
-f compose.dev.yaml \
-f compose.anyvar.yaml \
-f compose.test.yaml \
down