-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
86 lines (73 loc) · 2.11 KB
/
setup.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import glob
import os
import shutil
from os import path
from typing import List
from setuptools import find_packages, setup
REQUIRES_PYTHON = ">=3.7.0"
NAME = "humanprompt"
def get_artifacts() -> List[str]:
"""
Return a list of hub to include in package for model zoo. Copy over these hub inside
humanprompt/artifacts.
"""
# Use absolute paths while symlinking.
source_hub_dir = path.join(path.dirname(path.realpath(__file__)), "hub")
destination = path.join(
path.dirname(path.realpath(__file__)),
"humanprompt",
"artifacts",
"hub",
)
# Symlink the config directory inside package to have a cleaner pip install.
# Remove stale symlink/directory from a previous build.
if path.exists(source_hub_dir):
if path.islink(destination):
os.unlink(destination)
elif path.isdir(destination):
shutil.rmtree(destination)
if not path.exists(destination):
try:
os.symlink(source_hub_dir, destination)
except OSError:
# Fall back to copying if symlink fails: ex. on Windows.
shutil.copytree(source_hub_dir, destination)
config_paths = glob.glob("hub/**/**/*.yaml", recursive=True) + glob.glob(
"hub/**/**/*.txt", recursive=True
)
return config_paths
install_requires = [
"omegaconf",
"datasets",
"transformers",
"evaluate",
"scikit-learn",
"manifest-ml",
"backoff",
"sqlparse",
]
extras_require = {
"binder": [
"binder@git+https://github.com/HKUNLP/Binder.git@humanprompt#egg=binder",
"python-Levenshtein",
],
"dev": [
"black",
"flake8",
"isort",
"mypy",
"pytest",
"pre-commit",
],
}
extras_require["all"] = list(set(sum(extras_require.values(), [])))
setup(
name=NAME,
version="0.0.1",
python_requires=REQUIRES_PYTHON,
packages=find_packages(exclude=("hub", "tests*")),
package_data={"humanprompt.artifacts": get_artifacts()},
install_requires=install_requires,
extras_require=extras_require,
include_package_data=True,
)