-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.py
More file actions
135 lines (120 loc) · 4.39 KB
/
setup.py
File metadata and controls
135 lines (120 loc) · 4.39 KB
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
# flake8: noqa
import os
from setuptools import setup, Extension, find_packages
import pathlib
# workaround for numpy and Cython install dependency
# the solution is from https://stackoverflow.com/a/54138355
def my_build_ext(pars):
# import delayed:
from setuptools.command.build_ext import build_ext as _build_ext
class build_ext(_build_ext):
def finalize_options(self):
# got error `'dict' object has no attribute '__NUMPY_SETUP__'`
# Follow this solution https://github.com/SciTools/cf-units/blob/master/setup.py#L99
def _set_builtin(name, value):
if isinstance(__builtins__, dict):
__builtins__[name] = value
else:
setattr(__builtins__, name, value)
_build_ext.finalize_options(self)
# Prevent numpy from thinking it is still in its setup process:
_set_builtin('__NUMPY_SETUP__', False)
import numpy
self.include_dirs.append(numpy.get_include())
#object returned:
return build_ext(pars)
here = os.path.abspath(os.path.dirname(__file__))
# Get the long description from the README file
#with open(os.path.join(here, 'README.md')) as f:
# long_description = f.read()
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.md").read_text()
if os.name == 'nt':
extra_compile_args = ["-Ox"]
else:
extra_compile_args = ['-std=c++0x', '-pthread', '-O3']
topn_ext = Extension(
'red_string_grouper.topn.topn',
sources=[
'./red_string_grouper/topn/topn_threaded.pyx',
'./red_string_grouper/topn/topn_parallel.cpp'
],
extra_compile_args=extra_compile_args,
language='c++'
)
array_wrappers_ext = Extension(
'red_string_grouper.sparse_dot_topn.array_wrappers',
sources=[
'./red_string_grouper/sparse_dot_topn/array_wrappers.pyx',
],
extra_compile_args=extra_compile_args,
language='c++'
)
sparse_dot_topn_original_ext = Extension(
'red_string_grouper.sparse_dot_topn.sparse_dot_topn',
sources=[
'./red_string_grouper/sparse_dot_topn/sparse_dot_topn.pyx',
'./red_string_grouper/sparse_dot_topn/sparse_dot_topn_source.cpp'
],
extra_compile_args=extra_compile_args,
language='c++'
)
sparse_dot_topn_threaded_ext = Extension(
'red_string_grouper.sparse_dot_topn.sparse_dot_topn_threaded',
sources=[
'./red_string_grouper/sparse_dot_topn/sparse_dot_topn_threaded.pyx',
'./red_string_grouper/sparse_dot_topn/sparse_dot_topn_source.cpp',
'./red_string_grouper/sparse_dot_topn/sparse_dot_topn_parallel.cpp'
],
extra_compile_args=extra_compile_args,
language='c++'
)
setup(
name='red_string_grouper',
version='0.1.2',
description='Row Equivalence Discoverer (red) based on string_grouper. '
'This package finds similarities between rows of one or two tables.',
keywords='record-linkage string-comparison cosine-similarity tf-idf'
'string_grouper sparse_dot_topn python cython',
long_description=README,
long_description_content_type='text/markdown',
url='https://github.com/ParticularMiner/red_string_grouper',
download_url='https://github.com/ParticularMiner/red_string_grouper/'
'archive/refs/tags/v0.1.2.tar.gz',
author='Particular Miner',
author_email='particularminer@fake.com',
license='MIT',
setup_requires=[
# Setuptools 18.0 properly handles Cython extensions.
'setuptools>=42',
'cython>=0.29.15',
'numpy>=1.16.6', # select this version for Py2/3 compatible
'sparse_dot_topn_for_blocks>=0.3.1',
'topn>=0.0.6',
'string_grouper>=0.6.1'
],
install_requires=[
# Setuptools 18.0 properly handles Cython extensions.
'setuptools>=42',
'cython>=0.29.15',
'numpy>=1.16.6', # select this version for Py2/3 compatible
'sparse_dot_topn_for_blocks>=0.3.1',
'topn>=0.0.6',
'string_grouper>=0.6.1'
],
zip_safe=False,
packages=find_packages(),
cmdclass={'build_ext': my_build_ext},
ext_modules=[
topn_ext,
array_wrappers_ext,
sparse_dot_topn_original_ext,
sparse_dot_topn_threaded_ext
],
package_data = {
'red_string_grouper': ['./red_string_grouper/sparse_dot_topn/*.pxd']
},
include_package_data=True,
)