From d233f111040e0b125a1d995dca9d3ea0b8d8d1f1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Feb 2026 10:44:32 +0000 Subject: [PATCH] Improve conditional import with TYPE_CHECKING Co-authored-by: markwallace-microsoft <127216156+markwallace-microsoft@users.noreply.github.com> --- .../_workflows/_declarative_base.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/packages/declarative/agent_framework_declarative/_workflows/_declarative_base.py b/python/packages/declarative/agent_framework_declarative/_workflows/_declarative_base.py index 426cb36859..54c900df9b 100644 --- a/python/packages/declarative/agent_framework_declarative/_workflows/_declarative_base.py +++ b/python/packages/declarative/agent_framework_declarative/_workflows/_declarative_base.py @@ -30,7 +30,7 @@ import sys from collections.abc import Mapping from dataclasses import dataclass from decimal import Decimal as _Decimal -from typing import Any, Literal, cast +from typing import TYPE_CHECKING, Any, Literal, cast from agent_framework._workflows import ( Executor, @@ -44,7 +44,8 @@ try: _powerfx_available = True except (ImportError, RuntimeError): _powerfx_available = False - Engine = None # type: ignore[assignment, misc] + if TYPE_CHECKING: + from powerfx import Engine # type: ignore[assignment] if sys.version_info >= (3, 11): from typing import TypedDict # type: ignore # pragma: no cover