Explorar el Código

feat: 添加 pyproject.toml + 清理 sys.path.insert

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
WangXuMing hace 2 semanas
padre
commit
b139a0cb56
Se han modificado 63 ficheros con 48 adiciones y 92 borrados
  1. 4 0
      Dockerfile
  2. 0 0
      config/__init__.py
  3. 0 1
      core/construction_review/component/minimal_pipeline/pdf_extractor_batch_runner.py
  4. 0 2
      core/construction_review/component/reviewers/check_completeness/components/result_analyzer.py
  5. 0 3
      data_pipeline/milvus_inbound_script/milvus入库脚本.py
  6. 0 1
      data_pipeline/training_data/test_rag.py
  7. 0 1
      foundation/utils/redis_utils.py
  8. 44 0
      pyproject.toml
  9. 0 0
      server/__init__.py
  10. 0 2
      server/app.py
  11. 0 2
      utils_test/AI_Review_Test/test_outline_check.py
  12. 0 1
      utils_test/AI_Review_Test/test_rag_enhanced_check.py
  13. 0 1
      utils_test/Check_Item/_ai_review_node_check_item_test.py
  14. 0 1
      utils_test/Chunk_Split_Test/analyze_pdf.py
  15. 0 1
      utils_test/Chunk_Split_Test/check_leak_detail.py
  16. 0 1
      utils_test/Chunk_Split_Test/run_single_test.py
  17. 0 2
      utils_test/Chunk_Split_Test/test_chunk_split_batch.py
  18. 0 2
      utils_test/Chunk_Split_Test/test_chunk_split_fix.py
  19. 0 1
      utils_test/Chunk_Split_Test/test_real_scenario.py
  20. 0 1
      utils_test/Chunk_Split_Test/test_title_matcher_fix.py
  21. 0 2
      utils_test/Chunk_Split_Test/verify_leak.py
  22. 0 1
      utils_test/Chunk_Split_Test/verify_title_fix.py
  23. 0 1
      utils_test/Completeness_Enhanced_Test/test_classification_optimization.py
  24. 0 1
      utils_test/Completeness_Enhanced_Test/test_completeness_integration.py
  25. 0 1
      utils_test/Completeness_Enhanced_Test/test_e2e_completeness.py
  26. 0 1
      utils_test/Completeness_Enhanced_Test/test_enhanced_classification_integration.py
  27. 0 2
      utils_test/Completeness_Test/test_completeness_accuracy.py
  28. 0 2
      utils_test/Grammar_Check_Test/grammar_check_server.py
  29. 0 1
      utils_test/Integration_Test/system_trace_id_test.py
  30. 0 2
      utils_test/Milvus_Test/debug_simple.py
  31. 0 2
      utils_test/Milvus_Test/milvus入库脚本.py
  32. 0 3
      utils_test/MinerU_Test/mineru_test.py
  33. 0 1
      utils_test/MinerU_Test/mineru_性能预估脚本.py
  34. 0 2
      utils_test/Model_Test/test_thinking_mode.py
  35. 0 1
      utils_test/Model_Test/test_thinking_mode_simple.py
  36. 0 2
      utils_test/Model_Test/test_thinking_vs_nonthinking.py
  37. 0 1
      utils_test/RAG_Test/debug_messages.py
  38. 0 1
      utils_test/RAG_Test/debug_query_extract.py
  39. 0 2
      utils_test/RAG_Test/patch_enhanced_results.py
  40. 0 2
      utils_test/RAG_Test/rag_pipeline_web/rag_pipeline_server.py
  41. 0 3
      utils_test/RAG_Test/search_comparison_report.py
  42. 0 2
      utils_test/RAG_Test/test_extract_modes.py
  43. 0 1
      utils_test/RAG_Test/test_hybrid_search_debug.py
  44. 0 1
      utils_test/RAG_Test/test_query_extract_integration.py
  45. 0 1
      utils_test/RAG_Test/test_rag.py
  46. 0 1
      utils_test/RAG_Test/test_rag_enhanced_check.py
  47. 0 2
      utils_test/RAG_Test/test_rag_monitor.py
  48. 0 1
      utils_test/RAG_Test/test_rag_pipeline.py
  49. 0 1
      utils_test/Redis_Test/redis_ttl_bug_test.py
  50. 0 1
      utils_test/Redis_Test/redis_ttl_fix_test.py
  51. 0 2
      utils_test/Semantic_Logic_Test/conftest.py
  52. 0 2
      utils_test/Semantic_Logic_Test/semantic_logic_server.py
  53. 0 1
      utils_test/Semantic_Logic_Test/test_semantic_logic.py
  54. 0 2
      utils_test/Sensitive_Test/sensitive_check_server.py
  55. 0 2
      utils_test/Sensitive_Test/test_grammar_check_chain.py
  56. 0 2
      utils_test/Sensitive_Test/test_sensitive_check.py
  57. 0 2
      utils_test/Sensitive_Test/test_sensitive_check_standalone.py
  58. 0 2
      utils_test/minimal_pipeline/run.py
  59. 0 2
      utils_test/standard_new_Test/conftest.py
  60. 0 2
      utils_test/standard_new_Test/standard_dao.py
  61. 0 2
      utils_test/standard_new_Test/standard_service.py
  62. 0 1
      utils_test/standard_new_Test/test_app.py
  63. 0 2
      utils_test/standard_new_Test/test_user_standards.py

