forked from Datatamer/tamr-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.py
executable file
·44 lines (33 loc) · 1.42 KB
/
install.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
"""Install requirements for development of the Tamr Toolbox"""
from pathlib import Path
from subprocess import run
def main(*, python_exec: Path) -> None:
"""Pip installs project dependencies
Args:
python_exec: path to python executable
"""
run([str(python_exec), "-m", "pip", "install", "--upgrade", "pip==23.2"])
run([str(python_exec), "-m", "pip", "install", "--upgrade", "setuptools==68.0.0"])
run([str(python_exec), "-m", "pip", "install", "-r", "dev_requirements.txt"])
run([str(python_exec), "-m", "pip", "install", "-r", "optional_requirements.txt"])
run([str(python_exec), "-m", "pip", "install", "--editable", "."])
print("Tamr toolbox and development dependencies installed.")
def enforce_python_version() -> Path:
"""Returns the python executable if it meets version requirements
Returns: path to python executable
"""
import sys
py_ver = sys.version_info
fpy_ver = "{}.{}.{}".format(py_ver.major, py_ver.minor, py_ver.micro)
if py_ver.major != 3:
print(
"Error: Requires Python 3.6+. Your version:{}. "
"Try using 'python3' instead of 'python' in your command.".format(fpy_ver)
)
sys.exit(1)
elif py_ver.minor < 6:
print("Error: Requires Python 3.6+. Your version:", fpy_ver)
sys.exit(1)
return Path(sys.executable)
if __name__ == "__main__":
main(python_exec=enforce_python_version())