-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
160 lines (128 loc) · 4 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
from setuptools import find_packages, setup
from setuptools.command.install import install as _install
from setuptools.command.develop import develop as _develop
import importlib
import logging
import subprocess
import distutils.cmd
class DepsCommand(distutils.cmd.Command):
"""Custom command to install dependencies only, this
is intended to be used to take advantage of Docker's
caching.
This installs into the user home so don't run it locally, use
"pip install .[dev]" inside a virtual environment instead
"""
description = "Install dependencies"
user_options = [
# The format is (long option, short option, description).
("env=", None, "Name of environment")
]
def initialize_options(self):
self.env = ""
def finalize_options(self):
if self.env:
assert self.env in ["dev"], "env: {} not available".format(self.env)
def run(self):
command = ["pip", "install", "--user"]
command.extend(install_requires)
if self.env:
command.extend(extras["dev"])
self.announce(
"Running command: %s" % " ".join(command), level=distutils.log.INFO
)
subprocess.check_call(command)
def _safe_read_lines(f):
with open(f) as in_f:
r = in_f.readlines()
r = [l.strip() for l in r]
return r
console_scripts = [
"simulate-cancer-cells=neoag_dt.cli.simulate_neoag_cancer_cells:main",
"optimize-vaccine-ilp=neoag_dt.cli.optimize_vaccine_ilp:main",
"create-bar-chart=neoag_dt.cli.create_selected_vaccine_element_bar_chart:main",
"evaluate-vaccine-response=neoag_dt.cli.evaluate_vaccine_response:main"
]
install_requires = _safe_read_lines("./requirements.txt")
tests_require = [
'pytest',
'coverage',
'pytest-cov',
'coveralls',
'pytest-runner',
'pylint'
]
gpu_requires = []
docs_require = [
'sphinx==3.5.4',
'sphinx_rtd_theme',
'Jinja2<3.1'
]
all_requires = (
tests_require +
gpu_requires +
docs_require
)
extras = {
'test': tests_require,
'gpu': gpu_requires,
'docs': docs_require,
'all': all_requires
}
classifiers = [
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
]
def _post_install(self):
import site
importlib.reload(site)
class my_install(_install):
def run(self):
level = logging.getLevelName("INFO")
logging.basicConfig(level=level,
format='%(levelname)-8s : %(message)s')
_install.run(self)
_post_install(self)
class my_develop(_develop):
def run(self):
level = logging.getLevelName("INFO")
logging.basicConfig(level=level,
format='%(levelname)-8s : %(message)s')
_develop.run(self)
_post_install(self)
def readme():
with open('README.md') as f:
return f.read()
def description():
description = ("This package contains a digital twin approach for "
"designing personalized cancer vaccines.")
return description
setup(
name='neoag-dt',
version='1.0',
description=description(),
long_description=readme(),
keywords="peptide epitope immunogenicity mhc hla ",
author="Filippo Grazioli, Anja Moesch - NEC Labs Europe",
author_email="[email protected]",
license='BSD 3-clause "New" or "Revised License"',
packages=find_packages(),
install_requires=install_requires,
cmdclass={
'install': my_install, # override install
'develop': my_develop, # develop is used for pip install -e .
'deps': DepsCommand # for Docker
},
include_package_data=True,
tests_require=tests_require,
extras_require=extras,
entry_points={
'console_scripts': console_scripts
},
zip_safe=False,
classifiers=classifiers,
)