aiecs 1.5.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aiecs/__init__.py +72 -0
- aiecs/__main__.py +41 -0
- aiecs/aiecs_client.py +469 -0
- aiecs/application/__init__.py +10 -0
- aiecs/application/executors/__init__.py +10 -0
- aiecs/application/executors/operation_executor.py +363 -0
- aiecs/application/knowledge_graph/__init__.py +7 -0
- aiecs/application/knowledge_graph/builder/__init__.py +37 -0
- aiecs/application/knowledge_graph/builder/document_builder.py +375 -0
- aiecs/application/knowledge_graph/builder/graph_builder.py +356 -0
- aiecs/application/knowledge_graph/builder/schema_mapping.py +531 -0
- aiecs/application/knowledge_graph/builder/structured_pipeline.py +443 -0
- aiecs/application/knowledge_graph/builder/text_chunker.py +319 -0
- aiecs/application/knowledge_graph/extractors/__init__.py +27 -0
- aiecs/application/knowledge_graph/extractors/base.py +100 -0
- aiecs/application/knowledge_graph/extractors/llm_entity_extractor.py +327 -0
- aiecs/application/knowledge_graph/extractors/llm_relation_extractor.py +349 -0
- aiecs/application/knowledge_graph/extractors/ner_entity_extractor.py +244 -0
- aiecs/application/knowledge_graph/fusion/__init__.py +23 -0
- aiecs/application/knowledge_graph/fusion/entity_deduplicator.py +387 -0
- aiecs/application/knowledge_graph/fusion/entity_linker.py +343 -0
- aiecs/application/knowledge_graph/fusion/knowledge_fusion.py +580 -0
- aiecs/application/knowledge_graph/fusion/relation_deduplicator.py +189 -0
- aiecs/application/knowledge_graph/pattern_matching/__init__.py +21 -0
- aiecs/application/knowledge_graph/pattern_matching/pattern_matcher.py +344 -0
- aiecs/application/knowledge_graph/pattern_matching/query_executor.py +378 -0
- aiecs/application/knowledge_graph/profiling/__init__.py +12 -0
- aiecs/application/knowledge_graph/profiling/query_plan_visualizer.py +199 -0
- aiecs/application/knowledge_graph/profiling/query_profiler.py +223 -0
- aiecs/application/knowledge_graph/reasoning/__init__.py +27 -0
- aiecs/application/knowledge_graph/reasoning/evidence_synthesis.py +347 -0
- aiecs/application/knowledge_graph/reasoning/inference_engine.py +504 -0
- aiecs/application/knowledge_graph/reasoning/logic_form_parser.py +167 -0
- aiecs/application/knowledge_graph/reasoning/logic_parser/__init__.py +79 -0
- aiecs/application/knowledge_graph/reasoning/logic_parser/ast_builder.py +513 -0
- aiecs/application/knowledge_graph/reasoning/logic_parser/ast_nodes.py +630 -0
- aiecs/application/knowledge_graph/reasoning/logic_parser/ast_validator.py +654 -0
- aiecs/application/knowledge_graph/reasoning/logic_parser/error_handler.py +477 -0
- aiecs/application/knowledge_graph/reasoning/logic_parser/parser.py +390 -0
- aiecs/application/knowledge_graph/reasoning/logic_parser/query_context.py +217 -0
- aiecs/application/knowledge_graph/reasoning/logic_query_integration.py +169 -0
- aiecs/application/knowledge_graph/reasoning/query_planner.py +872 -0
- aiecs/application/knowledge_graph/reasoning/reasoning_engine.py +554 -0
- aiecs/application/knowledge_graph/retrieval/__init__.py +19 -0
- aiecs/application/knowledge_graph/retrieval/retrieval_strategies.py +596 -0
- aiecs/application/knowledge_graph/search/__init__.py +59 -0
- aiecs/application/knowledge_graph/search/hybrid_search.py +423 -0
- aiecs/application/knowledge_graph/search/reranker.py +295 -0
- aiecs/application/knowledge_graph/search/reranker_strategies.py +553 -0
- aiecs/application/knowledge_graph/search/text_similarity.py +398 -0
- aiecs/application/knowledge_graph/traversal/__init__.py +15 -0
- aiecs/application/knowledge_graph/traversal/enhanced_traversal.py +329 -0
- aiecs/application/knowledge_graph/traversal/path_scorer.py +269 -0
- aiecs/application/knowledge_graph/validators/__init__.py +13 -0
- aiecs/application/knowledge_graph/validators/relation_validator.py +189 -0
- aiecs/application/knowledge_graph/visualization/__init__.py +11 -0
- aiecs/application/knowledge_graph/visualization/graph_visualizer.py +321 -0
- aiecs/common/__init__.py +9 -0
- aiecs/common/knowledge_graph/__init__.py +17 -0
- aiecs/common/knowledge_graph/runnable.py +484 -0
- aiecs/config/__init__.py +16 -0
- aiecs/config/config.py +498 -0
- aiecs/config/graph_config.py +137 -0
- aiecs/config/registry.py +23 -0
- aiecs/core/__init__.py +46 -0
- aiecs/core/interface/__init__.py +34 -0
- aiecs/core/interface/execution_interface.py +152 -0
- aiecs/core/interface/storage_interface.py +171 -0
- aiecs/domain/__init__.py +289 -0
- aiecs/domain/agent/__init__.py +189 -0
- aiecs/domain/agent/base_agent.py +697 -0
- aiecs/domain/agent/exceptions.py +103 -0
- aiecs/domain/agent/graph_aware_mixin.py +559 -0
- aiecs/domain/agent/hybrid_agent.py +490 -0
- aiecs/domain/agent/integration/__init__.py +26 -0
- aiecs/domain/agent/integration/context_compressor.py +222 -0
- aiecs/domain/agent/integration/context_engine_adapter.py +252 -0
- aiecs/domain/agent/integration/retry_policy.py +219 -0
- aiecs/domain/agent/integration/role_config.py +213 -0
- aiecs/domain/agent/knowledge_aware_agent.py +646 -0
- aiecs/domain/agent/lifecycle.py +296 -0
- aiecs/domain/agent/llm_agent.py +300 -0
- aiecs/domain/agent/memory/__init__.py +12 -0
- aiecs/domain/agent/memory/conversation.py +197 -0
- aiecs/domain/agent/migration/__init__.py +14 -0
- aiecs/domain/agent/migration/conversion.py +160 -0
- aiecs/domain/agent/migration/legacy_wrapper.py +90 -0
- aiecs/domain/agent/models.py +317 -0
- aiecs/domain/agent/observability.py +407 -0
- aiecs/domain/agent/persistence.py +289 -0
- aiecs/domain/agent/prompts/__init__.py +29 -0
- aiecs/domain/agent/prompts/builder.py +161 -0
- aiecs/domain/agent/prompts/formatters.py +189 -0
- aiecs/domain/agent/prompts/template.py +255 -0
- aiecs/domain/agent/registry.py +260 -0
- aiecs/domain/agent/tool_agent.py +257 -0
- aiecs/domain/agent/tools/__init__.py +12 -0
- aiecs/domain/agent/tools/schema_generator.py +221 -0
- aiecs/domain/community/__init__.py +155 -0
- aiecs/domain/community/agent_adapter.py +477 -0
- aiecs/domain/community/analytics.py +481 -0
- aiecs/domain/community/collaborative_workflow.py +642 -0
- aiecs/domain/community/communication_hub.py +645 -0
- aiecs/domain/community/community_builder.py +320 -0
- aiecs/domain/community/community_integration.py +800 -0
- aiecs/domain/community/community_manager.py +813 -0
- aiecs/domain/community/decision_engine.py +879 -0
- aiecs/domain/community/exceptions.py +225 -0
- aiecs/domain/community/models/__init__.py +33 -0
- aiecs/domain/community/models/community_models.py +268 -0
- aiecs/domain/community/resource_manager.py +457 -0
- aiecs/domain/community/shared_context_manager.py +603 -0
- aiecs/domain/context/__init__.py +58 -0
- aiecs/domain/context/context_engine.py +989 -0
- aiecs/domain/context/conversation_models.py +354 -0
- aiecs/domain/context/graph_memory.py +467 -0
- aiecs/domain/execution/__init__.py +12 -0
- aiecs/domain/execution/model.py +57 -0
- aiecs/domain/knowledge_graph/__init__.py +19 -0
- aiecs/domain/knowledge_graph/models/__init__.py +52 -0
- aiecs/domain/knowledge_graph/models/entity.py +130 -0
- aiecs/domain/knowledge_graph/models/evidence.py +194 -0
- aiecs/domain/knowledge_graph/models/inference_rule.py +186 -0
- aiecs/domain/knowledge_graph/models/path.py +179 -0
- aiecs/domain/knowledge_graph/models/path_pattern.py +173 -0
- aiecs/domain/knowledge_graph/models/query.py +272 -0
- aiecs/domain/knowledge_graph/models/query_plan.py +187 -0
- aiecs/domain/knowledge_graph/models/relation.py +136 -0
- aiecs/domain/knowledge_graph/schema/__init__.py +23 -0
- aiecs/domain/knowledge_graph/schema/entity_type.py +135 -0
- aiecs/domain/knowledge_graph/schema/graph_schema.py +271 -0
- aiecs/domain/knowledge_graph/schema/property_schema.py +155 -0
- aiecs/domain/knowledge_graph/schema/relation_type.py +171 -0
- aiecs/domain/knowledge_graph/schema/schema_manager.py +496 -0
- aiecs/domain/knowledge_graph/schema/type_enums.py +205 -0
- aiecs/domain/task/__init__.py +13 -0
- aiecs/domain/task/dsl_processor.py +613 -0
- aiecs/domain/task/model.py +62 -0
- aiecs/domain/task/task_context.py +268 -0
- aiecs/infrastructure/__init__.py +24 -0
- aiecs/infrastructure/graph_storage/__init__.py +11 -0
- aiecs/infrastructure/graph_storage/base.py +601 -0
- aiecs/infrastructure/graph_storage/batch_operations.py +449 -0
- aiecs/infrastructure/graph_storage/cache.py +429 -0
- aiecs/infrastructure/graph_storage/distributed.py +226 -0
- aiecs/infrastructure/graph_storage/error_handling.py +390 -0
- aiecs/infrastructure/graph_storage/graceful_degradation.py +306 -0
- aiecs/infrastructure/graph_storage/health_checks.py +378 -0
- aiecs/infrastructure/graph_storage/in_memory.py +514 -0
- aiecs/infrastructure/graph_storage/index_optimization.py +483 -0
- aiecs/infrastructure/graph_storage/lazy_loading.py +410 -0
- aiecs/infrastructure/graph_storage/metrics.py +357 -0
- aiecs/infrastructure/graph_storage/migration.py +413 -0
- aiecs/infrastructure/graph_storage/pagination.py +471 -0
- aiecs/infrastructure/graph_storage/performance_monitoring.py +466 -0
- aiecs/infrastructure/graph_storage/postgres.py +871 -0
- aiecs/infrastructure/graph_storage/query_optimizer.py +635 -0
- aiecs/infrastructure/graph_storage/schema_cache.py +290 -0
- aiecs/infrastructure/graph_storage/sqlite.py +623 -0
- aiecs/infrastructure/graph_storage/streaming.py +495 -0
- aiecs/infrastructure/messaging/__init__.py +13 -0
- aiecs/infrastructure/messaging/celery_task_manager.py +383 -0
- aiecs/infrastructure/messaging/websocket_manager.py +298 -0
- aiecs/infrastructure/monitoring/__init__.py +34 -0
- aiecs/infrastructure/monitoring/executor_metrics.py +174 -0
- aiecs/infrastructure/monitoring/global_metrics_manager.py +213 -0
- aiecs/infrastructure/monitoring/structured_logger.py +48 -0
- aiecs/infrastructure/monitoring/tracing_manager.py +410 -0
- aiecs/infrastructure/persistence/__init__.py +24 -0
- aiecs/infrastructure/persistence/context_engine_client.py +187 -0
- aiecs/infrastructure/persistence/database_manager.py +333 -0
- aiecs/infrastructure/persistence/file_storage.py +754 -0
- aiecs/infrastructure/persistence/redis_client.py +220 -0
- aiecs/llm/__init__.py +86 -0
- aiecs/llm/callbacks/__init__.py +11 -0
- aiecs/llm/callbacks/custom_callbacks.py +264 -0
- aiecs/llm/client_factory.py +420 -0
- aiecs/llm/clients/__init__.py +33 -0
- aiecs/llm/clients/base_client.py +193 -0
- aiecs/llm/clients/googleai_client.py +181 -0
- aiecs/llm/clients/openai_client.py +131 -0
- aiecs/llm/clients/vertex_client.py +437 -0
- aiecs/llm/clients/xai_client.py +184 -0
- aiecs/llm/config/__init__.py +51 -0
- aiecs/llm/config/config_loader.py +275 -0
- aiecs/llm/config/config_validator.py +236 -0
- aiecs/llm/config/model_config.py +151 -0
- aiecs/llm/utils/__init__.py +10 -0
- aiecs/llm/utils/validate_config.py +91 -0
- aiecs/main.py +363 -0
- aiecs/scripts/__init__.py +3 -0
- aiecs/scripts/aid/VERSION_MANAGEMENT.md +97 -0
- aiecs/scripts/aid/__init__.py +19 -0
- aiecs/scripts/aid/version_manager.py +215 -0
- aiecs/scripts/dependance_check/DEPENDENCY_SYSTEM_SUMMARY.md +242 -0
- aiecs/scripts/dependance_check/README_DEPENDENCY_CHECKER.md +310 -0
- aiecs/scripts/dependance_check/__init__.py +17 -0
- aiecs/scripts/dependance_check/dependency_checker.py +938 -0
- aiecs/scripts/dependance_check/dependency_fixer.py +391 -0
- aiecs/scripts/dependance_check/download_nlp_data.py +396 -0
- aiecs/scripts/dependance_check/quick_dependency_check.py +270 -0
- aiecs/scripts/dependance_check/setup_nlp_data.sh +217 -0
- aiecs/scripts/dependance_patch/__init__.py +7 -0
- aiecs/scripts/dependance_patch/fix_weasel/README_WEASEL_PATCH.md +126 -0
- aiecs/scripts/dependance_patch/fix_weasel/__init__.py +11 -0
- aiecs/scripts/dependance_patch/fix_weasel/fix_weasel_validator.py +128 -0
- aiecs/scripts/dependance_patch/fix_weasel/fix_weasel_validator.sh +82 -0
- aiecs/scripts/dependance_patch/fix_weasel/patch_weasel_library.sh +188 -0
- aiecs/scripts/dependance_patch/fix_weasel/run_weasel_patch.sh +41 -0
- aiecs/scripts/tools_develop/README.md +449 -0
- aiecs/scripts/tools_develop/TOOL_AUTO_DISCOVERY.md +234 -0
- aiecs/scripts/tools_develop/__init__.py +21 -0
- aiecs/scripts/tools_develop/check_type_annotations.py +259 -0
- aiecs/scripts/tools_develop/validate_tool_schemas.py +422 -0
- aiecs/scripts/tools_develop/verify_tools.py +356 -0
- aiecs/tasks/__init__.py +1 -0
- aiecs/tasks/worker.py +172 -0
- aiecs/tools/__init__.py +299 -0
- aiecs/tools/apisource/__init__.py +99 -0
- aiecs/tools/apisource/intelligence/__init__.py +19 -0
- aiecs/tools/apisource/intelligence/data_fusion.py +381 -0
- aiecs/tools/apisource/intelligence/query_analyzer.py +413 -0
- aiecs/tools/apisource/intelligence/search_enhancer.py +388 -0
- aiecs/tools/apisource/monitoring/__init__.py +9 -0
- aiecs/tools/apisource/monitoring/metrics.py +303 -0
- aiecs/tools/apisource/providers/__init__.py +115 -0
- aiecs/tools/apisource/providers/base.py +664 -0
- aiecs/tools/apisource/providers/census.py +401 -0
- aiecs/tools/apisource/providers/fred.py +564 -0
- aiecs/tools/apisource/providers/newsapi.py +412 -0
- aiecs/tools/apisource/providers/worldbank.py +357 -0
- aiecs/tools/apisource/reliability/__init__.py +12 -0
- aiecs/tools/apisource/reliability/error_handler.py +375 -0
- aiecs/tools/apisource/reliability/fallback_strategy.py +391 -0
- aiecs/tools/apisource/tool.py +850 -0
- aiecs/tools/apisource/utils/__init__.py +9 -0
- aiecs/tools/apisource/utils/validators.py +338 -0
- aiecs/tools/base_tool.py +201 -0
- aiecs/tools/docs/__init__.py +121 -0
- aiecs/tools/docs/ai_document_orchestrator.py +599 -0
- aiecs/tools/docs/ai_document_writer_orchestrator.py +2403 -0
- aiecs/tools/docs/content_insertion_tool.py +1333 -0
- aiecs/tools/docs/document_creator_tool.py +1317 -0
- aiecs/tools/docs/document_layout_tool.py +1166 -0
- aiecs/tools/docs/document_parser_tool.py +994 -0
- aiecs/tools/docs/document_writer_tool.py +1818 -0
- aiecs/tools/knowledge_graph/__init__.py +17 -0
- aiecs/tools/knowledge_graph/graph_reasoning_tool.py +734 -0
- aiecs/tools/knowledge_graph/graph_search_tool.py +923 -0
- aiecs/tools/knowledge_graph/kg_builder_tool.py +476 -0
- aiecs/tools/langchain_adapter.py +542 -0
- aiecs/tools/schema_generator.py +275 -0
- aiecs/tools/search_tool/__init__.py +100 -0
- aiecs/tools/search_tool/analyzers.py +589 -0
- aiecs/tools/search_tool/cache.py +260 -0
- aiecs/tools/search_tool/constants.py +128 -0
- aiecs/tools/search_tool/context.py +216 -0
- aiecs/tools/search_tool/core.py +749 -0
- aiecs/tools/search_tool/deduplicator.py +123 -0
- aiecs/tools/search_tool/error_handler.py +271 -0
- aiecs/tools/search_tool/metrics.py +371 -0
- aiecs/tools/search_tool/rate_limiter.py +178 -0
- aiecs/tools/search_tool/schemas.py +277 -0
- aiecs/tools/statistics/__init__.py +80 -0
- aiecs/tools/statistics/ai_data_analysis_orchestrator.py +643 -0
- aiecs/tools/statistics/ai_insight_generator_tool.py +505 -0
- aiecs/tools/statistics/ai_report_orchestrator_tool.py +694 -0
- aiecs/tools/statistics/data_loader_tool.py +564 -0
- aiecs/tools/statistics/data_profiler_tool.py +658 -0
- aiecs/tools/statistics/data_transformer_tool.py +573 -0
- aiecs/tools/statistics/data_visualizer_tool.py +495 -0
- aiecs/tools/statistics/model_trainer_tool.py +487 -0
- aiecs/tools/statistics/statistical_analyzer_tool.py +459 -0
- aiecs/tools/task_tools/__init__.py +86 -0
- aiecs/tools/task_tools/chart_tool.py +732 -0
- aiecs/tools/task_tools/classfire_tool.py +922 -0
- aiecs/tools/task_tools/image_tool.py +447 -0
- aiecs/tools/task_tools/office_tool.py +684 -0
- aiecs/tools/task_tools/pandas_tool.py +635 -0
- aiecs/tools/task_tools/report_tool.py +635 -0
- aiecs/tools/task_tools/research_tool.py +392 -0
- aiecs/tools/task_tools/scraper_tool.py +715 -0
- aiecs/tools/task_tools/stats_tool.py +688 -0
- aiecs/tools/temp_file_manager.py +130 -0
- aiecs/tools/tool_executor/__init__.py +37 -0
- aiecs/tools/tool_executor/tool_executor.py +881 -0
- aiecs/utils/LLM_output_structor.py +445 -0
- aiecs/utils/__init__.py +34 -0
- aiecs/utils/base_callback.py +47 -0
- aiecs/utils/cache_provider.py +695 -0
- aiecs/utils/execution_utils.py +184 -0
- aiecs/utils/logging.py +1 -0
- aiecs/utils/prompt_loader.py +14 -0
- aiecs/utils/token_usage_repository.py +323 -0
- aiecs/ws/__init__.py +0 -0
- aiecs/ws/socket_server.py +52 -0
- aiecs-1.5.1.dist-info/METADATA +608 -0
- aiecs-1.5.1.dist-info/RECORD +302 -0
- aiecs-1.5.1.dist-info/WHEEL +5 -0
- aiecs-1.5.1.dist-info/entry_points.txt +10 -0
- aiecs-1.5.1.dist-info/licenses/LICENSE +225 -0
- aiecs-1.5.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
AIECS Version Manager
|
|
4
|
+
|
|
5
|
+
A script to manage version numbers across multiple files in the AIECS project.
|
|
6
|
+
Updates version numbers in:
|
|
7
|
+
- aiecs/__init__.py (__version__)
|
|
8
|
+
- aiecs/main.py (FastAPI app version and health check version)
|
|
9
|
+
- pyproject.toml (project version)
|
|
10
|
+
|
|
11
|
+
Usage:
|
|
12
|
+
aiecs-version --version 1.2.0
|
|
13
|
+
aiecs-version --bump patch
|
|
14
|
+
aiecs-version --bump minor
|
|
15
|
+
aiecs-version --bump major
|
|
16
|
+
aiecs-version --show
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
import argparse
|
|
20
|
+
import re
|
|
21
|
+
import sys
|
|
22
|
+
from pathlib import Path
|
|
23
|
+
from typing import Optional, Tuple
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class VersionManager:
|
|
27
|
+
"""Manages version numbers across AIECS project files"""
|
|
28
|
+
|
|
29
|
+
def __init__(self, project_root: Optional[Path] = None):
|
|
30
|
+
"""Initialize the version manager with project root path"""
|
|
31
|
+
if project_root is None:
|
|
32
|
+
# Find project root by looking for pyproject.toml
|
|
33
|
+
current = Path(__file__).parent
|
|
34
|
+
while current != current.parent:
|
|
35
|
+
if (current / "pyproject.toml").exists():
|
|
36
|
+
project_root = current
|
|
37
|
+
break
|
|
38
|
+
current = current.parent
|
|
39
|
+
|
|
40
|
+
if project_root is None:
|
|
41
|
+
raise RuntimeError("Could not find project root (pyproject.toml)")
|
|
42
|
+
|
|
43
|
+
self.project_root = project_root
|
|
44
|
+
self.files = {
|
|
45
|
+
"init": project_root / "aiecs" / "__init__.py",
|
|
46
|
+
"main": project_root / "aiecs" / "main.py",
|
|
47
|
+
"pyproject": project_root / "pyproject.toml",
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
def get_current_version(self) -> str:
|
|
51
|
+
"""Get the current version from __init__.py"""
|
|
52
|
+
init_file = self.files["init"]
|
|
53
|
+
if not init_file.exists():
|
|
54
|
+
raise FileNotFoundError(f"Could not find {init_file}")
|
|
55
|
+
|
|
56
|
+
content = init_file.read_text(encoding="utf-8")
|
|
57
|
+
match = re.search(r'__version__\s*=\s*["\']([^"\']+)["\']', content)
|
|
58
|
+
if not match:
|
|
59
|
+
raise ValueError("Could not find __version__ in __init__.py")
|
|
60
|
+
|
|
61
|
+
return match.group(1)
|
|
62
|
+
|
|
63
|
+
def parse_version(self, version: str) -> Tuple[int, int, int]:
|
|
64
|
+
"""Parse version string into major, minor, patch components"""
|
|
65
|
+
match = re.match(r"^(\d+)\.(\d+)\.(\d+)$", version)
|
|
66
|
+
if not match:
|
|
67
|
+
raise ValueError(f"Invalid version format: {version}. Expected format: X.Y.Z")
|
|
68
|
+
|
|
69
|
+
return int(match.group(1)), int(match.group(2)), int(match.group(3))
|
|
70
|
+
|
|
71
|
+
def bump_version(self, current_version: str, bump_type: str) -> str:
|
|
72
|
+
"""Bump version based on type (major, minor, patch)"""
|
|
73
|
+
major, minor, patch = self.parse_version(current_version)
|
|
74
|
+
|
|
75
|
+
if bump_type == "major":
|
|
76
|
+
major += 1
|
|
77
|
+
minor = 0
|
|
78
|
+
patch = 0
|
|
79
|
+
elif bump_type == "minor":
|
|
80
|
+
minor += 1
|
|
81
|
+
patch = 0
|
|
82
|
+
elif bump_type == "patch":
|
|
83
|
+
patch += 1
|
|
84
|
+
else:
|
|
85
|
+
raise ValueError(f"Invalid bump type: {bump_type}. Use 'major', 'minor', or 'patch'")
|
|
86
|
+
|
|
87
|
+
return f"{major}.{minor}.{patch}"
|
|
88
|
+
|
|
89
|
+
def update_init_file(self, new_version: str) -> None:
|
|
90
|
+
"""Update version in aiecs/__init__.py"""
|
|
91
|
+
init_file = self.files["init"]
|
|
92
|
+
content = init_file.read_text(encoding="utf-8")
|
|
93
|
+
|
|
94
|
+
# Update __version__ line
|
|
95
|
+
content = re.sub(
|
|
96
|
+
r'(__version__\s*=\s*["\'])([^"\']+)(["\'])',
|
|
97
|
+
rf"\g<1>{new_version}\g<3>",
|
|
98
|
+
content,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
init_file.write_text(content, encoding="utf-8")
|
|
102
|
+
print(
|
|
103
|
+
f'✓ Updated {init_file.relative_to(self.project_root)}: __version__ = "{new_version}"'
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
def update_main_file(self, new_version: str) -> None:
|
|
107
|
+
"""Update version in aiecs/main.py"""
|
|
108
|
+
main_file = self.files["main"]
|
|
109
|
+
content = main_file.read_text(encoding="utf-8")
|
|
110
|
+
|
|
111
|
+
# Update FastAPI app version
|
|
112
|
+
content = re.sub(r'(version=")([^"]+)(")', rf"\g<1>{new_version}\g<3>", content)
|
|
113
|
+
|
|
114
|
+
# Update health check version
|
|
115
|
+
content = re.sub(r'("version":\s*")([^"]+)(")', rf"\g<1>{new_version}\g<3>", content)
|
|
116
|
+
|
|
117
|
+
main_file.write_text(content, encoding="utf-8")
|
|
118
|
+
print(
|
|
119
|
+
f"✓ Updated {main_file.relative_to(self.project_root)}: FastAPI version and health check version"
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
def update_pyproject_file(self, new_version: str) -> None:
|
|
123
|
+
"""Update version in pyproject.toml"""
|
|
124
|
+
pyproject_file = self.files["pyproject"]
|
|
125
|
+
content = pyproject_file.read_text(encoding="utf-8")
|
|
126
|
+
|
|
127
|
+
# Update project version (only in [project] section, not in [project.scripts])
|
|
128
|
+
# Use a more specific pattern to avoid updating script entry points
|
|
129
|
+
content = re.sub(
|
|
130
|
+
r'^(\s*version\s*=\s*")([^"]+)(")',
|
|
131
|
+
rf"\g<1>{new_version}\g<3>",
|
|
132
|
+
content,
|
|
133
|
+
flags=re.MULTILINE,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
pyproject_file.write_text(content, encoding="utf-8")
|
|
137
|
+
print(f"✓ Updated {pyproject_file.relative_to(self.project_root)}: project version")
|
|
138
|
+
|
|
139
|
+
def update_version(self, new_version: str) -> None:
|
|
140
|
+
"""Update version in all files"""
|
|
141
|
+
# Validate version format
|
|
142
|
+
self.parse_version(new_version)
|
|
143
|
+
|
|
144
|
+
print(f"Updating version to {new_version}...")
|
|
145
|
+
print()
|
|
146
|
+
|
|
147
|
+
# Update all files
|
|
148
|
+
self.update_init_file(new_version)
|
|
149
|
+
self.update_main_file(new_version)
|
|
150
|
+
self.update_pyproject_file(new_version)
|
|
151
|
+
|
|
152
|
+
print()
|
|
153
|
+
print(f"✓ Successfully updated version to {new_version} in all files!")
|
|
154
|
+
|
|
155
|
+
def show_version(self) -> None:
|
|
156
|
+
"""Show current version"""
|
|
157
|
+
try:
|
|
158
|
+
version = self.get_current_version()
|
|
159
|
+
print(f"Current version: {version}")
|
|
160
|
+
except Exception as e:
|
|
161
|
+
print(f"Error getting current version: {e}", file=sys.stderr)
|
|
162
|
+
sys.exit(1)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def main():
|
|
166
|
+
"""Main entry point for the version manager"""
|
|
167
|
+
parser = argparse.ArgumentParser(
|
|
168
|
+
description="AIECS Version Manager - Update version numbers across project files",
|
|
169
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
170
|
+
epilog="""
|
|
171
|
+
Examples:
|
|
172
|
+
aiecs-version --version 1.2.0 # Set specific version
|
|
173
|
+
aiecs-version --bump patch # Bump patch version (1.1.0 -> 1.1.1)
|
|
174
|
+
aiecs-version --bump minor # Bump minor version (1.1.0 -> 1.2.0)
|
|
175
|
+
aiecs-version --bump major # Bump major version (1.1.0 -> 2.0.0)
|
|
176
|
+
aiecs-version --show # Show current version
|
|
177
|
+
""",
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
# Create mutually exclusive group for version options
|
|
181
|
+
version_group = parser.add_mutually_exclusive_group(required=True)
|
|
182
|
+
version_group.add_argument(
|
|
183
|
+
"--version", "-v", type=str, help="Set specific version (e.g., 1.2.0)"
|
|
184
|
+
)
|
|
185
|
+
version_group.add_argument(
|
|
186
|
+
"--bump",
|
|
187
|
+
"-b",
|
|
188
|
+
choices=["major", "minor", "patch"],
|
|
189
|
+
help="Bump version: major (X.0.0), minor (X.Y.0), or patch (X.Y.Z)",
|
|
190
|
+
)
|
|
191
|
+
version_group.add_argument("--show", "-s", action="store_true", help="Show current version")
|
|
192
|
+
|
|
193
|
+
args = parser.parse_args()
|
|
194
|
+
|
|
195
|
+
try:
|
|
196
|
+
manager = VersionManager()
|
|
197
|
+
|
|
198
|
+
if args.show:
|
|
199
|
+
manager.show_version()
|
|
200
|
+
elif args.version:
|
|
201
|
+
manager.update_version(args.version)
|
|
202
|
+
elif args.bump:
|
|
203
|
+
current_version = manager.get_current_version()
|
|
204
|
+
new_version = manager.bump_version(current_version, args.bump)
|
|
205
|
+
print(f"Bumping {args.bump} version: {current_version} -> {new_version}")
|
|
206
|
+
print()
|
|
207
|
+
manager.update_version(new_version)
|
|
208
|
+
|
|
209
|
+
except Exception as e:
|
|
210
|
+
print(f"Error: {e}", file=sys.stderr)
|
|
211
|
+
sys.exit(1)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
if __name__ == "__main__":
|
|
215
|
+
main()
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# AIECS 依赖检查系统实现总结
|
|
2
|
+
|
|
3
|
+
## 概述
|
|
4
|
+
|
|
5
|
+
基于 `/home/coder1/python-middleware-dev/docs/TOOLS_USED_INSTRUCTION/TOOL_SPECIAL_SPECIAL_INSTRUCTIONS.md` 文档中的工具特殊使用说明,我们为 AIECS 包实现了一个全面的依赖检查系统。
|
|
6
|
+
|
|
7
|
+
## 实现的功能
|
|
8
|
+
|
|
9
|
+
### 1. 综合依赖检查脚本 (`dependency_checker.py`)
|
|
10
|
+
|
|
11
|
+
**功能**:
|
|
12
|
+
- 检查所有 AIECS 工具的系统级依赖、Python包依赖和模型文件
|
|
13
|
+
- 支持 6 个主要工具:Image Tool、ClassFire Tool、Office Tool、Stats Tool、Report Tool、Scraper Tool
|
|
14
|
+
- 生成详细的依赖状态报告
|
|
15
|
+
- 提供安装命令和影响说明
|
|
16
|
+
|
|
17
|
+
**特点**:
|
|
18
|
+
- 跨平台支持 (Linux、macOS、Windows)
|
|
19
|
+
- 详细的错误处理和日志记录
|
|
20
|
+
- 可扩展的架构,易于添加新工具
|
|
21
|
+
|
|
22
|
+
### 2. 快速依赖检查脚本 (`quick_dependency_check.py`)
|
|
23
|
+
|
|
24
|
+
**功能**:
|
|
25
|
+
- 快速检查关键依赖项
|
|
26
|
+
- 适合安装后验证
|
|
27
|
+
- 生成简洁的状态报告
|
|
28
|
+
- 提供基本的安装命令
|
|
29
|
+
|
|
30
|
+
**特点**:
|
|
31
|
+
- 轻量级,执行速度快
|
|
32
|
+
- 专注于关键依赖
|
|
33
|
+
- 适合自动化场景
|
|
34
|
+
|
|
35
|
+
### 3. 自动依赖修复脚本 (`dependency_fixer.py`)
|
|
36
|
+
|
|
37
|
+
**功能**:
|
|
38
|
+
- 自动安装缺失的依赖项
|
|
39
|
+
- 支持交互和非交互模式
|
|
40
|
+
- 智能的依赖分组和安装顺序
|
|
41
|
+
- 详细的修复报告
|
|
42
|
+
|
|
43
|
+
**特点**:
|
|
44
|
+
- 用户友好的确认机制
|
|
45
|
+
- 支持多种包管理器 (apt、brew、pip)
|
|
46
|
+
- 完整的错误处理和回滚
|
|
47
|
+
|
|
48
|
+
### 4. 集成到安装流程
|
|
49
|
+
|
|
50
|
+
**setup.py 更新**:
|
|
51
|
+
- 在 `run_post_install()` 函数中集成依赖检查
|
|
52
|
+
- 添加了 3 个新的命令行工具入口点
|
|
53
|
+
- 提供安装后的自动验证
|
|
54
|
+
|
|
55
|
+
**命令行工具**:
|
|
56
|
+
- `aiecs-check-deps`: 完整依赖检查
|
|
57
|
+
- `aiecs-quick-check`: 快速依赖检查
|
|
58
|
+
- `aiecs-fix-deps`: 自动依赖修复
|
|
59
|
+
|
|
60
|
+
## 支持的依赖类型
|
|
61
|
+
|
|
62
|
+
### 系统级依赖
|
|
63
|
+
|
|
64
|
+
1. **Java 运行时环境** (Office Tool)
|
|
65
|
+
- 用于 Apache Tika 文档解析
|
|
66
|
+
- 支持 OpenJDK 11+
|
|
67
|
+
|
|
68
|
+
2. **Tesseract OCR 引擎** (Image Tool, Office Tool)
|
|
69
|
+
- 图像文字识别
|
|
70
|
+
- 支持多语言包
|
|
71
|
+
|
|
72
|
+
3. **图像处理库** (Image Tool, Report Tool)
|
|
73
|
+
- libjpeg, libpng, libtiff 等
|
|
74
|
+
- Pillow 系统依赖
|
|
75
|
+
|
|
76
|
+
4. **统计文件格式库** (Stats Tool)
|
|
77
|
+
- libreadstat (SAS/SPSS/Stata 文件)
|
|
78
|
+
- Excel 处理库
|
|
79
|
+
|
|
80
|
+
5. **PDF 生成库** (Report Tool)
|
|
81
|
+
- WeasyPrint 系统依赖
|
|
82
|
+
- cairo, pango, gdk-pixbuf 等
|
|
83
|
+
|
|
84
|
+
6. **浏览器自动化库** (Scraper Tool)
|
|
85
|
+
- Playwright 浏览器二进制文件
|
|
86
|
+
- 系统图形库
|
|
87
|
+
|
|
88
|
+
### Python 包依赖
|
|
89
|
+
|
|
90
|
+
- **核心框架**: FastAPI, uvicorn, pydantic, httpx
|
|
91
|
+
- **任务队列**: celery, redis
|
|
92
|
+
- **数据处理**: pandas, numpy, scipy, scikit-learn
|
|
93
|
+
- **文档处理**: python-docx, python-pptx, openpyxl, pdfplumber
|
|
94
|
+
- **NLP 处理**: spacy, transformers, nltk
|
|
95
|
+
- **图像处理**: pillow, pytesseract
|
|
96
|
+
- **网页抓取**: playwright, scrapy, beautifulsoup4
|
|
97
|
+
- **报告生成**: jinja2, matplotlib, weasyprint
|
|
98
|
+
|
|
99
|
+
### 模型文件依赖
|
|
100
|
+
|
|
101
|
+
1. **spaCy 模型**
|
|
102
|
+
- en_core_web_sm (英文)
|
|
103
|
+
- zh_core_web_sm (中文)
|
|
104
|
+
|
|
105
|
+
2. **Transformers 模型**
|
|
106
|
+
- facebook/bart-large-cnn (英文摘要)
|
|
107
|
+
- t5-base (多语言摘要)
|
|
108
|
+
|
|
109
|
+
3. **NLTK 数据包**
|
|
110
|
+
- stopwords, punkt, wordnet, averaged_perceptron_tagger
|
|
111
|
+
|
|
112
|
+
4. **Playwright 浏览器**
|
|
113
|
+
- Chromium, Firefox, WebKit
|
|
114
|
+
|
|
115
|
+
## 安装后自动检查流程
|
|
116
|
+
|
|
117
|
+
当用户运行 `pip install aiecs` 时:
|
|
118
|
+
|
|
119
|
+
1. **Weasel 库补丁应用**
|
|
120
|
+
- 修复 weasel 库的验证问题
|
|
121
|
+
- 确保 spaCy 配置正常工作
|
|
122
|
+
|
|
123
|
+
2. **NLP 数据下载**
|
|
124
|
+
- 下载 NLTK 数据包
|
|
125
|
+
- 下载 spaCy 模型
|
|
126
|
+
|
|
127
|
+
3. **系统依赖检查**
|
|
128
|
+
- 运行快速依赖检查
|
|
129
|
+
- 显示缺失的依赖项
|
|
130
|
+
- 提供安装指导
|
|
131
|
+
|
|
132
|
+
4. **安装总结**
|
|
133
|
+
- 显示所有步骤的状态
|
|
134
|
+
- 提供后续操作建议
|
|
135
|
+
|
|
136
|
+
## 使用方法
|
|
137
|
+
|
|
138
|
+
### 安装后验证
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# 快速检查
|
|
142
|
+
aiecs-quick-check
|
|
143
|
+
|
|
144
|
+
# 完整检查
|
|
145
|
+
aiecs-check-deps
|
|
146
|
+
|
|
147
|
+
# 自动修复
|
|
148
|
+
aiecs-fix-deps
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 开发环境设置
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# 检查所有依赖
|
|
155
|
+
aiecs-check-deps
|
|
156
|
+
|
|
157
|
+
# 自动修复缺失依赖
|
|
158
|
+
aiecs-fix-deps --non-interactive
|
|
159
|
+
|
|
160
|
+
# 仅检查不修复
|
|
161
|
+
aiecs-fix-deps --check-only
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## 故障排除
|
|
165
|
+
|
|
166
|
+
### 常见问题解决
|
|
167
|
+
|
|
168
|
+
1. **Java 未安装**
|
|
169
|
+
```bash
|
|
170
|
+
# Ubuntu/Debian
|
|
171
|
+
sudo apt-get install openjdk-11-jdk
|
|
172
|
+
|
|
173
|
+
# macOS
|
|
174
|
+
brew install openjdk@11
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
2. **Tesseract OCR 未安装**
|
|
178
|
+
```bash
|
|
179
|
+
# Ubuntu/Debian
|
|
180
|
+
sudo apt-get install tesseract-ocr tesseract-ocr-eng
|
|
181
|
+
|
|
182
|
+
# macOS
|
|
183
|
+
brew install tesseract
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
3. **spaCy 模型未下载**
|
|
187
|
+
```bash
|
|
188
|
+
python -m spacy download en_core_web_sm
|
|
189
|
+
python -m spacy download zh_core_web_sm
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
4. **Playwright 浏览器未安装**
|
|
193
|
+
```bash
|
|
194
|
+
playwright install
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## 扩展性
|
|
198
|
+
|
|
199
|
+
### 添加新工具依赖检查
|
|
200
|
+
|
|
201
|
+
1. 在 `DependencyChecker` 类中添加新的检查方法
|
|
202
|
+
2. 在 `check_all_dependencies()` 中注册新工具
|
|
203
|
+
3. 更新安装命令映射
|
|
204
|
+
|
|
205
|
+
### 自定义检查逻辑
|
|
206
|
+
|
|
207
|
+
```python
|
|
208
|
+
from aiecs.scripts.dependency_checker import DependencyChecker
|
|
209
|
+
|
|
210
|
+
checker = DependencyChecker()
|
|
211
|
+
tools = checker.check_all_dependencies()
|
|
212
|
+
report = checker.generate_report(tools)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## 文件结构
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
aiecs/scripts/
|
|
219
|
+
├── dependency_checker.py # 完整依赖检查
|
|
220
|
+
├── quick_dependency_check.py # 快速依赖检查
|
|
221
|
+
├── dependency_fixer.py # 自动依赖修复
|
|
222
|
+
├── test_dependency_checker.py # 测试脚本
|
|
223
|
+
├── README_DEPENDENCY_CHECKER.md # 使用说明
|
|
224
|
+
└── DEPENDENCY_SYSTEM_SUMMARY.md # 系统总结
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## 总结
|
|
228
|
+
|
|
229
|
+
这个依赖检查系统解决了 AIECS 包作为项目依赖时的关键问题:
|
|
230
|
+
|
|
231
|
+
1. **自动检查**: 安装后自动验证所有依赖
|
|
232
|
+
2. **详细报告**: 清楚显示缺失的依赖和影响
|
|
233
|
+
3. **自动修复**: 提供一键修复功能
|
|
234
|
+
4. **跨平台支持**: 支持主流操作系统
|
|
235
|
+
5. **易于扩展**: 可以轻松添加新工具的依赖检查
|
|
236
|
+
|
|
237
|
+
通过这个系统,用户可以在安装 AIECS 后立即了解哪些功能可用,哪些需要额外安装依赖,以及如何获得这些依赖。这大大提高了用户体验和包的可用性。
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|