|
4 | 4 | # LICENSE file in the root directory of this source tree.
|
5 | 5 |
|
6 | 6 | from __future__ import print_function
|
7 |
| - |
| 7 | +from setuptools import setup, find_packages |
8 | 8 | import os
|
9 |
| -import platform |
10 | 9 | import shutil
|
11 |
| - |
12 |
| -from setuptools import find_packages, setup |
| 10 | +import platform |
13 | 11 |
|
14 | 12 | # make the faiss python package dir
|
15 | 13 | shutil.rmtree("faiss", ignore_errors=True)
|
|
22 | 20 | shutil.copyfile("extra_wrappers.py", "faiss/extra_wrappers.py")
|
23 | 21 | shutil.copyfile("array_conversions.py", "faiss/array_conversions.py")
|
24 | 22 |
|
25 |
| -ext = ".pyd" if platform.system() == "Windows" else ".so" |
26 |
| -prefix = "Release/" * (platform.system() == "Windows") |
| 23 | +ext = ".pyd" if platform.system() == 'Windows' else ".so" |
| 24 | +prefix = "Release/" * (platform.system() == 'Windows') |
27 | 25 |
|
28 | 26 | swigfaiss_generic_lib = f"{prefix}_swigfaiss{ext}"
|
29 | 27 | swigfaiss_avx2_lib = f"{prefix}_swigfaiss_avx2{ext}"
|
30 | 28 | swigfaiss_avx512_lib = f"{prefix}_swigfaiss_avx512{ext}"
|
31 | 29 | callbacks_lib = f"{prefix}libfaiss_python_callbacks{ext}"
|
32 | 30 | swigfaiss_sve_lib = f"{prefix}_swigfaiss_sve{ext}"
|
33 |
| -faiss_example_external_module_lib = f"_faiss_example_external_module{ext}" |
34 | 31 |
|
35 | 32 | found_swigfaiss_generic = os.path.exists(swigfaiss_generic_lib)
|
36 | 33 | found_swigfaiss_avx2 = os.path.exists(swigfaiss_avx2_lib)
|
37 | 34 | found_swigfaiss_avx512 = os.path.exists(swigfaiss_avx512_lib)
|
38 | 35 | found_callbacks = os.path.exists(callbacks_lib)
|
39 | 36 | found_swigfaiss_sve = os.path.exists(swigfaiss_sve_lib)
|
40 |
| -found_faiss_example_external_module_lib = os.path.exists( |
41 |
| - faiss_example_external_module_lib |
42 |
| -) |
43 | 37 |
|
44 |
| -assert ( |
45 |
| - found_swigfaiss_generic or found_swigfaiss_avx2 or found_swigfaiss_avx512 or found_swigfaiss_sve or found_faiss_example_external_module_lib |
46 |
| -), ( |
47 |
| - f"Could not find {swigfaiss_generic_lib} or " |
48 |
| - f"{swigfaiss_avx2_lib} or {swigfaiss_avx512_lib} or {swigfaiss_sve_lib} or {faiss_example_external_module_lib}. " |
| 38 | +assert (found_swigfaiss_generic or found_swigfaiss_avx2 or found_swigfaiss_avx512 or found_swigfaiss_sve), \ |
| 39 | + f"Could not find {swigfaiss_generic_lib} or " \ |
| 40 | + f"{swigfaiss_avx2_lib} or {swigfaiss_avx512_lib} or {swigfaiss_sve_lib}. " \ |
49 | 41 | f"Faiss may not be compiled yet."
|
50 |
| -) |
51 | 42 |
|
52 | 43 | if found_swigfaiss_generic:
|
53 | 44 | print(f"Copying {swigfaiss_generic_lib}")
|
|
73 | 64 | shutil.copyfile("swigfaiss_sve.py", "faiss/swigfaiss_sve.py")
|
74 | 65 | shutil.copyfile(swigfaiss_sve_lib, f"faiss/_swigfaiss_sve{ext}")
|
75 | 66 |
|
76 |
| -if found_faiss_example_external_module_lib: |
77 |
| - print(f"Copying {faiss_example_external_module_lib}") |
78 |
| - shutil.copyfile( |
79 |
| - "faiss_example_external_module.py", "faiss/faiss_example_external_module.py" |
80 |
| - ) |
81 |
| - shutil.copyfile( |
82 |
| - faiss_example_external_module_lib, |
83 |
| - f"faiss/_faiss_example_external_module{ext}", |
84 |
| - ) |
85 |
| - |
86 |
| -long_description = """ |
| 67 | +long_description=""" |
87 | 68 | Faiss is a library for efficient similarity search and clustering of dense
|
88 | 69 | vectors. It contains algorithms that search in sets of vectors of any size,
|
89 | 70 | up to ones that possibly do not fit in RAM. It also contains supporting
|
|
92 | 73 | are implemented on the GPU. It is developed by Facebook AI Research.
|
93 | 74 | """
|
94 | 75 | setup(
|
95 |
| - name="faiss", |
96 |
| - version="1.9.0", |
97 |
| - description="A library for efficient similarity search and clustering of dense vectors", |
| 76 | + name='faiss', |
| 77 | + version='1.9.0', |
| 78 | + description='A library for efficient similarity search and clustering of dense vectors', |
98 | 79 | long_description=long_description,
|
99 |
| - url="https://github.com/facebookresearch/faiss", |
100 |
| - author="Matthijs Douze, Jeff Johnson, Herve Jegou, Lucas Hosseini", |
101 |
| - author_email="matthijs@meta.com", |
102 |
| - license="MIT", |
103 |
| - keywords="search nearest neighbors", |
104 |
| - install_requires=["numpy", "packaging"], |
105 |
| - packages=["faiss", "faiss.contrib", "faiss.contrib.torch"], |
| 80 | + url='https://github.com/facebookresearch/faiss', |
| 81 | + author='Matthijs Douze, Jeff Johnson, Herve Jegou, Lucas Hosseini', |
| 82 | + author_email='matthijs@meta.com', |
| 83 | + license='MIT', |
| 84 | + keywords='search nearest neighbors', |
| 85 | + |
| 86 | + install_requires=['numpy', 'packaging'], |
| 87 | + packages=['faiss', 'faiss.contrib', 'faiss.contrib.torch'], |
106 | 88 | package_data={
|
107 |
| - "faiss": ["*.so", "*.pyd"], |
| 89 | + 'faiss': ['*.so', '*.pyd'], |
108 | 90 | },
|
109 | 91 | zip_safe=False,
|
110 | 92 | )
|
0 commit comments