+ 4 - 0
Dockerfile

@@ -15,6 +15,10 @@ FROM ${BASE_IMAGE}
 WORKDIR /app
 COPY . /app
 
+# 可编辑安装:在 site-packages 创建 .pth 文件指向 /app/,替代 sys.path.insert
+# 所有依赖已在 base 镜像的 /venv/ 中,此步不下载任何包,秒级完成
+RUN /venv/bin/pip install -e .
+
 EXPOSE 8001
 RUN chmod 777 run.sh
 

+ 0 - 0
config/__init__.py


+ 0 - 1
core/construction_review/component/minimal_pipeline/pdf_extractor_batch_runner.py

@@ -32,7 +32,6 @@ import fitz
 REPO_ROOT = Path(__file__).resolve().parents[4]
 MODULE_DIR = Path(__file__).resolve().parent
 if str(REPO_ROOT) not in sys.path:
-    sys.path.insert(0, str(REPO_ROOT))
 
 
 SPECIAL_SECTION_KEYS = {"章节标题", "默认部分"}

+ 0 - 2
core/construction_review/component/reviewers/check_completeness/components/result_analyzer.py

@@ -7,10 +7,8 @@ import ast
 import sys
 from pathlib import Path
 
-# 添加项目根目录到路径,支持相对导入
 _root = Path(__file__).parent.parent
 if str(_root) not in sys.path:
-    sys.path.insert(0, str(_root))
 
 from interfaces import IResultAnalyzer, IKeywordChecker
 from utils.file_utils import read_csv, write_csv

+ 0 - 3
data_pipeline/milvus_inbound_script/milvus入库脚本.py

@@ -7,13 +7,10 @@ import sys
 import os
 import json
 
-# 添加项目根目录到路径
-# 解决模块导入问题:添加项目根目录到 Python 路径
 current_script_path = os.path.abspath(__file__)
 script_dir = os.path.dirname(current_script_path)
 project_root = os.path.abspath(os.path.join(script_dir, "../../"))
 if project_root not in sys.path:
