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