spot-sdk-python 1.2.0__py3-none-any.whl → 1.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
spot_sdk/analyzer_base.py CHANGED
@@ -120,18 +120,25 @@ def settings_singleton(func: Callable[[], T]) -> Callable[[], T]:
120
120
  def merge_settings(base: T, overrides: dict[str, Any]) -> T:
121
121
  """Merge base settings with central config overrides.
122
122
 
123
- Only applies overrides for fields that actually exist in the Settings model.
124
- Returns a new Settings instance (the original is not mutated).
123
+ Override keys match the Pydantic field names case-insensitively, so
124
+ the dashboard's uppercase convention (``MODEL_PATH``, ``USE_GPU``)
125
+ maps onto the lowercase Python field names. Keys with no
126
+ corresponding field are silently dropped.
125
127
 
126
128
  Args:
127
129
  base: Base Settings instance from local env/defaults
128
- overrides: Dict of override values from central config
130
+ overrides: Dict of override values from central config (any case)
129
131
 
130
132
  Returns:
131
- New Settings instance with overrides applied.
133
+ New Settings instance with overrides applied. The original is
134
+ not mutated.
132
135
  """
133
- valid_keys = set(type(base).model_fields.keys())
134
- filtered = {k: v for k, v in overrides.items() if k in valid_keys}
136
+ field_by_lower = {name.lower(): name for name in type(base).model_fields}
137
+ filtered: dict[str, Any] = {}
138
+ for key, value in overrides.items():
139
+ canonical = field_by_lower.get(key.lower())
140
+ if canonical is not None:
141
+ filtered[canonical] = value
135
142
  return base.model_copy(update=filtered)
136
143
 
137
144
 
@@ -10,16 +10,25 @@ T = TypeVar("T", bound=BaseSettings)
10
10
  def merge_settings(settings_class: type[T], base: T, overrides: dict[str, Any]) -> T:
11
11
  """Merge base settings with central overrides.
12
12
 
13
- Only applies overrides for fields that exist in the Settings model.
13
+ Override keys are matched case-insensitively against the Pydantic
14
+ field names. This lets the dashboard / spot.yaml use the
15
+ operator-friendly uppercase convention (``MODEL_PATH``,
16
+ ``LISTEN_PORT``, ...) while the Settings class keeps the Python
17
+ lowercase convention (``model_path``, ``listen_port``).
14
18
 
15
19
  Args:
16
20
  settings_class: The Pydantic Settings class (used for field discovery).
17
21
  base: Base Settings instance from local env/defaults.
18
- overrides: Override values from central config.
22
+ overrides: Override values from central config (any case).
19
23
 
20
24
  Returns:
21
- New Settings instance with overrides applied.
25
+ New Settings instance with overrides applied. Keys that do not
26
+ match any field on ``settings_class`` are silently dropped.
22
27
  """
23
- valid_keys = set(settings_class.model_fields.keys())
24
- filtered = {k: v for k, v in overrides.items() if k in valid_keys}
28
+ field_by_lower = {name.lower(): name for name in settings_class.model_fields}
29
+ filtered: dict[str, Any] = {}
30
+ for key, value in overrides.items():
31
+ canonical = field_by_lower.get(key.lower())
32
+ if canonical is not None:
33
+ filtered[canonical] = value
25
34
  return base.model_copy(update=filtered)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spot-sdk-python
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: Python SDK for SPOT platform - API contracts, models, and utilities
5
5
  License: Apache-2.0
6
6
  Author: SPOT Project
@@ -247,7 +247,7 @@ where downstream analyzers can read it via `email.ctx.provider(...)`.
247
247
 
248
248
  The Knowledge Store is the platform's RAG layer: context providers
249
249
  deposit tagged documents, analyzers fetch them on demand. Neither side
250
- references the other — they share only the tag vocabulary.
250
+ references the other ; they share only the tag vocabulary.
251
251
 
