-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathget_pip_install_cmd.py
executable file
·64 lines (50 loc) · 2.01 KB
/
get_pip_install_cmd.py
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
#!/usr/bin/env python
import re
from pathlib import Path
ROOT_DIR = Path(__file__).resolve(strict=True).parents[1]
def clean_text(text):
text = text.replace(r"\n", "")
text = text.replace("\\", "")
text = re.sub(r"\s+", " ", text)
return text.strip()
def clean_notebook_text(text):
text = text.replace(' " ', "")
text = text.replace("!", "")
text = text.replace('",', "")
text = text.replace(r"\n", "")
text = text.replace(r"\"", '"')
text = text.replace("\\", "")
text = re.sub(r"\s+", " ", text)
return text.strip()
def get_match(text, command):
idx = text.index("https://pytorch-geometric.com/whl/torch-1.8.0+cu101.html")
match = text[idx - 15 : idx + len(command) - 15]
return match
command = r"""
pip install "torch==1.8.0";
pip install -f https://pytorch-geometric.com/whl/torch-1.8.0+cu101.html --default-timeout=600 \
"transformers==3.3.1" \
"torch-scatter==2.0.6" \
"torch-sparse==0.6.9" \
"torch-cluster==1.5.9" \
"torch-spline-conv==1.2.1" \
"torch-geometric==1.6.1" \
"https://gitlab.com/kimlab/kmbio/-/archive/v2.1.0/kmbio-v2.1.0.zip" \
"https://gitlab.com/kimlab/kmtools/-/archive/v0.2.8/kmtools-v0.2.8.zip" \
"https://gitlab.com/ostrokach/proteinsolver/-/archive/v0.1.25/proteinsolver-v0.1.25.zip" \
"git+https://gitlab.com/elaspic/elaspic2.git"
"""
command = clean_text(command)
with ROOT_DIR.joinpath("README.md").open("rt") as fin:
readme_text = clean_text(fin.read())
assert command in readme_text
with ROOT_DIR.joinpath("notebooks", "10_stability_demo.ipynb").open("rt") as fin:
notebook_text = clean_notebook_text(fin.read())
assert command in notebook_text
with ROOT_DIR.joinpath("notebooks", "10_affinity_demo.ipynb").open("rt") as fin:
notebook_text = clean_notebook_text(fin.read())
assert command in notebook_text
with ROOT_DIR.joinpath("notebooks", "10_multiresidue_demo.ipynb").open("rt") as fin:
notebook_text = clean_notebook_text(fin.read())
assert command in notebook_text
print(command)