-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
126 lines (106 loc) · 3.5 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
"""Build GRAFIMO
"""
from setuptools import setup, find_packages, Extension
from distutils.version import LooseVersion
from distutils.command.sdist import sdist as sd
from distutils.command.build_ext import build_ext as be
import sys
try: # sphinx could not be available
from sphinx.setup_command import BuildDoc
except ImportError:
errmsg = "\n\nPlease install \"sphinx\" before installing GRAFIMO.\n"
sys.stderr.write(errmsg)
sys.exit(3)
if sys.version_info[:2] < (3,6): # python 3.7 is required
"""Check Python version.
It must be >= 3.6
"""
sys.stderr.write("Pyhton >= 3.6 is required to run GRAFIMO\n")
sys.exit(1)
# read README file
encoding_arg={"encoding": "utf-8"} if sys.version_info[0] >= 3 else dict()
readmefile = "README.md"
with open(readmefile, **encoding_arg) as infile:
long_description = infile.read()
# Cython code build
CYTHON_V_REQUIRED="0.28" # minimum Cython version required
def check_cython():
"""Check Cython version
"""
try:
from Cython import __version__ as cyv
except ImportError:
sys.stderr.write(
f"Cython not found on your machine. Install Cython >= {str(CYTHON_V_REQUIRED)}"
)
sys.exit(1)
if LooseVersion(cyv) < LooseVersion(CYTHON_V_REQUIRED):
sys.stderr.write(
f"Found Cython v{str(cyv)}. Cython v{str(CYTHON_V_REQUIRED)} is required."
)
sys.exit(1)
extensions=[
Extension("motif_processing", sources=["src/grafimo/motif_processing.pyx"]),
]
class BuildExt(be):
def run(self):
check_cython()
from Cython.Build import cythonize
self.extensions=cythonize(self.extensions)
super().run()
class SDist(sd):
def run(self):
check_cython()
from Cython.Build import cythonize
cythonize(extensions)
super().run()
name = "GRAFIMO"
version = "1.1.6"
# definition of setup()
setup(
name="grafimo",
version=version,
author="Manuel Tognon",
author_email="[email protected]",
url="https://github.com/pinellolab/GRAFIMO",
description="GRAph-based Finding of Indivividual Motif Occurrences",
long_description=long_description,
long_description_content_type="text/markdown",
license="MIT",
cmdclass={"build_ext": BuildExt, "sdist": SDist, "build_sphinx": BuildDoc},
command_options={
"build_sphinx": {
"project":("setup.py", name),
"version":("setup.py", version),
"source_dir":("setup.py", "docs")
}
},
ext_modules=extensions,
packages=find_packages("src"),
package_dir={"":"src"},
entry_points={"console_scripts":["grafimo = grafimo.__main__:main"]},
install_requires=[
"pandas>=0.24.2",
"numpy>=1.16.4",
"statsmodels>=0.11.0",
"numba>=0.47",
"sphinx>=3.5.2",
"colorama"
],
extras_require={
"dev": ["Cython"]
},
python_requires=">=3.6",
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Bio-Informatics"
],
)