-
Notifications
You must be signed in to change notification settings - Fork 22
/
setup.py
60 lines (54 loc) · 2.17 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
import setuptools
import os
import importlib
def get_requirements(path):
ret = []
with open(os.path.join(path, "requirements.txt"), encoding="utf-8") as freq:
for line in freq.readlines():
ret.append( line.strip() )
return ret
path = os.path.dirname(os.path.abspath(__file__))
requires = get_requirements(path)
print("requirements:")
print(requires)
with open('README.md', 'r') as f:
setuptools.setup(
name = 'openbackdoor',
version = '1.0.0',
description = "An open-scource toolkit for textual backdoor attack and defense.",
long_description=open("README.md", "r", encoding="utf-8").read(),
long_description_content_type="text/markdown",
author = 'Ganqu Cui, Yanyi Chen, Lifan Yuan, Bingxiang He',
author_email = 'cgq19@mails.tsinghua.edu.cn',
license="Apache",
url="https://github.com/cgq15/OpenBackdoor",
keywords = ['PLM', 'AI', 'NLP'],
python_requires=">=3.6.0",
install_requires=requires,
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
]
)
required_list = ["torch"]
for package in required_list:
try:
m = importlib.import_module(package)
except ModuleNotFoundError:
print("\n"+"="*30+" WARNING "+"="*30)
print(f"{package} is not found on your environment, please install it manually.")
print("We do not install it for you because the environment sometimes needs special care.")
optional_list = ["sklearn"]
for package in optional_list:
try:
m = importlib.import_module(package)
except ModuleNotFoundError:
print("\n"+"="*30+" WARNING "+"="*30)
print(f"{package} is not found on your environment, please install it if the specific script needs.")