-    sys.path.insert(0, project_root)
 
 def load_documents_from_file(json_path: str):
     """

+ 0 - 1
data_pipeline/training_data/test_rag.py

@@ -4,7 +4,6 @@ current_script_path = os.path.abspath(__file__)
 script_dir = os.path.dirname(current_script_path)
 project_root = os.path.abspath(os.path.join(script_dir, "../../"))
 if project_root not in sys.path:
-    sys.path.insert(0, project_root)
 from foundation.ai.rag.retrieval.retrieval import retrieval_manager
 
 

+ 0 - 1
foundation/utils/redis_utils.py

@@ -6,7 +6,6 @@ import sys
 from pathlib import Path
 # root_dir = Path(__file__).parent.parent.parent 
 # print(root_dir) 
-# sys.path.append(str(root_dir))  
 from typing import Dict, Optional, Any
 from foundation.observability.monitoring.time_statistics import track_execution_time
 from foundation.infrastructure.config import config_handler

+ 44 - 0
pyproject.toml

@@ -0,0 +1,44 @@
+[build-system]
+requires = ["setuptools>=75"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "lq-agent-platform"
+version = "0.3"
+requires-python = ">=3.12"
+# dependencies 字段留空,依赖继续由 requirements.txt 管理
+# Dockerfile.base 依赖 requirements.txt 构建,不受影响
+
+[project.optional-dependencies]
+dev = [
+    "pytest>=8",
+    "pytest-asyncio",
+    "pytest-cov",
+    "pytest-xdist",
+    "ruff>=0.8",
+    "mypy>=1",
+]
+
+[tool.setuptools.packages.find]
+where = ["."]
+include = ["server*", "views*", "core*", "foundation*", "config*"]
+
+[tool.pytest.ini_options]
+pythonpath = ["."]
+testpaths = ["utils_test"]
+markers = [
+    "integration: 需要后端服务运行的集成测试",
+    "slow: 耗时超过 10 秒的测试",
+    "unit: 快速单元测试",
+]
+
+[tool.ruff]
+target-version = "py312"
+line-length = 120
+
+[tool.ruff.lint]
+select = ["E", "F", "I", "N", "W", "UP", "SIM"]
+ignore = ["E501"]
+
+[tool.ruff.lint.isort]
+known-first-party = ["server", "views", "core", "foundation", "config"]

+ 0 - 0
server/__init__.py


+ 0 - 2
server/app.py

@@ -14,8 +14,6 @@ if sys.platform == 'win32':
 
 logging.getLogger('pymilvus').setLevel(logging.ERROR)
 
-BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-sys.path.insert(0, BASE_DIR)
 
 from server.factory import ApplicationFactory
 from server.runner import ServerRunner

+ 0 - 2
utils_test/AI_Review_Test/test_outline_check.py

@@ -6,10 +6,8 @@ import sys
 import os
 from pathlib import Path
 
-# 添加项目根目录到Python路径
 current_dir = Path(__file__).parent.absolute()
 project_root = current_dir.parent.parent
-sys.path.insert(0, str(project_root))
 os.chdir(str(project_root))
 
 from core.construction_review.component.ai_review_engine import AIReviewEngine

+ 0 - 1
utils_test/AI_Review_Test/test_rag_enhanced_check.py

@@ -10,7 +10,6 @@ import sys
 import os
 import time
 
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 from core.base.task_models import TaskFileInfo
 from core.construction_review.component.ai_review_engine import AIReviewEngine
 from foundation.observability.logger.loggering import review_logger as logger

+ 0 - 1
utils_test/Check_Item/_ai_review_node_check_item_test.py

@@ -7,7 +7,6 @@ from pathlib import Path
 
 current_dir = Path(__file__).parent.absolute()
 project_root = current_dir.parent.parent
-sys.path.insert(0, str(project_root))
 
 
 # 导入必要的类

+ 0 - 1
utils_test/Chunk_Split_Test/analyze_pdf.py

@@ -11,7 +11,6 @@ from pathlib import Path
 
 project_root = Path(__file__).parent.parent.parent
 os.chdir(project_root)
-sys.path.insert(0, str(project_root))
 
 import json
 from datetime import datetime

+ 0 - 1
utils_test/Chunk_Split_Test/check_leak_detail.py

@@ -8,7 +8,6 @@ import sys
 from pathlib import Path
 
 project_root = Path(__file__).parent.parent.parent
-sys.path.insert(0, str(project_root))
 
 from test_chunk_split_fix import build_test_facade
 from core.construction_review.component.doc_worker.interfaces import DocumentSource

+ 0 - 1
utils_test/Chunk_Split_Test/run_single_test.py

@@ -13,7 +13,6 @@ from datetime import datetime
 from pathlib import Path
 
 project_root = Path(__file__).parent.parent.parent
-sys.path.insert(0, str(project_root))
 
 # 直接导入,避免触发 LLM 初始化
 # 先设置环境变量避免某些初始化

+ 0 - 2
utils_test/Chunk_Split_Test/test_chunk_split_batch.py

@@ -13,9 +13,7 @@ import traceback
 from datetime import datetime
 from pathlib import Path
 
-# 添加项目根目录到路径
 project_root = Path(__file__).parent.parent.parent
-sys.path.insert(0, str(project_root))
 
 from core.construction_review.component.doc_worker.pipeline import PipelineComponents, DefaultDocumentPipeline, DefaultFileParseFacade
 from core.construction_review.component.doc_worker.config.provider import default_config_provider

+ 0 - 2
utils_test/Chunk_Split_Test/test_chunk_split_fix.py

@@ -26,9 +26,7 @@ import os
 import sys
 from pathlib import Path
 
-# 添加项目根目录到路径
 project_root = Path(__file__).parent.parent.parent
-sys.path.insert(0, str(project_root))
 
 from core.construction_review.component.doc_worker.pipeline import PipelineComponents, DefaultDocumentPipeline, DefaultFileParseFacade
 from core.construction_review.component.doc_worker.config.provider import default_config_provider

+ 0 - 1
utils_test/Chunk_Split_Test/test_real_scenario.py

@@ -12,7 +12,6 @@ from pathlib import Path
 
 project_root = Path(__file__).parent.parent.parent
 os.chdir(project_root)
-sys.path.insert(0, str(project_root))
 
 from core.construction_review.workflows.document_workflow import DocumentWorkflow
 from core.base.task_models import TaskFileInfo

+ 0 - 1
utils_test/Chunk_Split_Test/test_title_matcher_fix.py

@@ -15,7 +15,6 @@ import os
 from pathlib import Path
 
 project_root = Path(__file__).parent.parent.parent
-sys.path.insert(0, str(project_root))
 os.chdir(project_root)
 
 import re

+ 0 - 2
utils_test/Chunk_Split_Test/verify_leak.py

@@ -10,9 +10,7 @@ import os
 from pathlib import Path
 
 project_root = Path(__file__).parent.parent.parent
-sys.path.insert(0, str(project_root))
 
-# 修复:切换工作目录到项目根目录,确保 config_handler 能正确加载 config.ini
 os.chdir(project_root)
 
 from core.construction_review.component.doc_worker.pipeline import (

+ 0 - 1
utils_test/Chunk_Split_Test/verify_title_fix.py

@@ -10,7 +10,6 @@ import os
 from pathlib import Path
 
 project_root = Path(__file__).parent.parent.parent
-sys.path.insert(0, str(project_root))
 os.chdir(project_root)
 
 import fitz

+ 0 - 1
utils_test/Completeness_Enhanced_Test/test_classification_optimization.py

@@ -11,7 +11,6 @@ import sys
 from pathlib import Path
 
 project_root = Path(__file__).parent.parent.parent
-sys.path.insert(0, str(project_root))
 
 from core.construction_review.component.reviewers.utils.llm_content_classifier_v2 import (
     ContentClassifierClient,

+ 0 - 1
utils_test/Completeness_Enhanced_Test/test_completeness_integration.py

@@ -17,7 +17,6 @@ from pathlib import Path
 
 # 添加项目路径
 project_root = Path(__file__).parent.parent.parent
-sys.path.insert(0, str(project_root))
 
 from core.construction_review.component.reviewers.completeness_reviewer import (
     LightweightCompletenessChecker,

+ 0 - 1
utils_test/Completeness_Enhanced_Test/test_e2e_completeness.py

@@ -18,7 +18,6 @@ from pathlib import Path
 
 # 添加项目路径
 project_root = Path(__file__).parent.parent.parent
-sys.path.insert(0, str(project_root))
 
 
 def test_build_parse_result():

+ 0 - 1
utils_test/Completeness_Enhanced_Test/test_enhanced_classification_integration.py

@@ -22,7 +22,6 @@ from unittest.mock import Mock, patch, MagicMock
 
 # 添加项目路径
 project_root = Path(__file__).parent.parent.parent
-sys.path.insert(0, str(project_root))
 
 # 设置环境变量避免模型初始化
 os.environ["SKIP_MODEL_INIT"] = "1"

+ 0 - 2
utils_test/Completeness_Test/test_completeness_accuracy.py

@@ -15,9 +15,7 @@ from pathlib import Path
 from typing import Dict, List, Set, Tuple
 from collections import defaultdict
 
-# 添加项目根目录到路径
 project_root = Path(__file__).parent.parent.parent
-sys.path.insert(0, str(project_root))
 
 import pytest
 import asyncio

+ 0 - 2
utils_test/Grammar_Check_Test/grammar_check_server.py

@@ -13,9 +13,7 @@ import asyncio
 from http.server import HTTPServer, SimpleHTTPRequestHandler
 from urllib.parse import urlparse
 
-# 添加项目根目录到路径
 PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-sys.path.insert(0, PROJECT_ROOT)
 os.chdir(PROJECT_ROOT)
 
 from foundation.observability.logger.loggering import review_logger as logger

+ 0 - 1
utils_test/Integration_Test/system_trace_id_test.py

@@ -6,7 +6,6 @@ import os
 import sys
 # Add the parent directory (LQAgentPlatform) to sys.path so we can import foundation
 project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-sys.path.append(project_root)
 import asyncio
 import time
 from foundation.infrastructure.tracing import TraceContext, auto_trace

+ 0 - 2
utils_test/Milvus_Test/debug_simple.py

@@ -6,8 +6,6 @@
 import sys
 import os
 
-# 添加项目根目录到路径
-sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
 print("调试 LangChain Milvus 集合字段结构")
 print("=" * 50)

+ 0 - 2
utils_test/Milvus_Test/milvus入库脚本.py

@@ -6,8 +6,6 @@
 import sys
 import os
 
-# 添加项目根目录到路径
-sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
 print("测试修复后的 Milvus 向量实现")
 print("=" * 50)

+ 0 - 3
utils_test/MinerU_Test/mineru_test.py

@@ -10,11 +10,8 @@ current_file = os.path.abspath(__file__)
 current_dir = os.path.dirname(current_file)
 # 获取上一级目录(utils_test)
 parent_dir = os.path.dirname(current_dir)
-# 获取项目根目录(LQAgentPlatform,即 foundation 所在的目录)
 root_dir = os.path.dirname(parent_dir)
 
-# 将项目根目录添加到 sys.path
-sys.path.append(root_dir)
 
 
 import requests

+ 0 - 1
utils_test/MinerU_Test/mineru_性能预估脚本.py

@@ -1,6 +1,5 @@
 import sys
 import os
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
 import requests
 import time

+ 0 - 2
utils_test/Model_Test/test_thinking_mode.py

@@ -18,9 +18,7 @@ import time
 import sys
 from pathlib import Path
 
-# 添加项目根目录到 Python 路径
 project_root = Path(__file__).parent.parent.parent
-sys.path.insert(0, str(project_root))
 
 from foundation.ai.agent.generate.model_generate import generate_model_client
 

+ 0 - 1
utils_test/Model_Test/test_thinking_mode_simple.py

@@ -14,7 +14,6 @@ import sys
 from pathlib import Path
 
 project_root = Path(__file__).parent.parent.parent
-sys.path.insert(0, str(project_root))
 
 from foundation.ai.agent.generate.model_generate import generate_model_client
 

+ 0 - 2
utils_test/Model_Test/test_thinking_vs_nonthinking.py

@@ -18,9 +18,7 @@ import json
 from pathlib import Path
 from datetime import datetime
 
-# 添加项目根目录到 Python 路径
 project_root = Path(__file__).parent.parent.parent
-sys.path.insert(0, str(project_root))
 
 from foundation.ai.agent.generate.model_generate import generate_model_client
 from foundation.observability.logger.loggering import review_logger as logger

+ 0 - 1
utils_test/RAG_Test/debug_messages.py

@@ -7,7 +7,6 @@
 
 import sys
 import os
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
 from foundation.ai.rag.retrieval.query_rewrite import prompt_loader
 

+ 0 - 1
utils_test/RAG_Test/debug_query_extract.py

@@ -8,7 +8,6 @@
 import sys
 import os
 import time
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
 from foundation.ai.rag.retrieval.query_rewrite import QueryRewriteManager
 from foundation.observability.logger.loggering import review_logger as logger

+ 0 - 2
utils_test/RAG_Test/patch_enhanced_results.py

@@ -9,9 +9,7 @@ import sys
 import os
 import json
 
-# 添加项目根目录到路径
 project_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-sys.path.insert(0, project_root)
 
 
 def patch_enhanced_results():

+ 0 - 2
utils_test/RAG_Test/rag_pipeline_web/rag_pipeline_server.py

@@ -15,9 +15,7 @@ from http.server import HTTPServer, SimpleHTTPRequestHandler
 from urllib.parse import parse_qs, urlparse
 import threading
 
-# 添加项目根目录到路径
 project_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
-sys.path.insert(0, project_root)
 # 必须在导入业务模块前切换CWD,否则config_handler用相对路径找不到config.ini
 os.chdir(project_root)
 

+ 0 - 3
utils_test/RAG_Test/search_comparison_report.py

@@ -10,9 +10,6 @@ from typing import Any, Dict, List
 from datetime import datetime
 import math
 
-# 将项目根目录加入 sys.path,确保能导入 foundation 等模块
-BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-sys.path.insert(0, BASE_DIR)
 
 from pymilvus import MilvusClient, AnnSearchRequest, WeightedRanker
 from foundation.infrastructure.config.config import config_handler

+ 0 - 2
utils_test/RAG_Test/test_extract_modes.py

@@ -9,9 +9,7 @@ import sys
 import os
 import json
 
-# 添加项目根目录到路径
 project_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-sys.path.insert(0, project_root)
 
 from core.construction_review.component.infrastructure.parent_tool import extract_first_result
 

+ 0 - 1
utils_test/RAG_Test/test_hybrid_search_debug.py

@@ -7,7 +7,6 @@
 
 import sys
 import os
-sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
 
 from pymilvus import connections, Collection, utility
 from foundation.ai.models.model_handler import model_handler

+ 0 - 1
utils_test/RAG_Test/test_query_extract_integration.py

@@ -8,7 +8,6 @@
 import sys
 import os
 import time
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
 from foundation.ai.rag.retrieval.query_rewrite import QueryRewriteManager
 from foundation.observability.logger.loggering import review_logger as logger

+ 0 - 1
utils_test/RAG_Test/test_rag.py

@@ -8,7 +8,6 @@
 import sys
 import os
 import time
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
 from foundation.ai.rag.retrieval.retrieval import retrieval_manager
 from foundation.observability.logger.loggering import review_logger as logger

+ 0 - 1
utils_test/RAG_Test/test_rag_enhanced_check.py

@@ -8,7 +8,6 @@
 import sys
 import os
 import asyncio
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
 
 from core.base.task_models import TaskFileInfo

+ 0 - 2
utils_test/RAG_Test/test_rag_monitor.py

@@ -13,9 +13,7 @@ import json
 import asyncio
 from pathlib import Path
 
-# 添加项目根目录到路径
 project_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-sys.path.insert(0, project_root)
 
 from foundation.observability.monitoring.rag import rag_monitor
 from foundation.observability.logger.loggering import review_logger as logger

+ 0 - 1
utils_test/RAG_Test/test_rag_pipeline.py

@@ -19,7 +19,6 @@ import json
 import time
 import asyncio
 from typing import Dict, Any
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
 from core.construction_review.component.infrastructure.milvus import MilvusConfig, MilvusManager
 from core.construction_review.component.infrastructure.parent_tool import (

+ 0 - 1
utils_test/Redis_Test/redis_ttl_bug_test.py

@@ -17,7 +17,6 @@ from typing import Dict, Any
 import sys
 from pathlib import Path
 root_dir = Path(__file__).parent.parent
-sys.path.append(str(root_dir))
 
 from foundation.utils.redis_utils import store_file_info, get_file_info
 from foundation.infrastructure.cache.redis_connection import RedisConnectionFactory

+ 0 - 1
utils_test/Redis_Test/redis_ttl_fix_test.py

@@ -13,7 +13,6 @@ import sys
 from pathlib import Path
 
 root_dir = Path(__file__).parent.parent
-sys.path.append(str(root_dir))
 
 from foundation.utils.redis_utils import store_file_info, get_file_info
 from foundation.infrastructure.cache.redis_connection import RedisConnectionFactory

+ 0 - 2
utils_test/Semantic_Logic_Test/conftest.py

@@ -7,10 +7,8 @@ import pytest
 import sys
 import os
 
-# 添加项目根目录到 Python 路径
 project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
 if project_root not in sys.path:
-    sys.path.insert(0, project_root)
 
 
 @pytest.fixture(scope="session")

+ 0 - 2
utils_test/Semantic_Logic_Test/semantic_logic_server.py

@@ -14,9 +14,7 @@ import threading
 from http.server import HTTPServer, SimpleHTTPRequestHandler
 from urllib.parse import parse_qs, urlparse
 
-# 添加项目根目录到路径
 PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-sys.path.insert(0, PROJECT_ROOT)
 os.chdir(PROJECT_ROOT)
 
 from foundation.observability.logger.loggering import review_logger as logger

+ 0 - 1
utils_test/Semantic_Logic_Test/test_semantic_logic.py

@@ -11,7 +11,6 @@ import sys
 import os
 from unittest.mock import Mock, patch, AsyncMock, MagicMock, PropertyMock
 
-sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')))
 
 from core.construction_review.component.reviewers.semantic_logic import (
     SemanticLogicReviewer,

+ 0 - 2
utils_test/Sensitive_Test/sensitive_check_server.py

@@ -13,9 +13,7 @@ import asyncio
 from http.server import HTTPServer, SimpleHTTPRequestHandler
 from urllib.parse import urlparse
 
-# 添加项目根目录到路径
 PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-sys.path.insert(0, PROJECT_ROOT)
 os.chdir(PROJECT_ROOT)
 
 from foundation.observability.logger.loggering import review_logger as logger

+ 0 - 2
utils_test/Sensitive_Test/test_grammar_check_chain.py

@@ -27,11 +27,9 @@ from unittest.mock import AsyncMock, MagicMock, patch
 import pytest
 
 # -----------------------------------------------------------
-# 项目根目录
 # -----------------------------------------------------------
 current_dir = Path(__file__).parent.absolute()
 project_root = current_dir.parent.parent
-sys.path.insert(0, str(project_root))
 
 # -----------------------------------------------------------
 # 只 Mock 导致导入链断裂的 modules,不引入多余依赖

+ 0 - 2
utils_test/Sensitive_Test/test_sensitive_check.py

@@ -14,10 +14,8 @@ from pathlib import Path
 from typing import Dict, Any, List
 from dataclasses import dataclass
 
-# 添加项目根目录到Python路径
 current_dir = Path(__file__).parent.absolute()
 project_root = current_dir.parent.parent
-sys.path.insert(0, str(project_root))
 os.chdir(str(project_root))
 
 from core.construction_review.component.reviewers.base_reviewer import ReviewResult

+ 0 - 2
utils_test/Sensitive_Test/test_sensitive_check_standalone.py

@@ -14,10 +14,8 @@ import time
 from pathlib import Path
 from typing import Dict, Any, Optional
 
-# 添加项目根目录到Python路径
 current_dir = Path(__file__).parent.absolute()
 project_root = current_dir.parent.parent
-sys.path.insert(0, str(project_root))
 os.chdir(str(project_root))
 
 

+ 0 - 2
utils_test/minimal_pipeline/run.py

@@ -21,9 +21,7 @@ import sys
 import time
 from pathlib import Path
 
-# 添加项目根目录到路径(用于读取 config.ini 等,但本模块本身不依赖 core/foundation)
 PROJECT_ROOT = Path(__file__).parent.parent.parent
-sys.path.insert(0, str(PROJECT_ROOT))
 os.chdir(PROJECT_ROOT)
 
 from utils_test.minimal_pipeline import MinimalPipeline

+ 0 - 2
utils_test/standard_new_Test/conftest.py

@@ -8,11 +8,9 @@ import types
 import importlib.util
 import pytest
 
-# 添加项目根目录到 Python 路径
 current_dir = os.path.dirname(os.path.abspath(__file__))
 project_root = os.path.dirname(os.path.dirname(current_dir))
 if project_root not in sys.path:
-    sys.path.insert(0, project_root)
 
 
 def _load_production_module():

+ 0 - 2
utils_test/standard_new_Test/standard_dao.py

@@ -4,11 +4,9 @@
 """
 import sys
 import os
