-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
316 lines (270 loc) · 8.08 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
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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
################################################################################
# Build Configuration
################################################################################
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling", "hatch-vcs"]
################################################################################
# Project Configuration
################################################################################
[project]
name = "knowledge-chat"
dynamic = ["version"]
description = "A framework to enable retrieval augmented generation (RAG) with knowledge graphs for chat applications."
authors = [
{ name = "Moritz E. Beber", email = "[email protected]" },
]
license = "Apache-2.0"
readme = {"file" = "README.md", "content-type" = "text/markdown"}
requires-python = ">=3.12"
# Please consult https://pypi.org/classifiers/ for a full list.
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering",
"Typing :: Typed",
]
keywords = [
"genai",
"genai-chatbot",
"rag",
"graph-rag",
"knowledge-graph",
"event-sourcing",
"llm",
"langchain",
"chainlit",
"neo4j",
]
dependencies = [
"eventsourcing ~=9.3",
"langchain ~=0.3",
"langchain-community ~=0.3",
"neo4j ~=5.26",
"pydantic ~=2.9",
"pydantic-settings ~=2.6",
"structlog ~=24.4",
]
[project.optional-dependencies]
ollama = [
"langchain_ollama ~=0.2",
]
openai = [
"langchain-openai ~=0.2",
]
[project.urls]
Homepage = "https://github.com/Midnighter/knowledge-chat"
Documentation = "https://knowledge-chat.readthedocs.io"
"Source Code" = "https://github.com/Midnighter/knowledge-chat"
"Bug Tracker" = "https://github.com/Midnighter/knowledge-chat/issues"
Download = "https://pypi.org/project/knowledge-chat/#files"
################################################################################
# Tool Configuration
################################################################################
[tool.hatch.build]
only-packages = true
[tool.hatch.build.targets.wheel]
packages = ["src/knowledge_chat"]
[tool.hatch.build.hooks.vcs]
version-file = "src/knowledge_chat/_version.py"
[tool.hatch.version]
source = "vcs"
[tool.pytest.ini_options]
testpaths = ["tests"]
markers = ["raises"]
[tool.coverage.paths]
source = [
"src/knowledge_chat",
"*/site-packages/knowledge_chat",
]
[tool.coverage.run]
branch = true
parallel = true
omit = [
"src/knowledge_chat/_version.py",
]
[tool.coverage.report]
exclude_lines = ["pragma: no cover"]
precision = 2
[tool.ruff]
line-length = 88
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"D107", # 'Missing docstring in __init__' ignored because pydoclint wants us to document the class instead.
"D203", # '1 blank line required before class docstring' ignored because we want no blank line.
"D212", # 'Multi-line docstring summary should start at the first line' ignored because we want the summary to start on the second line.
"D407", # 'Missing dashed underline after section' ignored because Google style docstrings don't underline.
"ANN002", # 'Missing type annotation for {*args} in method'.
"ANN003", # 'Missing type annotation for {*kwargs} in method'.
]
exclude = [
"src/knowledge_chat/_version.py",
]
[tool.ruff.lint.extend-per-file-ignores]
"__init__.py" = [
"E401", # 'Multiple imports on one line'
"E402", # 'Module level import not at top of file'
"F401", # 'Imported but unused'
"I001", # 'Import block is un-sorted or un-formatted' ignored because we may have to import in a particular, not-alphabetical order.
]
"tests/**/*.py" = [
"S101", # 'Use of assert detected' ignored because we are using pytest.
"INP001", # 'Insecure input' ignored because we are testing.
"ANN201", # 'Missing type annotation for {return}' ignored because all tests return `None`.
"PLR2004", # 'Magic value used in comparison' ignored, as it is a common pattern in tests.
]
"example/**/*.py" = [
"INP001", # 'implicit namespace package' ignored.
]
[tool.ruff.lint.isort]
case-sensitive = true
known-first-party = ["src", "knowledge_chat"]
lines-after-imports = 2
[tool.pydoclint]
style = "google" # TODO: Other styles are possible here, like 'numpy'
arg-type-hints-in-docstring = false
check-return-types = false
check-yield-types = false
exclude = "_version.py"
[tool.mypy]
plugins = [
"pydantic.mypy",
]
# Stop mypy from complaining about missing types from imports.
#[[tool.mypy.overrides]]
#module = [
# "pandas",
#]
#ignore_missing_imports = true
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
[tool.importlinter]
root_package = "knowledge_chat"
[[tool.importlinter.contracts]]
name = "Impose the domain-driven design (DDD) code layer hierarchy, that means infrastructure > application > domain."
type = "layers"
containers = "knowledge_chat"
layers = [
"infrastructure",
"application",
"domain",
]
################################################################################
# Hatch Environments
################################################################################
[tool.hatch.env]
requires = [
"hatch-pip-compile"
]
[tool.hatch.envs.default]
installer = "uv"
[tool.hatch.envs.dev]
description = """
Development environment.
Defining a path is a workaround for PyCharm,
see https://youtrack.jetbrains.com/issue/PY-60410.
"""
extra-dependencies = [
"chainlit ~=1.3",
"humanize ~=1.0",
"pytest",
]
features = ["ollama", "openai"]
path = ".venv"
[tool.hatch.envs.style]
description = """Check the style of the codebase."""
dependencies = [
"pydoclint",
"ruff",
]
detached = true
installer = "uv"
[tool.hatch.envs.style.scripts]
docstrings = "pydoclint"
code = "ruff check {args}"
format = "ruff format {args}"
check = ["docstrings", "code"]
[tool.hatch.envs.imports]
description = """Check the adherence to DDD code layers."""
extra-dependencies = [
"import-linter",
]
features = ["ollama", "openai"]
[tool.hatch.envs.imports.scripts]
check = "lint-imports"
[tool.hatch.envs.audit]
description = """Check dependencies for security vulnerabilities."""
extra-dependencies = [
"pip-audit",
]
features = ["ollama", "openai"]
[tool.hatch.envs.audit.scripts]
check = ["pip-audit"]
[tool.hatch.envs.types]
description = """Check the static types of the codebase."""
extra-dependencies = [
"mypy",
]
features = ["ollama", "openai"]
[tool.hatch.envs.types.scripts]
check = "mypy src/knowledge_chat"
[tool.hatch.envs.docs]
description = """Build or serve the documentation."""
extra-dependencies = [
"mkdocs-material ~=9.5",
"mkdocstrings[python] ~=0.24",
"mkdocs-awesome-pages-plugin ~=2.9",
]
features = ["ollama", "openai"]
[tool.hatch.envs.docs.scripts]
build = "mkdocs build {args:--clean --strict}"
serve = "mkdocs serve {args}"
[tool.hatch.envs.install]
description = """Test the installation the package."""
dependencies = [
"pip",
"twine",
]
detached = true
installer = "uv"
[tool.hatch.envs.install.scripts]
check = [
"pip check",
"hatch build {args:--clean}",
"twine check dist/*",
]
[tool.hatch.envs.test]
description = """Run the test suite."""
extra-dependencies = [
"pytest",
"pytest-cov",
"pytest-raises",
"pytest-randomly",
"pytest-xdist",
]
features = ["ollama", "openai"]
[[tool.hatch.envs.test.matrix]]
python = ["3.12", "3.13"]
[tool.hatch.envs.test.scripts]
run = "pytest {args:--cov=knowledge_chat --cov-report=term-missing}"
[tool.hatch.envs.example]
type = "pip-compile"
lock-filename = "{root}/example/requirements.txt"
pip-compile-hashes = true
pip-compile-resolver = "uv"
pip-compile-verbose = true
extra-dependencies = [
"chainlit ~=1.3",
]
features = ["ollama"]
[tool.hatch.envs.example.scripts]
deploy = "hatch build --target wheel --clean {root}/example/dist"