Skip to content

Commit 7c2bfba

Browse files
committed
Adds cythonize() call to extensions in setup.py()
I've been having trouble build hdbscan on MacOS with normal python (e.g. outside of conda). It turns out that nothing was instructing the build system to actually compile the cython files. After reading the cython documentation, it seems like the easiest fix is to wrap the extensions list in cythonize(). Locally this built fine.
1 parent 356722f commit 7c2bfba

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

setup.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
HAVE_CYTHON = True
99
except ImportError as e:
1010
warnings.warn(e.args[0])
11+
cythonize = lambda ext: ext
1112
from setuptools import setup, Extension
1213
from setuptools.command.build_ext import build_ext
1314
HAVE_CYTHON = False
@@ -42,6 +43,7 @@ def run(self):
4243
sources=['hdbscan/dist_metrics.pyx'])
4344

4445

46+
4547
def readme():
4648
with open('README.rst') as readme_file:
4749
return readme_file.read()
@@ -78,12 +80,13 @@ def requirements():
7880
'license': 'BSD',
7981
'packages': ['hdbscan', 'hdbscan.tests'],
8082
'install_requires': requirements(),
81-
'ext_modules': [_hdbscan_tree,
83+
'ext_modules': cythonize([
84+
_hdbscan_tree,
8285
_hdbscan_linkage,
8386
_hdbscan_boruvka,
8487
_hdbscan_reachability,
8588
_prediction_utils,
86-
dist_metrics],
89+
dist_metrics]),
8790
'cmdclass': {'build_ext': CustomBuildExtCommand},
8891
'test_suite': 'nose.collector',
8992
'tests_require': ['nose'],

0 commit comments

Comments
 (0)