forked from hmmlearn/hmmlearn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
100 lines (87 loc) · 3.23 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
# Copyright (C) 2007-2009 Cournapeau David <[email protected]>
# 2010 Fabian Pedregosa <[email protected]>
# 2014 Gael Varoquaux
# 2014-2016 Sergei Lebedev <[email protected]>
# 2018- Antony Lee
from distutils.version import LooseVersion
from io import open
import setuptools
from setuptools import Extension, find_packages, setup
from setuptools.command.build_ext import build_ext
# Added support for environment markers in install_requires.
if LooseVersion(setuptools.__version__) < "36.2":
raise ImportError("setuptools>=36.2 is required")
class build_ext(build_ext):
def finalize_options(self):
# The key point: here, Cython and numpy will have been installed by
# pip.
from Cython.Build import cythonize
import numpy as np
import numpy.distutils
self.distribution.ext_modules[:] = cythonize("**/*.pyx")
# Sadly, this part needs to be done manually.
for ext in self.distribution.ext_modules:
for k, v in np.distutils.misc_util.get_info("npymath").items():
setattr(ext, k, v)
ext.include_dirs = [np.get_include()]
super().finalize_options()
def build_extensions(self):
try:
self.compiler.compiler_so.remove("-Wstrict-prototypes")
except (AttributeError, ValueError):
pass
super().build_extensions()
setup(
name="hmmlearn",
description="Hidden Markov Models in Python with scikit-learn like API",
long_description=open("README.rst", encoding="utf-8").read(),
maintainer="Antony Lee",
url="https://github.com/hmmlearn/hmmlearn",
license="new BSD",
classifiers=[
"Development Status :: 3 - Alpha",
"License :: OSI Approved",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Topic :: Software Development",
"Topic :: Scientific/Engineering",
"Programming Language :: Cython",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
cmdclass={"build_ext": build_ext},
py_modules=[],
packages=find_packages("lib"),
package_dir={"": "lib"},
ext_modules=[Extension("", [])],
package_data={},
python_requires=">=3.5",
setup_requires=[
"Cython",
"numpy>=1.10",
"setuptools_scm>=3.3", # fallback_version.
],
use_scm_version=lambda: { # xref __init__.py
"version_scheme": "post-release",
"local_scheme": "node-and-date",
"write_to": "lib/hmmlearn/_version.py",
"fallback_version": "0+unknown",
},
install_requires=[
"numpy>=1.10", # np.broadcast_to.
"scikit-learn>=0.16", # sklearn.utils.check_array.
"scipy>=0.15", # scipy.special.logsumexp(..., keepdims=True).
],
extras_require={
"tests": ["pytest"],
"docs": ["Sphinx", "sphinx-gallery", "Pillow", "matplotlib"],
},
entry_points={
"console_scripts": [],
"gui_scripts": [],
},
)