Spaces:
Running
Running
File size: 1,503 Bytes
ef5e55f 0683648 9dbf7f8 0345194 927e044 0345194 927e044 0345194 3acddf3 48f7143 1534a61 3acddf3 927e044 0683648 0345194 6bf02ba 2930e7a e782013 2930e7a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | """FastMCP - An ergonomic MCP interface."""
import warnings
from importlib.metadata import version as _version
from fastmcp.settings import Settings
from fastmcp.utilities.logging import configure_logging as _configure_logging
settings = Settings()
_configure_logging(
level=settings.log_level,
enable_rich_tracebacks=settings.enable_rich_tracebacks,
)
from fastmcp.server.server import FastMCP
from fastmcp.server.context import Context
import fastmcp.server
from fastmcp.client import Client
from . import client
__version__ = _version("fastmcp")
# ensure deprecation warnings are displayed by default
if settings.deprecation_warnings:
warnings.simplefilter("default", DeprecationWarning)
def __getattr__(name: str):
"""
Used to deprecate the module-level Image class; can be removed once it is no longer imported to root.
"""
if name == "Image":
# Deprecated in 2.8.1
if settings.deprecation_warnings:
warnings.warn(
"The top-level `fastmcp.Image` import is deprecated "
"and will be removed in a future version. "
"Please use `fastmcp.utilities.types.Image` instead.",
DeprecationWarning,
stacklevel=2,
)
from fastmcp.utilities.types import Image
return Image
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
__all__ = [
"FastMCP",
"Context",
"client",
"Client",
"settings",
]
|