# -*- coding: utf-8 -*- """Datamate built-in operators package. This package contains built-in operators for filtering, slicing, annotation, etc. It is mounted into the runtime container under ``datamate.ops`` so that ``from datamate.ops.annotation...`` imports work correctly. """ import importlib import os from loguru import logger __all__ = [ "annotation", "filter", "formatter", "llms", "mapper", "slicer", "user", ] # 自动导入所有子模块以触发算子注册 current_dir = os.path.dirname(__file__) for module_name in os.listdir(current_dir): module_path = os.path.join(current_dir, module_name) # 检查是否是目录且包含 __init__.py if os.path.isdir(module_path) and '__init__.py' in os.listdir(module_path): try: importlib.import_module(f".{module_name}", package=__name__) except Exception as e: logger.error(f"Failed to load Ops module {module_name}: {e}")