mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
small update in init (#189)
This commit is contained in:
committed by
GitHub
Unverified
parent
c30d726914
commit
2e6f6a4008
@@ -0,0 +1,32 @@
|
||||
# Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
import importlib
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
PACKAGE_EXTRA = "azure"
|
||||
|
||||
_IMPORTS = {
|
||||
"__version__": "agent_framework_azure",
|
||||
}
|
||||
|
||||
|
||||
def __getattr__(name: str) -> Any:
|
||||
if name in _IMPORTS:
|
||||
submod_name = _IMPORTS[name]
|
||||
try:
|
||||
module = importlib.import_module(submod_name, package=__name__)
|
||||
return getattr(module, name)
|
||||
except ModuleNotFoundError as exc:
|
||||
raise ModuleNotFoundError(
|
||||
f"The '{PACKAGE_EXTRA}' extra is not installed, "
|
||||
f"please do `pip install agent-framework[{PACKAGE_EXTRA}]`"
|
||||
) from exc
|
||||
raise AttributeError(f"module {__name__} has no attribute {name}")
|
||||
|
||||
|
||||
def __dir__() -> list[str]:
|
||||
return list(_IMPORTS.keys())
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from agent_framework_azure import __version__ # noqa: F401
|
||||
@@ -25,6 +25,7 @@ classifiers = [
|
||||
dependencies = [
|
||||
"openai>=1.94.0",
|
||||
"pydantic>=2.11.7",
|
||||
"pydantic-settings>=2.10.1",
|
||||
"typing-extensions>=4.14.0",
|
||||
]
|
||||
|
||||
@@ -33,9 +34,8 @@ azure = [
|
||||
"agent-framework-azure"
|
||||
]
|
||||
|
||||
[tool.uv]
|
||||
prerelease = "if-necessary-or-explicit"
|
||||
dev-dependencies = [
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
"pre-commit >= 3.7",
|
||||
"ruff>=0.11.8",
|
||||
"pytest>=8.4.1",
|
||||
@@ -69,12 +69,18 @@ dev-dependencies = [
|
||||
"redis",
|
||||
"sphinx-autobuild",
|
||||
]
|
||||
|
||||
[tool.uv]
|
||||
prerelease = "if-necessary-or-explicit"
|
||||
environments = [
|
||||
"sys_platform == 'darwin'",
|
||||
"sys_platform == 'linux'",
|
||||
"sys_platform == 'win32'"
|
||||
]
|
||||
|
||||
[tool.uv-dynamic-versioning]
|
||||
fallback-version = "0.0.0"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = 'tests'
|
||||
addopts = "-ra -q -r fEX"
|
||||
@@ -83,9 +89,6 @@ asyncio_default_fixture_loop_scope = "function"
|
||||
filterwarnings = []
|
||||
timeout = 120
|
||||
|
||||
[tool.uv-dynamic-versioning]
|
||||
fallback-version = "0.0.0"
|
||||
|
||||
[tool.ruff]
|
||||
extend = "../../pyproject.toml"
|
||||
|
||||
|
||||
@@ -1,18 +1,6 @@
|
||||
# Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
from pytest import mark
|
||||
|
||||
|
||||
@mark.xfail(reason="Not solved")
|
||||
def test_openai():
|
||||
try:
|
||||
from agent_framework.openai import __version__
|
||||
except ImportError:
|
||||
__version__ = None
|
||||
assert __version__ is not None
|
||||
|
||||
|
||||
@mark.xfail(reason="Not solved")
|
||||
def test_azure():
|
||||
try:
|
||||
from agent_framework.azure import __version__
|
||||
|
||||
Reference in New Issue
Block a user