-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
108 lines (93 loc) · 3 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
import os
import sysconfig
from setuptools import Extension, find_packages, setup
from typing import List, Optional, Tuple
from Cython.Build import cythonize
from Cython.Compiler import Options
import numpy as np
Options.fast_fail = True
PYTHON_REQUIRES = ">=3.6"
TRACE_CYTHON = bool(int(os.getenv("TRACE_CYTHON", 0)))
cython_macros: List[Tuple[str, Optional[str]]] = [
("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")
]
if TRACE_CYTHON:
cython_macros.append(("CYTHON_TRACE", None))
cython_macros.append(("CYTHON_TRACE_NOGIL", None))
cflags_list = sysconfig.get_config_var('CFLAGS')
if cflags_list is None:
cflags_list = []
extra_compile_args = set(cflags_list.split())
extra_compile_args.discard('-Wstrict-prototypes')
extra_compile_args.add('-Wno-misleading-indentation')
extra_compile_args.add("-fno-var-tracking-assignments")
extra_compile_args.add("-std=c++14")
# extra_compile_args.add("-Wfatal-errors")
extensions = [
Extension(
"*",
["src/cnnclustering/*.pyx"],
define_macros=cython_macros,
language="c++",
include_dirs=[np.get_include()],
extra_compile_args=list(extra_compile_args),
)
]
compiler_directives = {
"language_level": 3,
"embedsignature": True,
"boundscheck": False,
"wraparound": False,
"cdivision": True,
"nonecheck": False,
"linetrace": True,
"annotation_typing": False
}
extensions = cythonize(extensions, compiler_directives=compiler_directives)
with open("README.md", "r") as readme:
desc = readme.read()
sdesc = "A Python package for common-nearest-neighbours clustering"
requirements_map = {
"mandatory": "",
"optional": "-optional",
"dev": "-dev",
"docs": "-docs",
"test": "-test",
}
requirements = {}
for category, fname in requirements_map.items():
with open(f"requirements{fname}.txt") as fp:
requirements[category] = fp.read().strip().split("\n")
setup(
name="cnnclustering",
version="0.5.0",
keywords=["Density-based clustering"],
author="Jan-Oliver Joswig",
author_email="[email protected]",
description=sdesc,
long_description=desc,
long_description_content_type="text/markdown",
url="https://github.com/janjoswig/CommonNNClustering",
packages=find_packages("src"),
package_dir={"": "src"},
package_data={"cnnclustering": ["*.pxd"]},
classifiers=[
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
ext_modules=extensions,
install_requires=requirements["mandatory"],
extras_require={
"optional": requirements["optional"],
"dev": requirements["dev"],
"docs": requirements["docs"],
"test": requirements["test"],
},
zip_safe=False,
)