Skip to content

Commit

Permalink
Revert "Change client __init__ to lazy import to avoid circular imports"
Browse files Browse the repository at this point in the history
This reverts commit 5ac1b64.
  • Loading branch information
brynn-code committed Apr 1, 2024
1 parent 5ac1b64 commit 8e35d0f
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/promptflow-devkit/promptflow/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,9 @@
# ---------------------------------------------------------
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore


_imported_attr = {}


# control plane sdk functions
# Use lazy import to avoid circular import
# Circular path: PFClient -> UserAgent -> client._version -> client.__init__ -> PFClient
def __getattr__(name):
if name in _imported_attr:
return _imported_attr[name]
if name in ["PFClient", "load_run", "load_flow"]:
from promptflow._sdk._load_functions import load_flow, load_run # noqa: F401
from .._sdk._pf_client import PFClient # noqa: F401
from promptflow._sdk._load_functions import load_flow, load_run

_imported_attr[name] = locals()[name]
return _imported_attr[name]
from .._sdk._pf_client import PFClient

raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
__all__ = ["PFClient", "load_run", "load_flow"]

0 comments on commit 8e35d0f

Please sign in to comment.