forked from SMTorg/smt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
137 lines (124 loc) · 4.01 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
"""
Author: Dr. John T. Hwang <[email protected]>
Dr. Mohamed A. Bouhlel <[email protected]>
Remi Lafage <[email protected]>
This package is distributed under New BSD license.
"""
from __future__ import print_function
from setuptools import setup, Extension
import os
import sys
from subprocess import call
from smt import __version__
CLASSIFIERS = """\
Development Status :: 5 - Production/Stable
Intended Audience :: Science/Research
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Programming Language :: C++
Programming Language :: Python
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: Implementation :: CPython
Topic :: Software Development
Topic :: Scientific/Engineering
Operating System :: Microsoft :: Windows
Operating System :: Unix
Operating System :: MacOS
"""
LONG_DESCRIPTION = """
The surrogate modeling toolbox (SMT) is a Python package that contains
a collection of surrogate modeling methods, sampling techniques, and
benchmarking functions. This package provides a library of surrogate
models that is simple to use and facilitates the implementation of additional methods.
SMT is different from existing surrogate modeling libraries because of
its emphasis on derivatives, including training derivatives used for
gradient-enhanced modeling, prediction derivatives, and derivatives
with respect to the training data. It also includes new surrogate models
that are not available elsewhere: kriging by partial-least squares reduction
and energy-minimizing spline interpolation.
"""
try:
import numpy as np
except ImportError:
print("Numpy import failed: please install numpy module")
exit(-1)
try:
import Cython
except ImportError:
print("Cython import failed: try to install it using pip module...")
import pip
pip.main(["install", "Cython"])
from Cython.Build import cythonize
extra_compile_args = []
if not sys.platform.startswith("win"):
extra_compile_args.append("-std=c++11")
ext = (
cythonize(
Extension(
"smt.surrogate_models.rbfclib",
sources=["smt/src/rbf/rbf.cpp", "smt/src/rbf/rbfclib.pyx"],
language="c++",
extra_compile_args=extra_compile_args,
include_dirs=[np.get_include()],
)
)
+ cythonize(
Extension(
"smt.surrogate_models.idwclib",
sources=["smt/src/idw/idw.cpp", "smt/src/idw/idwclib.pyx"],
language="c++",
extra_compile_args=extra_compile_args,
include_dirs=[np.get_include()],
)
)
+ cythonize(
Extension(
"smt.surrogate_models.rmtsclib",
sources=[
"smt/src/rmts/rmtsclib.pyx",
"smt/src/rmts/utils.cpp",
"smt/src/rmts/rmts.cpp",
"smt/src/rmts/rmtb.cpp",
"smt/src/rmts/rmtc.cpp",
],
language="c++",
extra_compile_args=extra_compile_args,
include_dirs=[np.get_include()],
)
)
)
metadata = dict(
name="smt",
version=__version__,
description="The Surrogate Modeling Toolbox (SMT)",
long_description=LONG_DESCRIPTION,
author="Mohamed Amine Bouhlel et al.",
author_email="[email protected]",
license="BSD-3",
classifiers=[_f for _f in CLASSIFIERS.split("\n") if _f],
packages=[
"smt",
"smt.surrogate_models",
"smt.problems",
"smt.sampling_methods",
"smt.utils",
"smt.utils.neural_net",
"smt.applications",
],
install_requires=[
"scikit-learn",
"pyDOE2",
"matplotlib",
"numpydoc",
"six>=1.10",
"scipy",
],
python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*",
zip_safe=False,
ext_modules=ext,
url="https://github.com/SMTorg/smt", # use the URL to the github repo
download_url="https://github.com/SMTorg/smt/releases",
)
setup(**metadata)