Procházet zdrojové kódy

feat: 依赖分组 + 测试目录规范化 + 架构约束更新

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
WangXuMing před 2 týdny
rodič
revize
0698d33f45

+ 141 - 0
requirements/base.txt

@@ -0,0 +1,141 @@
+# Web Framework
+fastapi==0.116.0
+uvicorn[standard]==0.35.0
+gunicorn==23.0.0
+sse-starlette==2.4.1
+starlette==0.46.2
+httptools==0.6.4
+watchfiles==1.1.0
+python-multipart==0.0.20
+
+# Async Task Queue
+celery[redis]==5.4.0
+redis==6.2.0
+kombu==5.4.2
+billiard==4.2.3
+vine==5.1.0
+amqp==5.3.1
+aioredis==2.0.1
+
+# AI / LLM
+langchain==1.1.3
+langgraph==1.0.4
+langchain-openai==1.1.1
+langchain-core==1.1.3
+langchain-community==0.4.1
+langchain-classic==1.0.0
+langchain-text-splitters==1.0.0
+langgraph-checkpoint==3.0.1
+langgraph-checkpoint-redis==0.0.8
+langgraph-prebuilt==1.0.5
+langgraph-sdk==0.2.15
+langsmith==0.4.58
+openai==2.9.0
+tiktoken==0.12.0
+dashscope==1.23.8
+zhipuai==2.1.5.20250708
+xinference-client==1.7.1.post1
+
+# Data / Database
+sqlalchemy[asyncio]==2.0.45
+aiomysql==0.3.2
+pymysql==1.1.1
+mysql-connector-python==9.3.0
+pymilvus==2.6.5
+milvus==2.2.16
+pgvector==0.4.1
+psycopg==3.2.12
+psycopg-pool==3.2.7
+psycopg2-binary==2.9.11
+chromadb==1.0.15
+redisvl>=0.12.0
+
+# Document Processing
+python-docx==1.2.0
+markdownify==1.2.2
+opencv-python-headless>=4.8.0
+rapidocr_onnxruntime>=1.3.0
+ultralytics>=8.0.0
+pymupdf==1.26.3
+pypdf==6.2.0
+pillow>=9.0.0
+lxml==6.0.2
+
+# Observability
+opentelemetry-api==1.34.1
+opentelemetry-sdk==1.34.1
+opentelemetry-exporter-otlp-proto-common==1.34.1
+opentelemetry-exporter-otlp-proto-grpc==1.34.1
+opentelemetry-exporter-otlp-proto-http==1.34.1
+opentelemetry-proto==1.34.1
+opentelemetry-semantic-conventions==0.55b1
+langfuse==3.9.3
+posthog==5.4.0
+
+# Serialization
+pydantic==2.12.5
+pydantic-core==2.41.5
+pydantic-settings==2.12.0
+pyyaml==6.0.3
+orjson==3.11.5
+ujson==5.10.0
+
+# Infrastructure
+cryptography==45.0.5
+requests==2.32.5
+aiohttp==3.13.2
+httpx==0.28.1
+httpx-sse==0.4.3
+python-dotenv==1.2.1
+google-auth==2.40.3
+authlib==1.6.0
+filelock==3.20.0
+portalocker==3.2.0
+
+# RAG / Vector
+langchain-milvus==0.3.1
+langchain-chroma==0.2.4
+langchain-redis>=0.2.5
+langchain-voyageai==0.3.0
+voyageai==0.3.6
+
+# MCP
+langchain-mcp-adapters
+langchain-mcp-tools==0.2.10
+mcp==1.10.1
+fastmcp==2.10.4
+
+# OCR / Layout
+rapid-layout>=0.3.0
+rapid-table>=0.1.0
+
+# NLP
+jieba==0.42.1
+nltk==3.9.1
+regex==2025.11.3
+
+# Serialization & Utilities
+numpy>=1.21.0
+pandas==2.3.3
+python-dateutil
+python-ulid==3.1.0
+pytz==2025.2
+tzdata
+
+# Rich / CLI
+rich==14.0.0
+typer==0.16.0
+click==8.3.1
+colorama
+coloredlogs==15.0.1
+concurrent-log-handler==0.9.28
+
+# Kubernetes
+kubernetes==33.1.0
+
+# Misc
+beautifulsoup4==4.14.3
+markdown-it-py==3.0.0
+docx2pdf>=0.1.8
+ffmpeg-python==0.2.0
+huggingface-hub==1.2.1

+ 16 - 0
requirements/dev.txt

@@ -0,0 +1,16 @@
+-r base.txt
+
+# Testing
+pytest==8.4.1
+pytest-asyncio==1.0.0
+pytest-cov>=6.0
+pytest-xdist>=3.0
+
+# Lint & Type Check
+ruff>=0.8.0
+mypy>=1.0
+
+# Development
+ipython==8.12.3
+pipreqs==0.5.0
+build==1.2.2.post1

+ 26 - 0
tests/conftest.py

@@ -0,0 +1,26 @@
+"""全局测试 fixtures。"""
+import pytest
+
+
+@pytest.fixture(scope="session")
+def config_handler():
+    """会话级:配置读取器。"""
+    from foundation.infrastructure.config.config import config_handler
+    return config_handler
+
+
+@pytest.fixture(scope="session")
+def model_handler():
+    """会话级:模型客户端管理器。"""
+    from foundation.ai.models.model_handler import model_handler
+    return model_handler
+
+
+@pytest.fixture
+async def redis_client():
+    """函数级:Redis 连接(测试后自动清理)。"""
+    from foundation.infrastructure.cache import RedisConnectionFactory
+    client = RedisConnectionFactory.get()
+    yield client
+    for key in client.keys("test:*"):
+        client.delete(key)

+ 0 - 0
tests/integration/conftest.py


+ 0 - 0
tests/unit/conftest.py