spot-sdk-python 1.2.0__tar.gz → 1.2.1__tar.gz

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.
Files changed (29) hide show
  1. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/PKG-INFO +3 -3
  2. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/README.md +2 -2
  3. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/pyproject.toml +1 -1
  4. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/analyzer_base.py +13 -6
  5. spot_sdk_python-1.2.1/spot_sdk/config_helpers.py +34 -0
  6. spot_sdk_python-1.2.0/spot_sdk/config_helpers.py +0 -25
  7. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/__init__.py +0 -0
  8. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/analysis_context.py +0 -0
  9. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/analyzer.py +0 -0
  10. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/api_gateway.py +0 -0
  11. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/config.py +0 -0
  12. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/config_client.py +0 -0
  13. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/email.py +0 -0
  14. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/errors.py +0 -0
  15. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/knowledge.py +0 -0
  16. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/knowledge_tags.py +0 -0
  17. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/logging.py +0 -0
  18. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/ollama.py +0 -0
  19. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/orchestrator.py +0 -0
  20. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/plugin.py +0 -0
  21. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/results.py +0 -0
  22. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/retriever.py +0 -0
  23. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/settings_schema.py +0 -0
  24. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/testing/README.md +0 -0
  25. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/testing/__init__.py +0 -0
  26. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/testing/factories.py +0 -0
  27. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/testing/fake_knowledge_client.py +0 -0
  28. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/threat_levels.py +0 -0
  29. {spot_sdk_python-1.2.0 → spot_sdk_python-1.2.1}/spot_sdk/workflow.py +0 -0
@@ -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
@@ -226,7 +226,7 @@ where downstream analyzers can read it via `email.ctx.provider(...)`.
226
226
 
227
227
  The Knowledge Store is the platform's RAG layer: context providers
228
228
  deposit tagged documents, analyzers fetch them on demand. Neither side
229
- references the other — they share only the tag vocabulary.
229
+ references the other ; they share only the tag vocabulary.
230
230
 
231
231
  ```python
232
232
  from spot_sdk import KnowledgeClient, KnowledgeDocument, KnowledgeTag, chunk_text
@@ -272,7 +272,7 @@ Tag-expression syntax: `a`, `a+b` (AND), `a|b` (OR), `a+b|c`
272
272
  no tag filter.
273
273
 
274
274
  Workflow-declared `retrieval_limits` (stage-level caps on `top_k` and
275
- `min_score`) are enforced transparently by `for_analysis()` — the
275
+ `min_score`) are enforced transparently by `for_analysis()` ; the
276
276
  analyzer doesn't need to know about them.
277
277
 
278
278
  ### Testing
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "spot-sdk-python"
7
- version = "1.2.0"
7
+ version = "1.2.1"
8
8
  description = "Python SDK for SPOT platform - API contracts, models, and utilities"
9
9
  authors = ["SPOT Project <spot@sonn.lu>"]
10
10
  license = "Apache-2.0"
@@ -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
 
@@ -0,0 +1,34 @@
1
+ """Shared configuration helpers for SPOT analyzers."""
2
+
3
+ from typing import Any, TypeVar
4
+
5
+ from pydantic_settings import BaseSettings
6
+
7
+ T = TypeVar("T", bound=BaseSettings)
8
+
9
+
10
+ def merge_settings(settings_class: type[T], base: T, overrides: dict[str, Any]) -> T:
11
+ """Merge base settings with central overrides.
12
+
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``).
18
+
19
+ Args:
20
+ settings_class: The Pydantic Settings class (used for field discovery).
21
+ base: Base Settings instance from local env/defaults.
22
+ overrides: Override values from central config (any case).
23
+
24
+ Returns:
25
+ New Settings instance with overrides applied. Keys that do not
26
+ match any field on ``settings_class`` are silently dropped.
27
+ """
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
34
+ return base.model_copy(update=filtered)
@@ -1,25 +0,0 @@
1
- """Shared configuration helpers for SPOT analyzers."""
2
-
3
- from typing import Any, TypeVar
4
-
5
- from pydantic_settings import BaseSettings
6
-
7
- T = TypeVar("T", bound=BaseSettings)
8
-
9
-
10
- def merge_settings(settings_class: type[T], base: T, overrides: dict[str, Any]) -> T:
11
- """Merge base settings with central overrides.
12
-
13
- Only applies overrides for fields that exist in the Settings model.
14
-
15
- Args:
16
- settings_class: The Pydantic Settings class (used for field discovery).
17
- base: Base Settings instance from local env/defaults.
18
- overrides: Override values from central config.
19
-
20
- Returns:
21
- New Settings instance with overrides applied.
22
- """
23
- valid_keys = set(settings_class.model_fields.keys())
24
- filtered = {k: v for k, v in overrides.items() if k in valid_keys}
25
- return base.model_copy(update=filtered)