Spaces:
Running
Running
Jeremiah Lowin commited on
Commit ·
9dbf7f8
1
Parent(s): c4ab25d
Add flag for disabling deprecation warnings
Browse files- src/fastmcp/__init__.py +7 -0
- src/fastmcp/settings.py +14 -0
src/fastmcp/__init__.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
"""FastMCP - An ergonomic MCP interface."""
|
| 2 |
|
|
|
|
| 3 |
from importlib.metadata import version
|
| 4 |
from fastmcp.settings import Settings
|
| 5 |
|
|
@@ -22,3 +23,9 @@ __all__ = [
|
|
| 22 |
"settings",
|
| 23 |
"Image",
|
| 24 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
"""FastMCP - An ergonomic MCP interface."""
|
| 2 |
|
| 3 |
+
import warnings
|
| 4 |
from importlib.metadata import version
|
| 5 |
from fastmcp.settings import Settings
|
| 6 |
|
|
|
|
| 23 |
"settings",
|
| 24 |
"Image",
|
| 25 |
]
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
if settings.deprecation_warnings:
|
| 29 |
+
warnings.simplefilter("default", DeprecationWarning)
|
| 30 |
+
else:
|
| 31 |
+
warnings.simplefilter("ignore", DeprecationWarning)
|
src/fastmcp/settings.py
CHANGED
|
@@ -111,6 +111,20 @@ class Settings(BaseSettings):
|
|
| 111 |
),
|
| 112 |
] = True
|
| 113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
client_raise_first_exceptiongroup_error: Annotated[
|
| 115 |
bool,
|
| 116 |
Field(
|
|
|
|
| 111 |
),
|
| 112 |
] = True
|
| 113 |
|
| 114 |
+
deprecation_warnings: Annotated[
|
| 115 |
+
bool,
|
| 116 |
+
Field(
|
| 117 |
+
description=inspect.cleandoc(
|
| 118 |
+
"""
|
| 119 |
+
Whether to show deprecation warnings. You can completely reset
|
| 120 |
+
Python's warning behavior by running `warnings.resetwarnings()`.
|
| 121 |
+
Note this will NOT apply to deprecation warnings from the
|
| 122 |
+
settings class itself.
|
| 123 |
+
""",
|
| 124 |
+
)
|
| 125 |
+
),
|
| 126 |
+
] = True
|
| 127 |
+
|
| 128 |
client_raise_first_exceptiongroup_error: Annotated[
|
| 129 |
bool,
|
| 130 |
Field(
|