forked from unum-cloud/usearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
100 lines (86 loc) · 3.26 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
import os
import sys
from setuptools import setup
from pybind11.setup_helpers import Pybind11Extension
compile_args = []
link_args = []
macros_args = []
if sys.platform == "linux":
compile_args.append("-std=c++17")
compile_args.append("-O3") # Maximize performance
compile_args.append("-g") # Simplify debugging
compile_args.append("-Wno-unknown-pragmas")
macros_args.append(("USEARCH_USE_NATIVE_F16", "0"))
macros_args.append(("USEARCH_USE_SIMSIMD", "1"))
macros_args.append(("USEARCH_USE_OPENMP", "1"))
compile_args.append("-fopenmp")
link_args.append("-lgomp")
if sys.platform == "darwin":
# MacOS 10.15 or higher is needed for `aligned_alloc` support.
# https://github.com/unum-cloud/usearch/actions/runs/4975434891/jobs/8902603392
compile_args.append("-mmacosx-version-min=10.15")
compile_args.append("-std=c++17")
compile_args.append("-O3") # Maximize performance
compile_args.append("-g") # Simplify debugging
compile_args.append("-Wno-unknown-pragmas")
# Linking OpenMP requires additional preparation in CIBuildWheel
# macros_args.append(("USEARCH_USE_OPENMP", "1"))
# compile_args.append("-Xpreprocessor -fopenmp")
# link_args.append("-Xpreprocessor -lomp")
if sys.platform == "win32":
compile_args.append("/std:c++17")
compile_args.append("/O2")
ext_modules = [
Pybind11Extension(
"usearch.compiled",
["python/lib.cpp"],
extra_compile_args=compile_args,
extra_link_args=link_args,
define_macros=macros_args,
),
]
__version__ = open("VERSION", "r").read().strip()
__lib_name__ = "usearch"
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, "README.md")) as f:
long_description = f.read()
setup(
name=__lib_name__,
version=__version__,
packages=["usearch"],
package_dir={"usearch": "python/usearch"},
description="Smaller & Faster Single-File Vector Search Engine from Unum",
author="Ash Vardanian",
author_email="[email protected]",
long_description=long_description,
long_description_content_type="text/markdown",
license="Apache-2.0",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Natural Language :: English",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: C++",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Java",
"Programming Language :: JavaScript",
"Programming Language :: Objective C",
"Programming Language :: Rust",
"Programming Language :: Other",
"Operating System :: MacOS",
"Operating System :: Unix",
"Operating System :: Microsoft :: Windows",
"Topic :: System :: Clustering",
"Topic :: Database :: Database Engines/Servers",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
],
include_dirs=["include", "fp16/include", "simsimd/include"],
ext_modules=ext_modules,
install_requires=[
"numpy",
"tqdm",
'ucall; python_version >= "3.9"',
],
)