Jeremiah Lowin commited on
Commit
e2a36a0
·
1 Parent(s): a8582a5

Add docstring

Browse files
Files changed (1) hide show
  1. src/fastmcp/settings.py +11 -5
src/fastmcp/settings.py CHANGED
@@ -15,8 +15,18 @@ from pydantic_settings import (
15
  )
16
  from typing_extensions import Self
17
 
 
 
 
 
18
 
19
  class ExtendedEnvSettingsSource(EnvSettingsSource):
 
 
 
 
 
 
20
  def get_field_value(
21
  self, field: FieldInfo, field_name: str
22
  ) -> tuple[Any, str, bool]:
@@ -28,6 +38,7 @@ class ExtendedEnvSettingsSource(EnvSettingsSource):
28
  )
29
  if env_val is not None:
30
  if prefix == "FASTMCP_SERVER_":
 
31
  warnings.warn(
32
  "Using `FASTMCP_SERVER_` environment variables is deprecated. Use `FASTMCP_` instead.",
33
  DeprecationWarning,
@@ -42,11 +53,6 @@ class ExtendedSettingsConfigDict(SettingsConfigDict, total=False):
42
  env_prefixes: list[str] | None
43
 
44
 
45
- LOG_LEVEL = Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
46
-
47
- DuplicateBehavior = Literal["warn", "error", "replace", "ignore"]
48
-
49
-
50
  class Settings(BaseSettings):
51
  """FastMCP settings."""
52
 
 
15
  )
16
  from typing_extensions import Self
17
 
18
+ LOG_LEVEL = Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
19
+
20
+ DuplicateBehavior = Literal["warn", "error", "replace", "ignore"]
21
+
22
 
23
  class ExtendedEnvSettingsSource(EnvSettingsSource):
24
+ """
25
+ A special EnvSettingsSource that allows for multiple env var prefixes to be used.
26
+
27
+ Raises a deprecation warning if the old `FASTMCP_SERVER_` prefix is used.
28
+ """
29
+
30
  def get_field_value(
31
  self, field: FieldInfo, field_name: str
32
  ) -> tuple[Any, str, bool]:
 
38
  )
39
  if env_val is not None:
40
  if prefix == "FASTMCP_SERVER_":
41
+ # Deprecated in 2.8.0
42
  warnings.warn(
43
  "Using `FASTMCP_SERVER_` environment variables is deprecated. Use `FASTMCP_` instead.",
44
  DeprecationWarning,
 
53
  env_prefixes: list[str] | None
54
 
55
 
 
 
 
 
 
56
  class Settings(BaseSettings):
57
  """FastMCP settings."""
58