forked from cggh/scikit-allel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
129 lines (108 loc) · 3.97 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
# -*- coding: utf-8 -*-
from ast import literal_eval
from setuptools import setup, Extension, find_packages
try:
from Cython.setuptools import built_ext
except ImportError:
from setuptools.command.build_ext import build_ext
DISTNAME = 'scikit-allel'
PACKAGE_NAME = 'allel'
DESCRIPTION = 'A Python package for exploring and analysing genetic ' \
'variation data.'
with open('README.rst') as f:
LONG_DESCRIPTION = f.read()
MAINTAINER = 'Alistair Miles'
MAINTAINER_EMAIL = '[email protected]'
URL = 'https://github.com/cggh/scikit-allel'
DOWNLOAD_URL = 'http://pypi.python.org/pypi/scikit-allel'
LICENSE = 'MIT'
INSTALL_REQUIRES = ['cython', 'numpy', 'dask[array]']
# full installation with all optional dependencies
EXTRAS_REQUIRE = {'full': ['scipy', 'matplotlib', 'seaborn', 'pandas', 'scikit-learn',
'h5py', 'numexpr', 'bcolz', 'zarr', 'hmmlearn',
'pomegranate', 'nose']}
CLASSIFIERS = [
'Development Status :: 4 - Beta',
'License :: OSI Approved :: MIT License',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Scientific/Engineering',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Operating System :: Unix',
'Operating System :: MacOS',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
]
# noinspection PyUnresolvedReferences
def setup_extensions(metadata):
# check for cython
try:
from Cython.Build import cythonize
print('[scikit-allel] setup extensions with cython')
ext_modules = cythonize([
Extension('allel.opt.model',
sources=['allel/opt/model.pyx']
# define_macros=[('CYTHON_TRACE', 1)],
),
Extension('allel.opt.stats',
sources=['allel/opt/stats.pyx']
# define_macros=[('CYTHON_TRACE', 1)],
),
Extension('allel.opt.io_vcf_read',
sources=['allel/opt/io_vcf_read.pyx'],
# define_macros=[('CYTHON_TRACE', 1)],
),
])
except ImportError:
print('[scikit-allel] setup extensions without cython')
ext_modules = [
Extension('allel.opt.model',
sources=['allel/opt/model.c']),
Extension('allel.opt.stats',
sources=['allel/opt/stats.c']),
Extension('allel.opt.io_vcf_read',
sources=['allel/opt/io_vcf_read.c'])
]
metadata['ext_modules'] = ext_modules
class CustomBuildExtCommand(build_ext):
"""build_ext command for use when numpy headers are needed."""
def run(self):
import numpy
self.include_dirs.append(numpy.get_include())
build_ext.run(self)
def setup_package():
metadata = dict(
name=DISTNAME,
maintainer=MAINTAINER,
maintainer_email=MAINTAINER_EMAIL,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
license=LICENSE,
url=URL,
download_url=DOWNLOAD_URL,
package_dir={'': '.'},
packages=find_packages(),
package_data={'allel.test': ['data/*']},
classifiers=CLASSIFIERS,
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE,
setup_requires=[
'setuptools>18.0',
'setuptools-scm>1.5.4'
],
use_scm_version={
'version_scheme': 'guess-next-dev',
'local_scheme': 'dirty-tag',
'write_to': 'allel/version.py'
},
zip_safe=False,
cmdclass={'build_ext': CustomBuildExtCommand},
)
setup_extensions(metadata)
setup(**metadata)
if __name__ == '__main__':
setup_package()