forked from jmschrei/pomegranate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
105 lines (98 loc) · 2.83 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
from setuptools import setup
from setuptools import Extension
from setuptools.command.build_ext import build_ext as _build_ext
# https://stackoverflow.com/a/11181607/541202
# import __builtin__ as __builtins__
try:
from Cython.Build import cythonize
except ImportError:
use_cython = False
ext = 'c'
else:
use_cython = True
ext = 'pyx'
filenames = [
"base",
"bayes",
"BayesianNetwork",
"MarkovNetwork",
"FactorGraph",
"hmm",
"gmm",
"kmeans",
"NaiveBayes",
"BayesClassifier",
"MarkovChain",
"utils",
"parallel"
]
distributions = [
'distributions',
'UniformDistribution',
'BernoulliDistribution',
'NormalDistribution',
'LogNormalDistribution',
'ExponentialDistribution',
'BetaDistribution',
'GammaDistribution',
'DiscreteDistribution',
'PoissonDistribution',
'KernelDensities',
'IndependentComponentsDistribution',
'MultivariateGaussianDistribution',
'DirichletDistribution',
'ConditionalProbabilityTable',
'JointProbabilityTable',
"NeuralNetworkWrapper"
]
if not use_cython:
extensions = [
Extension("pomegranate.{}".format( name ), [ "pomegranate/{}.{}".format(name, ext) ]) for name in filenames
] + [Extension("pomegranate.distributions.{}".format(dist), ["pomegranate/distributions/{}.{}".format(dist, ext)]) for dist in distributions]
else:
extensions = [
Extension("pomegranate.*", ["pomegranate/*.pyx"]),
Extension("pomegranate.distributions.*", ["pomegranate/distributions/*.pyx"])
]
extensions = cythonize(extensions, compiler_directives={'language_level' : "2"})
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_options(self)
# Prevent numpy from thinking it is still in its setup process:
__builtins__.__NUMPY_SETUP__ = False
import numpy
self.include_dirs.append(numpy.get_include())
setup(
name='pomegranate',
version='0.13.4',
author='Jacob Schreiber',
author_email='[email protected]',
packages=[
'pomegranate',
'pomegranate/distributions',
],
url='http://pypi.python.org/pypi/pomegranate/',
license='LICENSE.txt',
description='Pomegranate is a graphical models library for Python, implemented in Cython for speed.',
ext_modules=extensions,
cmdclass={'build_ext':build_ext},
setup_requires=[
"cython >= 0.22.1",
"numpy >= 1.8.0",
"scipy >= 0.17.0"
],
install_requires=[
"numpy >= 1.8.0",
"joblib >= 0.9.0b4",
"networkx >= 2.0",
"scipy >= 0.17.0",
"pyyaml"
],
test_suite = 'nose.collector',
package_data={
'pomegranate': ['*.pyd', '*.pxd'],
'pomegranate/distributions': ['*.pyd', '*.pxd'],
},
include_package_data=True,
zip_safe=False,
)