[project]
name = "model-agent-rag"
version = "0.19.6"
description = "Add your description here"
readme = "README.md"
authors = [
    { name = "guozr", email = "guozr1997@hotmail.com" }
]
requires-python = ">=3.12"
dependencies = [
    "agno[os]>=3.1.2",
    "chonkie>=1.7.0",
    "click>=8.5.0",
    "fastapi>=0.162.0",
    "loguru>=0.8.0",
    "openai>=3.29.0",
    "polib>=1.2.0",
    "pyarrow>=26.0.1",
    "pyjwt>=2.15.1",
    "python-dotenv>=1.2.4",
    "qdrant-client>=1.20.0",
    "ragas",
    "sqlalchemy>=2.1.6",
    "uvicorn>=0.54.0",
]

[project.scripts]
model-agent-rag = "src:main"

[tool.uv.build-backend]
module-root = ""  # 包目录即仓库根的 src/:module-name 与 project name 不同名,须显式指定
module-name = "src"

[[tool.uv.index]]
url = "https://pypi.tuna.tsinghua.edu.cn/simple"
default = true

[tool.uv.sources]
ragas = { git = "https://gh-proxy.com/https://github.com/starmountain1997/ragas", rev = "agno" }

[tool.ruff]
# 显式声明切断了向仓根 model-agent/pyproject.toml 的配置继承(那边是
# line-length=120 / py310),本子栈按 88 列走——现有代码即按 ≤88 排版
line-length = 88
target-version = "py312"
# .agents/skills/ 是第三方 agent 技能自带文件(vendored,非本仓代码),不进检查门槛
extend-exclude = [".agents"]

[tool.ruff.lint]
extend-select = [
    "I",   # isort
    "UP",  # pyupgrade
    "Q",   # flake8-quotes
    # —— 以下为「最严格不自伤」扩充(2026-11 评审定稿),取舍依据见下 ignore:
    "E", "W",            # pycodestyle 全量(默认仅 E4/E7/E9)
    "B",                 # flake8-bugbear:真 bug 模式
    "SIM", "C4", "RET", "PIE", "RSE", "FLY", "PERF", "FURB",  # 简化/性能
    "PT",                # pytest 风格
    "ASYNC", "FA", "TC",  # async / 类型标注 cast 位置
    "ICN", "TID", "N", "G", "EXE", "INP", "PGH",  # 导入规约/命名/日志/杂项
    "RUF",               # ruff 自有规则
    "BLE",               # 盲 except:代码中已多处 `noqa: BLE001` 依赖此规则
]
ignore = [
    "E501",  # 超长行:违规全在 docstring/URL 内,formatter 管不到,不强求
    "RUF001", "RUF002", "RUF003",  # 中文注释/docstring「歧义字符」——纯误报
]

[tool.ruff.lint.per-file-ignores]
# 部署目录下是容器入口/辅助脚本(web_entry.py 等),非包成员,不要求 __init__.py
"deploy/**" = ["INP001"]
# tests/ 是 pytest 收集的平铺目录,非包成员,同样豁免
"tests/**" = ["INP001"]

[tool.ty.src]
# 同 ruff:第三方 agent 技能自带文件不进检查门槛
exclude = [".agents"]

[tool.importlinter]
# 分层契约(uv run lint-imports):__init__.py 分发器与 sitecustomize 不落任何层,
# 按未匹配模块忽略;deploy/ 下入口脚本无 src 内依赖,同样不入契约。
root_packages = ["src"]

[[tool.importlinter.contracts]]
name = "corpus/manifest/schema 底座 → points/sources/ingest/agent 中层 → 顶层入口"
type = "layers"
# import-linter 约定:列表前面的层更高(可 import 后面的层,反向禁止)
layers = [
    "src.chat | src.publish | src.sync | src.eval",
    "src.ingest | src.agent",
    "src.points | src.sources",
    "src.schema | src.manifest",
    "src.corpus",
]

[tool.pytest.ini_options]
testpaths = ["tests"]  # 只收集 tests/:data/ 下上游 clone 自带 conftest.py/test_*.py,不能被扫到

[build-system]
requires = ["uv_build>=0.12.23,<0.13.0"]
build-backend = "uv_build"

[dependency-groups]
dev = [
    "hypothesis>=6.170.17",
    "import-linter>=2.17",
    "mdformat>=1.0.0",
    "memray>=1.20.0",
    "pip-audit>=2.10.1",
    "playwright>=1.64.0",
    "pytest>=9.1.1",
    "radon>=6.0.1",
    "ruff>=0.17.0",
    "ty>=0.0.86",
    "vulture>=2.16",
]