132 lines
3.6 KiB
TOML
132 lines
3.6 KiB
TOML
[project]
|
||
name = "rag-api"
|
||
version = "1.0.0"
|
||
description = "本地化RAG(检索增强生成)系统,基于LlamaIndex、ChromaDB和Ollama"
|
||
readme = "README.md"
|
||
requires-python = ">=3.10,<4.0"
|
||
license = {text = "MIT"}
|
||
authors = [
|
||
{name = "RAG Team"}
|
||
]
|
||
keywords = ["rag", "llamaindex", "chromadb", "ollama", "fastapi"]
|
||
classifiers = [
|
||
"Development Status :: 4 - Beta",
|
||
"Intended Audience :: Developers",
|
||
"License :: OSI Approved :: MIT License",
|
||
"Programming Language :: Python :: 3",
|
||
"Programming Language :: Python :: 3.10",
|
||
"Programming Language :: Python :: 3.11",
|
||
"Programming Language :: Python :: 3.12",
|
||
"Programming Language :: Python :: 3.13",
|
||
"Framework :: FastAPI",
|
||
]
|
||
|
||
dependencies = [
|
||
# FastAPI and server dependencies
|
||
"fastapi==0.104.1",
|
||
"uvicorn[standard]==0.24.0",
|
||
"pydantic>=2.8.0",
|
||
"pydantic-settings>=2.1.0",
|
||
# LlamaIndex core
|
||
"llama-index==0.14.8",
|
||
"llama-index-vector-stores-chroma>=0.4.2",
|
||
"llama-index-embeddings-ollama>=0.1.0",
|
||
"llama-index-llms-ollama>=0.1.0",
|
||
# Database
|
||
"chromadb>=0.5.17",
|
||
"pymysql==1.1.0",
|
||
"sqlalchemy>=2.0.40",
|
||
# Utilities
|
||
"python-dotenv==1.0.0",
|
||
"aiofiles==23.2.1",
|
||
"httpx>=0.27.0",
|
||
# Logging
|
||
"loguru==0.7.2",
|
||
# Document parsing (for file upload API)
|
||
"pypdf>=3.0.0", # PDF parsing
|
||
"pymupdf>=1.23.0", # PDF parsing (alternative, may be required by LlamaIndex)
|
||
"python-docx>=1.0.0", # Word document parsing
|
||
"docx2txt>=0.8", # Required by LlamaIndex for reading Word documents
|
||
"beautifulsoup4>=4.12.0", # HTML parsing
|
||
"lxml>=4.9.0", # HTML/XML parsing (required by beautifulsoup4 for better performance)
|
||
"pandas>=2.0.0", # CSV parsing (required by LlamaIndex for CSV files)
|
||
"markdown>=3.5.0", # Markdown parsing
|
||
# Note: Text (.txt) and JSON (.json) are handled by Python standard library, no extra dependencies needed
|
||
"rank-bm25",
|
||
]
|
||
|
||
[project.optional-dependencies]
|
||
dev = [
|
||
"pytest>=7.0.0",
|
||
"pytest-asyncio>=0.21.0",
|
||
"black>=23.0.0",
|
||
"ruff>=0.1.0",
|
||
"mypy>=1.0.0",
|
||
]
|
||
|
||
[project.urls]
|
||
Homepage = "https://github.com/your-org/rag-api"
|
||
Documentation = "https://github.com/your-org/rag-api#readme"
|
||
Repository = "https://github.com/your-org/rag-api"
|
||
Issues = "https://github.com/your-org/rag-api/issues"
|
||
|
||
[build-system]
|
||
requires = ["hatchling"]
|
||
build-backend = "hatchling.build"
|
||
|
||
[[tool.uv.index]]
|
||
name = "tuna"
|
||
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
|
||
default = true
|
||
|
||
# 配置 hatchling 不尝试打包项目(这是一个应用,不是库)
|
||
# 使用 --no-install-project 时,这个配置不会被使用,但保留以避免构建错误
|
||
[tool.hatch.build.targets.wheel]
|
||
# 不包含任何包,因为我们只是安装依赖,不安装项目本身
|
||
packages = []
|
||
|
||
[dependency-groups]
|
||
dev = [
|
||
"pytest>=7.0.0",
|
||
"pytest-asyncio>=0.21.0",
|
||
"black>=23.0.0",
|
||
"ruff>=0.1.0",
|
||
"mypy>=1.0.0",
|
||
]
|
||
|
||
[tool.black]
|
||
line-length = 100
|
||
target-version = ['py38', 'py39', 'py310', 'py311', 'py312', 'py313']
|
||
include = '\.pyi?$'
|
||
|
||
[tool.ruff]
|
||
line-length = 100
|
||
target-version = "py38"
|
||
select = [
|
||
"E", # pycodestyle errors
|
||
"W", # pycodestyle warnings
|
||
"F", # pyflakes
|
||
"I", # isort
|
||
"B", # flake8-bugbear
|
||
"C4", # flake8-comprehensions
|
||
]
|
||
ignore = [
|
||
"E501", # line too long, handled by black
|
||
"B008", # do not perform function calls in argument defaults
|
||
]
|
||
|
||
[tool.mypy]
|
||
python_version = "3.8"
|
||
warn_return_any = true
|
||
warn_unused_configs = true
|
||
disallow_untyped_defs = false
|
||
ignore_missing_imports = true
|
||
|
||
[tool.pytest.ini_options]
|
||
testpaths = ["tests"]
|
||
python_files = ["test_*.py"]
|
||
python_classes = ["Test*"]
|
||
python_functions = ["test_*"]
|
||
asyncio_mode = "auto"
|
||
|