-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathsetup.py
executable file
·64 lines (52 loc) · 1.85 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
#!/usr/bin/env python3
import importlib.util
if importlib.util.find_spec("setuptools_scm") is None:
raise ImportError("setuptools-scm is not installed. Install it by `pip3 install setuptools-scm`")
import os
import subprocess
from os import path
from setuptools import find_packages, setup
from setuptools_scm.version import get_local_dirty_tag
def is_git_directory(path="."):
return subprocess.call(["git", "-C", path, "status"], stderr=subprocess.STDOUT, stdout=open(os.devnull, "w")) == 0
def my_local_scheme(version):
# The following is used to build release packages.
# Users should never use it.
local_version = os.getenv("PARA_ATTN_BUILD_LOCAL_VERSION")
if local_version is None:
return get_local_dirty_tag(version)
return f"+{local_version}"
def fetch_requirements():
with open("requirements.txt") as f:
reqs = f.read().strip().split("\n")
return reqs
setup(
name="para_attn",
use_scm_version={"write_to": path.join("src", "para_attn", "_version.py"), "local_scheme": my_local_scheme},
package_dir={
"": "src",
},
packages=find_packages(where="src"),
python_requires=">=3.8",
install_requires=fetch_requirements(),
extras_require={
# optional dependencies, required by some features
"all": [],
# dev dependencies. Install them by `pip3 install 'para-attn[dev]'`
"dev": [
"pre-commit",
"pytest>=7.0.0,<8.0.0", # https://github.com/pytest-dev/pytest/issues/12273
"pytest-html",
"expecttest",
"hypothesis", # Fail to import hypothesis in common_utils, tests are not derandomized
#
"transformers",
"diffusers",
"accelerate",
"peft",
"protobuf",
"sentencepiece",
"opencv-python",
],
},
)