-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
73 lines (67 loc) · 3.21 KB
/
Copy pathpyproject.toml
File metadata and controls
73 lines (67 loc) · 3.21 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
[project]
name = "ragkernel"
version = "0.1.0"
description = "Verifiable engineering knowledge engine for documents, CAD models, humans, and AI agents"
license = { file = "LICENSE" }
requires-python = ">=3.12,<3.14" # onnxruntime(RapidOCR 依赖)暂无 cp314 轮子,封顶避免 uv 选到 3.14 装不上
dependencies = [
"anthropic>=0.40",
"openai>=1.40",
"sentence-transformers>=3.0",
# torch/torchvision 本是传递依赖(torch 经 sentence-transformers,torchvision 经
# docling-ibm-models),这里提为直接依赖仅仅是为了让下面的 [tool.uv.sources] 生效——
# uv 的 sources 只作用于直接依赖,写给传递依赖会被静默忽略。
# 两个都要提:只固定 torch 会让 Linux 上出现 torch==2.13.0+cpu 配 PyPI 的非-cpu
# torchvision,ABI 不匹配,docling 用到 torchvision 算子时会在运行时炸。
"torch>=2.0",
"torchvision>=0.15",
"sqlite-vec>=0.1.6",
"jieba>=0.42",
"pyyaml>=6.0",
# 升级前的兼容性闸门要判 manifest 的 requires.python(PEP 440 specifier)。它本是
# torch/docling 一路带进来的传递依赖,但传递依赖一旦哪天消失,闸门只会**静默不生效**、
# 让不兼容的升级过预检——悄悄不工作比报错更糟,所以提为直接依赖。
"packaging>=23",
"flask>=3.0",
"pydantic>=2.0",
"markitdown[pdf,docx,pptx]>=0.1",
"pypdf>=4.0",
"python-docx>=1.1",
"openpyxl>=3.1",
"watchdog>=4.0",
"docling>=2.113.0",
"rapidocr-onnxruntime>=1.4.4",
"onnxruntime>=1.20.1",
"mcp>=1.27.2,<2", # MCP Server(Agent 接口);1.27.2 含 transport session↔principal 绑定安全修复,<2 避开 v2 预发布破坏性 API
]
[project.scripts]
ragkernel = "ragkernel.cli:main"
[project.optional-dependencies]
# 原生 CAD 摄取(STEP/STL)。重二进制轮子,故作可选 extra、后端内惰性导入——缺失时内核照常启动。
# STEP=OpenCASCADE(OCP) XDE;novtk 变体去掉 VTK(省 ~100MB,适合无头/离线服务端),
# 平台若无 novtk 轮子可回退 cadquery-ocp(含 VTK)。STL=trimesh(MIT,仅需 numpy)。
cad = [
"cadquery-ocp-novtk>=7.9", # 或 cadquery-ocp(含 VTK)作跨平台回退
"trimesh>=4.6",
]
dev = [
"pytest>=8.0",
]
# torch 只经 sentence-transformers 间接引入,且本项目只用 mps/cpu(embed.py、rerank.py 里
# 设备是 "mps" or "cpu",没有 CUDA 分支)。默认 PyPI 源的 Linux torch 会带 cuda-toolkit /
# nvidia-*-cu13 / triton 共几 GB,纯属浪费——固定到 CPU 源。
# marker 限 linux:macOS 的 torch 本就是统一轮子(走 MPS),不能动。
# 注意:必须落在 lockfile 上。uv sync 是 lock 驱动的,UV_TORCH_BACKEND 环境变量对它无效,
# 且 uv sync 不接受 --torch-backend(该 flag 只在 uv pip install)。
[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true
[tool.uv.sources]
torch = [{ index = "pytorch-cpu", marker = "sys_platform == 'linux'" }]
torchvision = [{ index = "pytorch-cpu", marker = "sys_platform == 'linux'" }]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["ragkernel"]