Jeremiah Lowin commited on
Commit
0bf61b1
·
1 Parent(s): 8b24d16

Remove second settings object; deprecate

Browse files
Files changed (1) hide show
  1. src/fastmcp/settings.py +19 -1
src/fastmcp/settings.py CHANGED
@@ -1,6 +1,7 @@
1
  from __future__ import annotations as _annotations
2
 
3
  import inspect
 
4
  from pathlib import Path
5
  from typing import Annotated, Any, Literal
6
 
@@ -258,4 +259,21 @@ class Settings(BaseSettings):
258
  ] = None
259
 
260
 
261
- settings = Settings()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  from __future__ import annotations as _annotations
2
 
3
  import inspect
4
+ import warnings
5
  from pathlib import Path
6
  from typing import Annotated, Any, Literal
7
 
 
259
  ] = None
260
 
261
 
262
+ def __getattr__(name: str):
263
+ """
264
+ Used to deprecate the module-level Image class; can be removed once it is no longer imported to root.
265
+ """
266
+ if name == "settings":
267
+ import fastmcp
268
+
269
+ settings = fastmcp.settings
270
+ # Deprecated in 2.10.2
271
+ if settings.deprecation_warnings:
272
+ warnings.warn(
273
+ "`from fastmcp.settings import settings` is deprecated. use `fasmtpc.settings` instead.",
274
+ DeprecationWarning,
275
+ stacklevel=2,
276
+ )
277
+ return settings
278
+
279
+ raise AttributeError(f"module '{__name__}' has no attribute '{name}'")