From 1e6a10ce1b21f0fc619d37b4386657a27126803d Mon Sep 17 00:00:00 2001 From: Ralph Urlus Date: Mon, 24 Jul 2023 21:15:04 +0200 Subject: [PATCH] release 0.3.5 --- setup.py | 94 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 43 deletions(-) diff --git a/setup.py b/setup.py index 3ef266c..0cebef8 100644 --- a/setup.py +++ b/setup.py @@ -2,11 +2,13 @@ import os from setuptools import setup, Extension, find_packages + # 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__'` @@ -19,72 +21,78 @@ def _set_builtin(name, value): _build_ext.finalize_options(self) # Prevent numpy from thinking it is still in its setup process: - _set_builtin('__NUMPY_SETUP__', False) + _set_builtin("__NUMPY_SETUP__", False) import numpy + self.include_dirs.append(numpy.get_include()) - #object returned: + # 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: +with open(os.path.join(here, "README.md")) as f: long_description = f.read() -if os.name == 'nt': +if os.name == "nt": extra_compile_args = ["-Ox"] else: - extra_compile_args = ['-std=c++0x', '-pthread', '-O3'] + extra_compile_args = ["-std=c++0x", "-pthread", "-O3"] -array_wrappers_ext = Extension('sparse_dot_topn.array_wrappers', - sources=[ - './sparse_dot_topn/array_wrappers.pyx', - ], - extra_compile_args=extra_compile_args, - language='c++') +array_wrappers_ext = Extension( + "sparse_dot_topn.array_wrappers", + sources=[ + "./sparse_dot_topn/array_wrappers.pyx", + ], + extra_compile_args=extra_compile_args, + language="c++", +) -original_ext = Extension('sparse_dot_topn.sparse_dot_topn', - sources=[ - './sparse_dot_topn/sparse_dot_topn.pyx', - './sparse_dot_topn/sparse_dot_topn_source.cpp' - ], - extra_compile_args=extra_compile_args, - language='c++') +original_ext = Extension( + "sparse_dot_topn.sparse_dot_topn", + sources=[ + "./sparse_dot_topn/sparse_dot_topn.pyx", + "./sparse_dot_topn/sparse_dot_topn_source.cpp", + ], + extra_compile_args=extra_compile_args, + language="c++", +) -threaded_ext = Extension('sparse_dot_topn.sparse_dot_topn_threaded', - sources=[ - './sparse_dot_topn/sparse_dot_topn_threaded.pyx', - './sparse_dot_topn/sparse_dot_topn_source.cpp', - './sparse_dot_topn/sparse_dot_topn_parallel.cpp'], - extra_compile_args=extra_compile_args, - language='c++') +threaded_ext = Extension( + "sparse_dot_topn.sparse_dot_topn_threaded", + sources=[ + "./sparse_dot_topn/sparse_dot_topn_threaded.pyx", + "./sparse_dot_topn/sparse_dot_topn_source.cpp", + "./sparse_dot_topn/sparse_dot_topn_parallel.cpp", + ], + extra_compile_args=extra_compile_args, + language="c++", +) setup( - name='sparse_dot_topn', - version='0.3.4', - description='This package boosts a sparse matrix multiplication '\ - 'followed by selecting the top-n multiplication', - keywords='cosine-similarity sparse-matrix scipy cython', + name="sparse_dot_topn", + version="0.3.5", + description="This package boosts a sparse matrix multiplication " + "followed by selecting the top-n multiplication", + keywords="cosine-similarity sparse-matrix scipy cython", long_description=long_description, - long_description_content_type='text/markdown', - url='https://github.com/ing-bank/sparse_dot_topn', - author='Zhe Sun', - author_email='ymwdalex@gmail.com', - license='Apache 2.0', + long_description_content_type="text/markdown", + url="https://github.com/ing-bank/sparse_dot_topn", + author="Zhe Sun", + author_email="ymwdalex@gmail.com", + license="Apache 2.0", install_requires=[ # select this version due to oldest_support_numpy https://github.com/scipy/oldest-supported-numpy/blob/main/setup.cfg#L54 - 'numpy>=1.14.5', - 'scipy>=1.2.3' # select this version for Py2/3 compatible + "numpy>=1.14.5", + "scipy>=1.2.3", # select this version for Py2/3 compatible ], zip_safe=False, packages=find_packages(), - cmdclass={'build_ext': my_build_ext}, + cmdclass={"build_ext": my_build_ext}, ext_modules=[array_wrappers_ext, original_ext, threaded_ext], - package_data = { - 'sparse_dot_topn': ['./sparse_dot_topn/*.pxd'] - }, - include_package_data=True, -) \ No newline at end of file + package_data={"sparse_dot_topn": ["./sparse_dot_topn/*.pxd"]}, + include_package_data=True, +)