mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-22 05:24:18 +02:00
Add flag for disabling deprecation warnings
This commit is contained in:
parent
fae7f092ff
commit
3116ef3892
2 changed files with 21 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
"""FastMCP - An ergonomic MCP interface."""
|
||||
|
||||
import warnings
|
||||
from importlib.metadata import version
|
||||
from fastmcp.settings import Settings
|
||||
|
||||
|
|
@ -22,3 +23,9 @@ __all__ = [
|
|||
"settings",
|
||||
"Image",
|
||||
]
|
||||
|
||||
|
||||
if settings.deprecation_warnings:
|
||||
warnings.simplefilter("default", DeprecationWarning)
|
||||
else:
|
||||
warnings.simplefilter("ignore", DeprecationWarning)
|
||||
|
|
|
|||
|
|
@ -111,6 +111,20 @@ class Settings(BaseSettings):
|
|||
),
|
||||
] = True
|
||||
|
||||
deprecation_warnings: Annotated[
|
||||
bool,
|
||||
Field(
|
||||
description=inspect.cleandoc(
|
||||
"""
|
||||
Whether to show deprecation warnings. You can completely reset
|
||||
Python's warning behavior by running `warnings.resetwarnings()`.
|
||||
Note this will NOT apply to deprecation warnings from the
|
||||
settings class itself.
|
||||
""",
|
||||
)
|
||||
),
|
||||
] = True
|
||||
|
||||
client_raise_first_exceptiongroup_error: Annotated[
|
||||
bool,
|
||||
Field(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue