Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
281 lines (263 loc) · 11.1 KB
/
Copy pathpyproject.toml
File metadata and controls
281 lines (263 loc) · 11.1 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
273
274
275
276
277
278
279
280
281
[build-system]
requires = ["setuptools>=64", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "lightrag-hku"
dynamic = ["version"]
authors = [
{name = "Zirui Guo"}
]
description = "LightRAG: Simple and Fast Retrieval-Augmented Generation"
readme = "README.md"
license = {text = "MIT"}
requires-python = ">=3.11"
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"aiohttp",
"configparser",
"google-api-core>=2.0.0,<3.0.0",
# The 2.0.0 floor is a resolver guard, not an API requirement: google-genai
# 2.x caps tenacity (<9.2.0 as of 2.34), and without the floor a tenacity
# bump makes uv silently fall back to google-genai 1.x, which predates its
# tenacity dependency. With the floor such a bump fails to resolve instead.
"google-genai>=2.0.0,<3.0.0",
"json_repair>=0.59.9,<1.0.0",
"nano-vectordb",
"networkx",
"numpy>=1.24.0,<3.0.0",
"packaging",
# Both pandas 2.x and 3.x are accepted. Only the Excel branch of
# aexport_data uses pandas (DataFrame/ExcelWriter/to_excel), all of
# which are unchanged in 3.x.
"pandas>=2.0.0,<4.0.0",
"pipmaster",
"pydantic",
"pypinyin",
"PyYAML>=6.0,<7.0",
"python-dotenv>=1.2.0", # 1.2 adds PYTHON_DOTENV_DISABLED (tests/__init__.py)
"setuptools",
"tenacity",
# 0.7.0 adds o200k_base, required by the default gpt-4o-mini, and is the
# oldest release whose encode_batch/decode_batch fan encode()/decode() of
# one Encoding across threads — the thread safety Tokenizer relies on.
"tiktoken>=0.7.0",
# 3.2.0 is the minimum pandas 3.x declares for its xlsxwriter Excel
# engine (pandas.compat._optional.VERSIONS).
"xlsxwriter>=3.2.0",
]
[project.optional-dependencies]
# Test framework dependencies (for CI/CD and testing)
pytest = [
"pytest>=8.4.2",
"pytest-asyncio>=1.2.0",
"pytest-xdist>=3.6.0", # local `-n auto` full-suite runs; see AGENTS.md
"pre-commit",
"ruff",
"httpx2>=2.0.0", # starlette>=1.3 testclient prefers httpx2 over httpx
"python-dotenv>=1.2.0",
]
api = [
# Core dependencies
"aiohttp",
"configparser",
"json_repair>=0.59.9,<1.0.0",
"nano-vectordb",
"networkx",
"numpy>=1.24.0,<3.0.0",
"openai>=2.0.0,<4.0.0",
# Both pandas 2.x and 3.x are accepted. Only the Excel branch of
# aexport_data uses pandas (DataFrame/ExcelWriter/to_excel), all of
# which are unchanged in 3.x.
"pandas>=2.0.0,<4.0.0",
"pipmaster",
"pydantic",
"pypinyin",
"PyYAML>=6.0,<7.0",
"python-dotenv>=1.2.0",
"setuptools",
"tenacity",
# 0.7.0 adds o200k_base, required by the default gpt-4o-mini, and is the
# oldest release whose encode_batch/decode_batch fan encode()/decode() of
# one Encoding across threads — the thread safety Tokenizer relies on.
"tiktoken>=0.7.0",
# 3.2.0 is the minimum pandas 3.x declares for its xlsxwriter Excel
# engine (pandas.compat._optional.VERSIONS).
"xlsxwriter>=3.2.0",
"google-api-core>=2.0.0,<3.0.0",
"google-genai>=2.0.0,<3.0.0",
# API-specific dependencies
"aiofiles",
"ascii_colors",
"distro",
"fastapi>=0.108", # 0.108 adds FastAPI.__call__ scope["root_path"] override; api_prefix relies on it
"httpcore",
"httpx>=0.28.1",
"jiter",
"bcrypt>=4.0.0",
"psutil",
"PyJWT>=2.15.0,<3.0.0", # security floor: GHSA-ffc3-869f-jxw9 and 13 other PyJWT advisories
# Also pypdf's AES backend for encrypted PDFs (pypdf prefers it over pycryptodome).
"cryptography>=48.0.1", # security floor: GHSA-537c-gmf6-5ccf
"python-multipart>=0.0.30", # security floor: CVE-2026-53539
"starlette>=1.3.1,<2", # security floor: CVE-2026-54283 / CVE-2026-48818 (transitive via fastapi)
"pytz",
"uvicorn",
"uvicorn-worker",
"gunicorn",
# Document processing dependencies (required for API document upload functionality)
"openpyxl>=3.0.0,<4.0.0", # XLSX processing
"pypdf>=6.21.4", # PDF processing
"python-docx>=1.1.2,<2.0.0", # DOCX processing
"python-pptx>=0.6.21,<2.0.0", # PPTX processing
"cairosvg>=2.5.0,<3.0.0", # SVG->PNG rasterization for native markdown images
"defusedxml>=0.7.0,<1.0.0", # Safer XML parser used by parser/docx
# Chunking strategies (process_options=R / V); lazy-imported by lightrag.chunker
"langchain-text-splitters>=0.3,<2",
"langchain-experimental>=0.3.2,<1", # >=0.3.2: SemanticChunker gained min_chunk_size
# NLP runtime for the native docx smart_heading engine parameter
# (sentence/NER heuristics). Language models are separate wheels pinned in
# requirements-offline-smart-heading.txt and installed via
# `lightrag-download-cache --spacy-install`.
# Capped at the minor version: spaCy models are trained per minor release
# and the pinned 3.8.0 models declare spacy_version ">=3.8.0,<3.9.0" in
# meta.json only (not in Requires-Dist), so nothing would stop a 3.9
# upgrade from silently changing NER / sentence-split decisions. Moving to
# 3.9 means swapping the model URLs in requirements-offline-smart-heading.txt
# and re-validating smart_heading. Patch releases are vetted by uv.lock:
# 3.8.14 and 3.8.15 shipped neither a cp314 wheel nor an sdist, which the
# CI Python 3.14 leg's `uv sync --locked` catches at lock-update time.
"spacy>=3.8,<3.9",
# zh_core_web_sm's tokenizer backend (the model wheel requires it but does
# not bundle it). Declared here so uv.lock and `uv sync` own it instead of
# leaving it unmanaged next to the model wheels. Exact pin, like the
# models: it does the Chinese word segmentation smart_heading's
# determinism promise rests on, and the pip-only offline path
# (requirements-offline-smart-heading.txt) does not go through uv.lock.
# SPACY_MODEL_WHEELS in lightrag/tools/download_cache.py carries the same
# pin; tests/test_requirements_sync.py keeps all copies equal.
"spacy-pkuseg==1.0.2",
]
# Offline deployment dependencies (layered design for flexibility)
offline-storage = [
# Storage backend dependencies
"faiss-cpu>=1.7.0,<2.0.0",
"redis>=5.0.1,<9.0.0",
"neo4j>=5.0.0,<7.0.0",
"pymilvus>=2.6.2,<4.0.0",
"pymongo>=4.0.0,<5.0.0",
"asyncpg>=0.31.0,<1.0.0",
"pgvector>=0.4.2,<1.0.0",
"qdrant-client>=1.11.0,<2.0.0",
"opensearch-py>=3.0.0,<4.0.0",
]
offline-llm = [
# LLM provider dependencies
"openai>=2.0.0,<4.0.0",
"anthropic>=0.18.0,<3.0.0",
"ollama>=0.5.4,<1.0.0",
"zai-sdk>=0.2.3,<1.0.0",
"aioboto3>=12.0.0,<16.0.0",
"voyageai>=0.3.7,<1.0.0",
"llama-index>=0.14.0,<1.0.0", # Updated to ensure compatibility with openai 2.x
"llama-index-llms-openai>=0.6.12", # Explicitly require version that supports openai 2.x
"google-api-core>=2.0.0,<3.0.0",
"google-genai>=2.0.0,<3.0.0",
]
offline = [
# Complete offline package (includes api for document processing, plus storage and LLM)
"lightrag-hku[api,offline-storage,offline-llm]",
]
test = [
"lightrag-hku[api]",
"pytest>=8.4.2",
"pytest-asyncio>=1.2.0",
"pytest-xdist>=3.6.0", # local `-n auto` full-suite runs; see AGENTS.md
"pre-commit",
"ruff",
"httpx2>=2.0.0", # starlette>=1.3 testclient prefers httpx2 over httpx
"python-dotenv>=1.2.0",
]
evaluation = [
"lightrag-hku[api]",
# ragas <=0.4.3 imports langchain_community.chat_models.vertexai at import
# time, a module langchain-community 0.4.2 deleted; 0.4.4 made it optional.
"ragas>=0.4.4",
"datasets>=4.3.0",
]
observability = [
# LLM observability and tracing dependencies
"langfuse>=3.8.1",
]
[project.scripts]
lightrag-repair-chunk-tracking = "lightrag.tools.chunk_tracking_repair:main"
lightrag-server = "lightrag.api.lightrag_server:main"
lightrag-gunicorn = "lightrag.api.run_with_gunicorn:main"
lightrag-hash-password = "lightrag.tools.hash_password:main"
lightrag-download-cache = "lightrag.tools.download_cache:main"
lightrag-clean-llmqc = "lightrag.tools.clean_llm_query_cache:main"
lightrag-migrate-llm-cache = "lightrag.tools.migrate_llm_cache:main"
lightrag-gc-llm-cache = "lightrag.tools.gc_llm_cache:main"
lightrag-rebuild-vdb = "lightrag.tools.rebuild_vdb:main"
lightrag-clear-storage = "lightrag.tools.clear_storage:main"
lightrag-migrate-config = "lightrag.tools.migrate_config:main"
[project.urls]
Homepage = "https://github.com/HKUDS/LightRAG"
Documentation = "https://github.com/HKUDS/LightRAG"
Repository = "https://github.com/HKUDS/LightRAG"
"Bug Tracker" = "https://github.com/HKUDS/LightRAG/issues"
[tool.setuptools.packages.find]
include = ["lightrag*"]
exclude = ["data*", "tests*", "scripts*", "examples*", "dickens*", "reproduce*", "output_complete*", "rag_storage*", "inputs*"]
[tool.setuptools]
include-package-data = true
[tool.setuptools.dynamic]
version = {attr = "lightrag._version.__version__"}
[tool.setuptools.package-data]
lightrag = ["api/webui/**/*", "api/static/**/*"]
[tool.pytest.ini_options]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
testpaths = ["tests"]
# tests/setup drives the setup wizard's shell flows and never imports lightrag,
# so plain recursive runs (`pytest`, `pytest tests`) skip it. Name it explicitly
# to run it: `pytest tests/setup`. The first nine entries are pytest's defaults,
# which setting this option replaces.
norecursedirs = [
"*.egg", ".*", "_darcs", "build", "CVS", "dist", "node_modules", "venv",
"{arch}", "tests/setup",
]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
# Python 3.12+ warns when fork() runs in a multi-threaded process. The
# real-Manager tests start shared_storage's SyncManager (fork context) inside
# the pytest process, which earlier tests have left with executor threads; in
# production that start runs in the gunicorn master before any threads exist.
# Scoped to forks multiprocessing starts; tests calling os.fork() directly
# carry their own filterwarnings mark.
filterwarnings = [
"ignore:This process .* is multi-threaded, use of fork\\(\\) may lead to deadlocks in the child:DeprecationWarning:multiprocessing.popen_fork",
]
markers = [
"offline: tests that run without any external service (default CI gate)",
"integration: tests requiring external services; skipped by default, opt in with --run-integration",
"requires_db: test needs a reachable database backend",
"requires_api: test needs a reachable external API endpoint",
"pg_smoke: integration tests that require a live PostgreSQL instance (POSTGRES_PASSWORD must be set)",
]
[tool.ruff]
target-version = "py311"
[tool.ruff.lint]
# Pin the rule set explicitly. Newer ruff releases (observed with 0.17.x)
# ship a much wider built-in default selection, so leaving `select` unset
# makes the result depend on whichever ruff an editor extension or
# pre-commit happens to bundle. This list is exactly the default of the
# ruff version pinned in .pre-commit-config.yaml (0.15.17).
select = ["E4", "E7", "E9", "F"]