252
252
  ```python
253
253
  from spot_sdk import KnowledgeClient, KnowledgeDocument, KnowledgeTag, chunk_text
@@ -293,7 +293,7 @@ Tag-expression syntax: `a`, `a+b` (AND), `a|b` (OR), `a+b|c`
293
293
  no tag filter.
294
294
 
295
295
  Workflow-declared `retrieval_limits` (stage-level caps on `top_k` and
296
- `min_score`) are enforced transparently by `for_analysis()` — the
296
+ `min_score`) are enforced transparently by `for_analysis()` ; the
297
297
  analyzer doesn't need to know about them.
298
298
 
299
299
  ### Testing
@@ -1,11 +1,11 @@
1
1
  spot_sdk/__init__.py,sha256=ccHl7iVJGpYKx7d39-TxjcAy0bFHRKByG2P0oDcys8w,2599
2
2
  spot_sdk/analysis_context.py,sha256=ghdGhmWUOrkCrrEZWNn9nbVinMW1kmtei2xOKZyVGBI,3605
3
3
  spot_sdk/analyzer.py,sha256=bDrXVOO5YlP6M9Vh390XczWVTsgUaJlbR2ziibQwsag,2594
4
- spot_sdk/analyzer_base.py,sha256=ADrVNfyxtZWRff9UCgN0IGzFWkCUioRHwOKw7MAbtHQ,10223
4
+ spot_sdk/analyzer_base.py,sha256=uQu6WQulvX8hdCmpcU6GUE-rDOv0STgtr-wYnzohI8M,10528
5
5
  spot_sdk/api_gateway.py,sha256=8p_CPqP77gQPqgiBQzgfHhco-j1GnoucOMEQKx9bM4A,6222
6
6
  spot_sdk/config.py,sha256=7nkYo4gJ4tWLAqoA_dNAzbmasPmSxw8WesyDJ9tm_IA,1878
7
7
  spot_sdk/config_client.py,sha256=7L9ws9UPYLgfZ-QsLl1MBlHXrRxjmi90Oy37vSnSfu8,6515
8
- spot_sdk/config_helpers.py,sha256=_L72GjQ339SUQhGweAZQLzeqCYr-NwfT-F2aLweRiDo,839
8
+ spot_sdk/config_helpers.py,sha256=rnSxYzkEmQ4WQDMBbzUEyHq9FPu_E930Vq-auGjlTPI,1337
9
9
  spot_sdk/email.py,sha256=uL7DIFOHCUN0aKTVb6zv8hmQN16GpJFQ2aBUqTfHdbI,4399
10
10
  spot_sdk/errors.py,sha256=HTaRaoDfn5XV4v03qD4eCM-IgNaR7upQ08UF-I-1qaI,813
11
11
  spot_sdk/knowledge.py,sha256=b1wNUrkFpqHK3nD65fT3n4adFA2cgeFhyoKs7E9gJmo,11930
@@ -23,6 +23,6 @@ spot_sdk/testing/factories.py,sha256=ADJL0JkzS3DsEc4m9T0seuzPJuQuF7aWJaBUbIdecgY
23
23
  spot_sdk/testing/fake_knowledge_client.py,sha256=aGLYqFHtHTqJvN0j1VDRmaLIgEEbpQyxuAC4XGJUuK4,3729
24
24
  spot_sdk/threat_levels.py,sha256=eRkd2GBS0TCKw4VGERkFYGMa-fxhrxB7TMa2UHi7e_Q,910
25
25
  spot_sdk/workflow.py,sha256=CYtAIuTJYN1qS0rmZzQXBrAgOYb46v8aCHJP7qzEHdU,4586
26
- spot_sdk_python-1.2.0.dist-info/METADATA,sha256=wOU34Td1IHmp5qC_ScrspGXCeQUOLrikG4h-2bMLqUA,10682
27
- spot_sdk_python-1.2.0.dist-info/WHEEL,sha256=Vz2fHgx6HFtSwhs8KvkHLqH5Ea4w1_rner5uNVGCeIE,88
28
- spot_sdk_python-1.2.0.dist-info/RECORD,,
26
+ spot_sdk_python-1.2.1.dist-info/METADATA,sha256=pz3IF_7tIiFPKOQ2zUo6w21Jg3xcQXgERH-c0gqYypo,10678
27
+ spot_sdk_python-1.2.1.dist-info/WHEEL,sha256=Vz2fHgx6HFtSwhs8KvkHLqH5Ea4w1_rner5uNVGCeIE,88
28
+ spot_sdk_python-1.2.1.dist-info/RECORD,,