-# 添加项目根目录到 Python 路径
 current_dir = os.path.dirname(os.path.abspath(__file__))
 project_root = os.path.dirname(os.path.dirname(current_dir))
 if project_root not in sys.path:
-    sys.path.insert(0, project_root)
 
 from typing import List, Dict, Optional
 

+ 0 - 2
utils_test/standard_new_Test/standard_service.py

@@ -9,11 +9,9 @@
 """
 import sys
 import os
-# 添加项目根目录到 Python 路径
 current_dir = os.path.dirname(os.path.abspath(__file__))
 project_root = os.path.dirname(os.path.dirname(current_dir))
 if project_root not in sys.path:
-    sys.path.insert(0, project_root)
 
 from typing import List, Dict, Optional, Set
 from dataclasses import dataclass, field

+ 0 - 1
utils_test/standard_new_Test/test_app.py

@@ -18,7 +18,6 @@ MOCK_MODE = True
 # ==================== 路径设置 ====================
 CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
 PROJECT_ROOT = os.path.dirname(os.path.dirname(CURRENT_DIR))
-sys.path.insert(0, PROJECT_ROOT)
 
 # 真实模式下需要修改工作目录以读取配置文件
 if not MOCK_MODE:

+ 0 - 2
utils_test/standard_new_Test/test_user_standards.py

@@ -7,11 +7,9 @@ import asyncio
 import sys
 import os
 
-# 添加项目根目录到 Python 路径
 current_dir = os.path.dirname(os.path.abspath(__file__))
 project_root = os.path.dirname(os.path.dirname(current_dir))
 if project_root not in sys.path:
-    sys.path.insert(0, project_root)
 
 from conftest import (
     StandardRepository,