-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun
executable file
·72 lines (68 loc) · 1.79 KB
/
run
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
#!/bin/bash
CONDA_PREFIX=$(which conda | xargs dirname | xargs dirname)
export CONDA_PREFIX
py310bin="${CONDA_PREFIX}/envs/py3.10/bin"
jupyter(){ "${py310bin}/jupyter-nbconvert" --theme=dark --execute --to notebook --inplace "$1"; }
module(){ "${py310bin}/python" -m "$@"; }
f() {
case "$1" in
pack)
tar cf - data | split -b 99M - data.tz.
;;
configure)
f git-submodules
f create-conda-envs
f gunzip
cat data.tz.* | tar xf -
;;
create-conda-envs)
conda env create -f https://raw.githubusercontent.com/MolecularAI/aizynthfinder/master/env-users.yml
conda env create -f conda_scorers.yml
conda env create -f conda_py3.10.yml
;;
main)
shift
module main.main "$@"
;;
test)
module main.test
;;
format)
"${py310bin}/black" ./**/*.py
"${py310bin}/isort" ./**/*.py
;;
gunzip)
gzip -dk results/db.sqlite.gz
;;
pre-commit)
for NAME in db scorers; do
if [ -f results/$NAME.sqlite ]; then
gzip -f9k results/$NAME.sqlite
ls -s1h results/$NAME.sqlite* || :
git add results/$NAME.sqlite.gz
fi
done
for PYFILE in $(git diff-index --cached --name-only HEAD | grep '.py$'); do
if [ -f "$PYFILE" ]; then
"${py310bin}/black" "$PYFILE"
"${py310bin}/isort" "$PYFILE"
git add "$PYFILE"
fi
done
;;
jupyter)
jupyter stats.ipynb
jupyter stats_selected.ipynb
;;
git-submodules)
git submodule update --init --recursive
;;
conda)
conda env update --name py3.10 --file conda_py3.10.yml --prune
conda env update --name scorers --file conda_scorers.yml --prune
;;
clean)
rm results/db.sqlite
esac
}
f "$@"