-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
203 lines (187 loc) · 6.92 KB
/
pyproject.toml
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# Poetry pyproject.toml: https://python-poetry.org/docs/pyproject/
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "nearness"
version = "0.1.2"
description = "An easy-to-use interface for (approximate) nearest neighbors algorithms."
readme = "README.md"
authors = ["David Muhr <[email protected]>"]
license = "MIT"
repository = "https://github.com/davnn/nearness"
packages = [{ include = "nearness", from = "src" }]
# Pypi classifiers: https://pypi.org/classifiers/
classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: MIT License",
"Topic :: Software Development :: Libraries",
"Topic :: Scientific/Engineering",
"Topic :: Utilities",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Intended Audience :: Education",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3 :: Only",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: MacOS",
"Typing :: Typed"
]
[tool.poetry.dependencies]
python = ">=3.10,<3.13"
safecheck = ">=0.3,<0.5"
joblib = "^1"
typing-extensions = ">=4"
numpy = { version = ">=1", optional = true }
scipy = { version = ">=1", optional = true }
scikit-learn = { version = ">=1", optional = true }
autofaiss = { version = ">=2.17", optional = true }
faiss-cpu = { version = "^1", optional = true }
annoy = { version = "^1", optional = true }
hnswlib = { version = "^0.8", optional = true }
scann = { version = "^1", optional = true, platform = "linux", markers = "python_version < '3.12'" }
jax = { version = ">=0.4", source = "pypi", extras = ["cpu"], optional = true }
torch = [
{ version = ">=1", platform = "darwin", source = "pypi", optional = true },
{ version = ">=1", platform = "win32", source = "pypi", optional = true },
{ version = ">=1", platform = "linux", source = "torch-cpu", optional = true }
]
[tool.poetry.extras]
annoy = ["annoy"]
numpy = ["numpy"]
scipy = ["scipy"]
hnswlib = ["hnswlib"]
scikit-learn = ["scikit-learn"]
autofaiss = ["autofaiss", "faiss-cpu"]
faiss = ["faiss-cpu"]
torch = ["torch"]
scann = ["scann"]
jax = ["jax"]
[tool.poetry.group.dev.dependencies]
pytest = "^8.3.3"
pytest-html = "^4.1.1"
hypothesis = "^6.112.1"
coverage = "^7.6.1"
pytest-cov = "^5.0.0"
coverage-badge = "^1.1.2"
ruff = "^0.6.5"
pre-commit = "^3.8.0"
black = "^24.8.0"
pyright = "^1.1.381"
bandit = "^1.7.9"
safety = "^3.2.7"
notebook = "^7.0.4"
pytest-benchmark = "^4.0.0"
[[tool.poetry.source]]
name = "torch-cpu"
url = "https://download.pytorch.org/whl/cpu"
priority = "explicit"
[tool.black]
# https://github.com/psf/black
target-version = ["py310"]
line-length = 120
color = true
[tool.ruff]
target-version = "py310"
line-length = 120
lint.select = ["ALL"]
lint.ignore = [
"D203", # one blank line required before class docstring
"D213", # multi line summary should start at second line
"D401", # docstrings should start with non-imperative mood
"E501", # line too long, handled by black
"F403", # disallow * import, otherwise allow at module level (F406)
"B008", # do not perform function calls in argument defaults
"S101", # do not use assert,
"PD901", # do not use 'df' as a variable name
"PLR0911", # too many return statements
"ANN101", # missing type annotations for 'self'
"D107", # missing docstring for '__init__'
"TCH", # require type checking block
"PLR0913", # too many function arguments
"F722", # syntax error forward annotations (error on jaxtyping annotation))
"UP037", # remove quotes from type annotation (format breaks jaxtyping annotations)
"F821", # undefined name (error on jaxtyping annotations)
"UP035", # deprecated import (we actually want to import from typing_extensions)
"ARG002", # unused method argument (we use the arguments in a meta-class, but ruff doesn't know)
"PLR2004", # magic values are sometimes useful
"PYI041", # use float instead of int | float, this clashes with typechecking
"E731", # no lambdas
"B905", # zip without strict arguments
"ANN401", # no typed Any
]
[tool.ruff.lint.isort]
# Combine multiple `from foo import bar as baz` statements with the same source
# (`foo`) into a single statement.
combine-as-imports = true
# Imports of the form `from foo import bar as baz` show one `import bar as baz`
# per line. Useful for __init__.py files that just re-export symbols.
force-wrap-aliases = true
[tool.ruff.lint.flake8-quotes]
docstring-quotes = "double"
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"beartype".msg = "Do not import from beartype, import from safecheck instead."
"jaxtyping".msg = "Do not import from jaxtype, import from safecheck instead."
"typing".msg = "Do not import from typing, import from typing_extensions instead."
[tool.pyright]
include = ["src/nearness"]
reportPrivateImportUsage = false
reportConstantRedefinition = true
reportDuplicateImport = true
reportFunctionMemberAccess = true
reportOptionalMemberAccess = false
reportImportCycles = true
reportIncompatibleMethodOverride = true
reportIncompatibleVariableOverride = true
reportIncompleteStub = "warning"
reportInconsistentConstructor = true
reportInvalidStubStatement = "warning"
reportMatchNotExhaustive = true
reportMissingParameterType = true
reportMissingTypeArgument = false
reportOverlappingOverload = false
reportPrivateUsage = false
reportTypeCommentUsage = "warning"
reportUnknownArgumentType = false
reportUnknownLambdaType = false
reportUnknownMemberType = false
reportUnknownParameterType = false
reportUnknownVariableType = false
reportUnnecessaryCast = true
reportUnnecessaryComparison = true
reportUnnecessaryContains = true
reportUnnecessaryIsInstance = true
reportUnnecessaryTypeIgnoreComment = true
reportUnusedClass = true
reportUnusedImport = true
reportUnusedFunction = true
reportUnusedVariable = true
reportUnusedExpression = true
reportUnusedCallResult = false
reportUntypedBaseClass = false
reportUntypedClassDecorator = false
reportUntypedFunctionDecorator = false
reportUntypedNamedTuple = false
reportCallInDefaultInitializer = false
reportImplicitStringConcatenation = true
reportMissingSuperCall = true
reportPropertyTypeMismatch = true
reportUninitializedInstanceVariable = true
reportMissingImports = false
[tool.pytest.ini_options]
# https://docs.pytest.org/en/6.2.x/customize.html#pyproject-toml
# Directories that are not visited by pytest collector:
norecursedirs = ["hooks", "*.egg", ".eggs", "dist", "build", "docs", ".tox", ".git", "__pycache__"]
addopts = ["--strict-markers", "--tb=short"]
filterwarnings = ["ignore::UserWarning", "ignore::DeprecationWarning"]
[tool.coverage.run]
source = ["tests"]
branch = true
[tool.coverage.paths]
source = ["src/nearness"]
[tool.coverage.report]
show_missing = true
exclude_lines = ["pragma: no cover", "@overload", "@abstractmethod", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]