-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpyproject.toml
More file actions
272 lines (237 loc) · 6.51 KB
/
pyproject.toml
File metadata and controls
272 lines (237 loc) · 6.51 KB
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
[project]
name = "retriever"
version = "0.1.0"
description = "A Translator KP that aims to construct responses composed of knowledge from all other KPs"
authors = [
{ name = "tokebe", email = "43009413+tokebe@users.noreply.github.com" },
]
readme = "README.md"
license = "Apache-2.0"
requires-python = ">=3.13, <3.14"
dependencies = [
"redis>=7,<8",
"httpx>=0.28.1,<0.29",
"uvicorn[standard]>=0.32.1,<0.33",
"fastapi[standard-no-fastapi-cloud-cli]>=0.118,<0.119",
"pydantic[email]>=2.10.3,<3",
"pydantic-settings>=2.6.1,<3",
"opentelemetry-instrumentation-fastapi>=0.50b0",
"opentelemetry-exporter-otlp-proto-http>=1.30.0",
"opentelemetry-instrumentation-httpx>=0.51b0",
"sentry-sdk[fastapi,httpx,loguru]>=2.45.0",
"motor>=3.7.0",
"loguru>=0.7.3",
"bmt>=1.4.6",
"pyinstrument>=5.0.1",
"pydantic-file-secrets>=0.4.4",
"pyyaml>=6.0.2",
"pymongo>=4.12.0",
"reasoner-pydantic>=6.0.0,<7",
"ruamel-yaml>=0.18.14",
"pydantic-core>=2.33.1",
"orjson>=3.11.2",
"zstandard>=0.24.0",
"ormsgpack>=1.10.0",
"uvloop>=0.21.0",
"click>=8.1.8",
"elasticsearch[async]>=8,<9",
"elastic-transport>=8,<9",
"pydgraph>=24.3.0",
"grpcio>=1.65.1",
"aiohttp>=3.9.0",
"cachetools>=5.3.1",
"msgpack>=1.1.1",
"aiofiles>=25.1.0",
"gitpython>=3.1.46",
]
[project.scripts]
retriever = "retriever.__main__:main"
[dependency-groups]
dev = [
"ruff>=0.8.2,<0.9",
"yamllint>=1.35.1,<2",
"yamlfix>=1.17.0,<2",
"taskipy>=1.14.1",
"locust>=2.33.2",
"pyinstrument>=5.0.1",
"basedpyright>=1.29.4",
"pre-commit>=4.2.0",
"deptry>=0.23.0",
"pytest>=8.4.0",
"pytest-cov>=6.2.1",
"pytest-asyncio>=1.1.0",
"bpython>=0.25",
"msgpack-types>=0.5.0",
]
[tool.uv]
config-settings = { editable_mode = "compat" }
[tool.taskipy.tasks]
# Code work
hook = "pre-commit install"
lint = 'ruff check src'
'lint:stats' = 'task lint --statistics'
'lint:watch' = 'task lint --watch'
'lint:fix' = 'task lint --fix'
typecheck = 'basedpyright src'
'typecheck:watch' = 'task typecheck --watch'
format = 'ruff format --diff src'
'format:fix' = 'ruff format src'
test = 'pytest --cov=src --cov-config=pyproject.toml --cov-report term-missing'
fixup = """
echo 'Linting...' &&
task lint:fix &&
echo 'Formatting...' &&
task format:fix &&
echo 'Static analysis...' &&
task typecheck &&
echo 'Check dependencies...' &&
deptry src &&
echo "✅ All set!"
"""
'dragonfly:start' = """
echo "starting dragonfly..." \
&& docker run \
--name test-dragonfly \
-d \
-p 6379:6379 \
--ulimit memlock=-1 \
docker.dragonflydb.io/dragonflydb/dragonfly:v1.35.0
"""
'dragonfly:stop' = 'echo "stopping dragonfly..." && docker rm --force test-dragonfly'
dragonfly = 'task dragonfly:stop && task dragonfly:start'
'mongo:start' = 'echo "starting mongodb..." && docker run --name test-mongodb -p 27017:27017 -d mongodb/mongodb-community-server:7.0-ubuntu2204'
'mongo:stop' = 'echo "stopping mongodb..." && docker rm -f test-mongodb'
mongo = 'task mongo:stop && task mongo:start'
'dbs:start' = 'task dragonfly:start && task mongo:start'
'dbs:stop' = 'task dragonfly:stop && task mongo:stop'
dbs = 'task dbs:stop && task dbs:start'
'jaeger:start' = """
echo "starting jaeger..." \
&& docker run \
-d \
--name test-jaeger \
-p 16686:16686 \
-p 4317:4317 \
-p 4318:4318 \
jaegertracing/all-in-one:1.75.0
"""
'jaeger:stop' = 'echo "stopping jaeger..." && docker rm --force test-jaeger'
'jaeger:open' = 'python -m webbrowser http://localhost:16686'
jaeger = 'task jaeger:stop && task jaeger:start'
launch = 'retriever'
'launch:debug' = """
DEBUG=true \
LOG_LEVEL=TRACE \
JOB__LOOKUP__TIER0_TIMEOUT=-1 \
JOB__LOOKUP__TIER1_TIMEOUT=-1 \
JOB__LOOKUP__TIER2_TIMEOUT=-1 \
JOB__METAKG__TIMEOUT=-1 \
WORKERS=1 \
retriever
"""
start = 'task dbs && task launch'
dev = 'task dbs && task launch:debug'
'dev:otel' = """
task jaeger \
&& task dbs \
&& sleep 1 \
&& TELEMETRY__OTEL_ENABLED=true \
TELEMETRY__OTEL_HOST=localhost \
TELEMETRY__OTEL_PORT=4318 \
launch:debug
"""
# Config work
yamllint = 'yamllint .'
yamlfix = 'yamlfix --exclude ".venv/**/*" .'
# Cleanup
rmlogs = "rm ./logs/* && echo 'Logs deleted.'"
[tool.hatch.build.targets.sdist]
include = ["src/retriever"]
[tool.hatch.build.targets.wheel]
include = ["src/retriever"]
[tool.hatch.build.targets.wheel.sources]
"src/retriever" = "retriever"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.ruff]
include = ["src/*"]
line-length = 88
indent-width = 4
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["D", "PLR2004", "ANN201"]
[tool.ruff.lint]
select = [
# All of these were carefully chosen, see https://docs.astral.sh/ruff/rules
# Pyflakes
'F',
# Pycodestyle errors, warning
'E4',
'E7',
'E9',
'W',
# isort (sort imports)
'I',
# Pydocstyle (document your code!)
'D',
# Pep8 naming conventions (but slightly less pedantic)
'N80',
# Pyupgrade (use newer conventions)
'UP',
# Flake8-bugbear
'B',
# Flake8-annotations (require type annotations)
'ANN0',
'ANN2',
# Flake8-builtins (don't overwrite builtins)
'A',
# Flake8-comprehensions
'C4',
# Flake8-logging-format
'G',
# Flake8-simplify
'SIM',
# Flake8-use-pathlib (pathlib is just better)
'PTH',
# Pylint
'PL',
# FastAPI
'FAST',
# Perflint
'PERF',
# Refurb
'FURB',
# Ruff-specific
'RUF',
]
ignore = ['D100', 'D206', 'D300']
[tool.ruff.lint.pydocstyle]
convention = 'google'
[tool.ruff.lint.flake8-comprehensions]
allow-dict-calls-with-keyword-arguments = true
[tool.ruff.format]
docstring-code-format = true
[tool.pyright]
# Make any allowable. Builtins sometimes deal in Any and aren't worth the extra modeling
reportAny = false
reportExplicitAny = false
reportUnusedCallResult = false # Just makes code look worse; Usually unused results are deliberately ignored
reportMissingTypeStubs = false # Sometimes type stubs aren't available and auto-gen is incorrect
[tool.yamlfix]
line_length = 88
[tool.deptry]
extend_exclude = ["locustfile.py", "tests"]
[tool.deptry.per_rule_ignores]
DEP002 = [
"orjson", # Used by FastAPI to speed up JSON serialization
]
[tool.pytest.ini_options]
norecursedirs = ["utils"]
[tool.coverage.run]
branch = true
relative_files = true
omit = ["tests/*"]
[tool.coverage.paths]
source = ["src"]
[tool.coverage.report]
include_namespace_packages = true