From 44c8af572e53948e75a2a271697712e845fa7fa4 Mon Sep 17 00:00:00 2001 From: TPTBusiness Date: Fri, 1 May 2026 13:57:31 +0200 Subject: [PATCH] fix(ci): lazy import logger in predix.py and cli.py to avoid ImportError in test env Wrapped in try/except ImportError with standard logging fallback. The rdagent.log module chain fails when predix.py is imported as a module in the CI test environment (kronos CLI tests). --- predix.py | 7 ++++++- rdagent/app/cli.py | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/predix.py b/predix.py index b3d1df7e..69850f8b 100644 --- a/predix.py +++ b/predix.py @@ -18,7 +18,12 @@ load_dotenv(Path(__file__).parent / ".env") import typer from rich.console import Console -from rdagent.utils.env import logger +try: + from rdagent.utils.env import logger +except ImportError: + import logging + + logger = logging.getLogger(__name__) app = typer.Typer(help="Predix - AI Quantitative Trading Agent") console = Console() diff --git a/rdagent/app/cli.py b/rdagent/app/cli.py index d371849c..92c70dcf 100644 --- a/rdagent/app/cli.py +++ b/rdagent/app/cli.py @@ -27,7 +27,12 @@ import typer from rich.console import Console from typing_extensions import Annotated -from rdagent.utils.env import logger +try: + from rdagent.utils.env import logger +except ImportError: + import logging + + logger = logging.getLogger(__name__) from rdagent.app.data_science.loop import main as data_science from rdagent.app.finetune.llm.loop import main as llm_finetune