Skip to content

Commit ebdf9ae

Browse files
committed
refactor: remove dead code from FAISSDocumentStore
- Remove duplicate _check_condition method (lines 111-148) - Remove unreachable comparison operator checks (lines 348-355) - Reduces codebase by 46 lines of unreachable code - All tests still passing (55 passed, 2 skipped)
1 parent e724307 commit ebdf9ae

8 files changed

Lines changed: 724 additions & 0 deletions

File tree

integrations/faiss/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# faiss-haystack
2+
3+
This package provides a [FAISS](https://github.com/facebookresearch/faiss) document store for [Haystack](https://github.com/deepset-ai/haystack).
4+
5+
## Installation
6+
7+
```bash
8+
pip install faiss-haystack
9+
```
10+
11+
## Usage
12+
13+
```python
14+
from haystack_integrations.document_stores.faiss import FAISSDocumentStore
15+
16+
document_store = FAISSDocumentStore(index_path="my_index")
17+
```

integrations/faiss/pyproject.toml

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
[build-system]
2+
requires = ["hatchling", "hatch-vcs"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "faiss-haystack"
7+
dynamic = ["version"]
8+
description = ''
9+
readme = "README.md"
10+
requires-python = ">=3.10"
11+
license = "Apache-2.0"
12+
keywords = []
13+
authors = [{ name = "Deepset", email = "info@deepset.ai" }]
14+
classifiers = [
15+
"License :: OSI Approved :: Apache Software License",
16+
"Development Status :: 4 - Beta",
17+
"Programming Language :: Python",
18+
"Programming Language :: Python :: 3.10",
19+
"Programming Language :: Python :: 3.11",
20+
"Programming Language :: Python :: 3.12",
21+
"Programming Language :: Python :: Implementation :: CPython",
22+
"Programming Language :: Python :: Implementation :: PyPy",
23+
]
24+
dependencies = [
25+
"haystack-ai>=2.24.0",
26+
"faiss-cpu>=1.8.0",
27+
"numpy",
28+
]
29+
30+
[project.urls]
31+
Documentation = "https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/faiss#readme"
32+
Issues = "https://github.com/deepset-ai/haystack-core-integrations/issues"
33+
Source = "https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/faiss"
34+
35+
[tool.hatch.build.targets.wheel]
36+
packages = ["src/haystack_integrations"]
37+
38+
[tool.hatch.version]
39+
source = "vcs"
40+
tag-pattern = 'integrations\/faiss-v(?P<version>.*)'
41+
42+
[tool.hatch.version.raw-options]
43+
root = "../.."
44+
git_describe_command = 'git describe --tags --match="integrations/faiss-v[0-9]*"'
45+
46+
[tool.hatch.envs.default]
47+
installer = "uv"
48+
dependencies = ["haystack-pydoc-tools", "ruff"]
49+
50+
[tool.hatch.envs.default.scripts]
51+
docs = ["pydoc-markdown pydoc/config_docusaurus.yml"]
52+
fmt = "ruff check --fix {args}; ruff format {args}"
53+
fmt-check = "ruff check {args} && ruff format --check {args}"
54+
55+
[tool.hatch.envs.test]
56+
dependencies = [
57+
"pytest",
58+
"pytest-cov",
59+
"pytest-rerunfailures",
60+
"mypy",
61+
"pandas",
62+
]
63+
64+
[tool.hatch.envs.test.scripts]
65+
unit = 'pytest -m "not integration" {args:tests}'
66+
integration = 'pytest -m "integration" {args:tests}'
67+
all = 'pytest {args:tests}'
68+
cov-retry = 'pytest --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x {args:tests}'
69+
70+
types = "mypy -p haystack_integrations.document_stores.faiss {args}"
71+
72+
[tool.mypy]
73+
install_types = true
74+
non_interactive = true
75+
check_untyped_defs = true
76+
disallow_incomplete_defs = true
77+
78+
[tool.hatch.metadata]
79+
allow-direct-references = true
80+
81+
[tool.ruff]
82+
line-length = 120
83+
84+
[tool.ruff.lint]
85+
select = [
86+
"A",
87+
"ARG",
88+
"B",
89+
"C",
90+
"DTZ",
91+
"E",
92+
"EM",
93+
"F",
94+
"FBT",
95+
"I",
96+
"ICN",
97+
"ISC",
98+
"N",
99+
"PLC",
100+
"PLE",
101+
"PLR",
102+
"PLW",
103+
"Q",
104+
"RUF",
105+
"S",
106+
"T",
107+
"TID",
108+
"UP",
109+
"W",
110+
"YTT",
111+
]
112+
ignore = [
113+
# Allow non-abstract empty methods in abstract base classes
114+
"B027",
115+
# Allow boolean positional values in function calls, like `dict.get(... True)`
116+
"FBT003",
117+
# Ignore checks for possible passwords
118+
"S105",
119+
"S106",
120+
"S107",
121+
# Ignore complexity
122+
"C901",
123+
"PLR0911",
124+
"PLR0912",
125+
"PLR0913",
126+
"PLR0915",
127+
# Ignore unused params
128+
"ARG002",
129+
# Allow assertions
130+
"S101",
131+
]
132+
exclude = ["example"]
133+
134+
[tool.ruff.lint.isort]
135+
known-first-party = ["haystack_integrations"]
136+
137+
[tool.ruff.lint.flake8-tidy-imports]
138+
ban-relative-imports = "parents"
139+
140+
[tool.ruff.lint.per-file-ignores]
141+
# Tests can use magic values, assertions, and relative imports
142+
"tests/**/*" = ["PLR2004", "S101", "TID252"]
143+
"example/**/*" = ["T201"]
144+
145+
[tool.coverage.run]
146+
source = ["haystack_integrations"]
147+
branch = true
148+
parallel = false
149+
150+
151+
[tool.coverage.report]
152+
omit = ["*/tests/*", "*/__init__.py"]
153+
show_missing = true
154+
exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]
155+
156+
157+
[tool.pytest.ini_options]
158+
minversion = "6.0"
159+
markers = ["integration: integration tests"]

integrations/faiss/src/haystack_integrations/__init__.py

Whitespace-only changes.

integrations/faiss/src/haystack_integrations/document_stores/__init__.py

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from .document_store import FAISSDocumentStore
2+
3+
__all__ = ["FAISSDocumentStore"]

0 commit comments

Comments
 (0)