trodo-python 2.12.0__tar.gz → 2.14.0__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 (52) hide show
  1. {trodo_python-2.12.0 → trodo_python-2.14.0}/PKG-INFO +1 -1
  2. {trodo_python-2.12.0 → trodo_python-2.14.0}/pyproject.toml +1 -1
  3. {trodo_python-2.12.0 → trodo_python-2.14.0}/tests/test_prompts.py +5 -5
  4. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/__init__.py +1 -1
  5. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/managers/prompt_manager.py +10 -6
  6. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/prompts/compile.py +1 -1
  7. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/prompts/types.py +8 -1
  8. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo_python.egg-info/PKG-INFO +1 -1
  9. {trodo_python-2.12.0 → trodo_python-2.14.0}/README.md +0 -0
  10. {trodo_python-2.12.0 → trodo_python-2.14.0}/setup.cfg +0 -0
  11. {trodo_python-2.12.0 → trodo_python-2.14.0}/tests/test_anon_distinct_id.py +0 -0
  12. {trodo_python-2.12.0 → trodo_python-2.14.0}/tests/test_auto_instrument_fixes.py +0 -0
  13. {trodo_python-2.12.0 → trodo_python-2.14.0}/tests/test_cross_process_session.py +0 -0
  14. {trodo_python-2.12.0 → trodo_python-2.14.0}/tests/test_end_run.py +0 -0
  15. {trodo_python-2.12.0 → trodo_python-2.14.0}/tests/test_error_enrichment.py +0 -0
  16. {trodo_python-2.12.0 → trodo_python-2.14.0}/tests/test_llm_usage_cost.py +0 -0
  17. {trodo_python-2.12.0 → trodo_python-2.14.0}/tests/test_processor_methods.py +0 -0
  18. {trodo_python-2.12.0 → trodo_python-2.14.0}/tests/test_register_otel.py +0 -0
  19. {trodo_python-2.12.0 → trodo_python-2.14.0}/tests/test_start_run.py +0 -0
  20. {trodo_python-2.12.0 → trodo_python-2.14.0}/tests/test_wrap_agent_unchanged.py +0 -0
  21. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/api/__init__.py +0 -0
  22. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/api/async_client.py +0 -0
  23. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/api/endpoints.py +0 -0
  24. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/api/http_client.py +0 -0
  25. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/auto/__init__.py +0 -0
  26. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/auto/auto_event_manager.py +0 -0
  27. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/client.py +0 -0
  28. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/managers/__init__.py +0 -0
  29. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/managers/group_manager.py +0 -0
  30. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/managers/people_manager.py +0 -0
  31. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/otel/__init__.py +0 -0
  32. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/otel/auto_instrument.py +0 -0
  33. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/otel/context.py +0 -0
  34. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/otel/helpers.py +0 -0
  35. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/otel/processor.py +0 -0
  36. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/otel/register.py +0 -0
  37. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/otel/transport.py +0 -0
  38. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/otel/wrap_agent.py +0 -0
  39. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/prompts/__init__.py +0 -0
  40. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/prompts/template.py +0 -0
  41. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/queue/__init__.py +0 -0
  42. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/queue/batch_flusher.py +0 -0
  43. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/queue/event_queue.py +0 -0
  44. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/session/__init__.py +0 -0
  45. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/session/server_session.py +0 -0
  46. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/session/session_manager.py +0 -0
  47. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/types.py +0 -0
  48. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo/user_context.py +0 -0
  49. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo_python.egg-info/SOURCES.txt +0 -0
  50. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo_python.egg-info/dependency_links.txt +0 -0
  51. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo_python.egg-info/requires.txt +0 -0
  52. {trodo_python-2.12.0 → trodo_python-2.14.0}/trodo_python.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trodo-python
3
- Version: 2.12.0
3
+ Version: 2.14.0
4
4
  Summary: Trodo Analytics SDK for Python — server-side event tracking
5
5
  License: ISC
6
6
  Keywords: analytics,tracking,trodo,server-side
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "trodo-python"
7
- version = "2.12.0"
7
+ version = "2.14.0"
8
8
  description = "Trodo Analytics SDK for Python — server-side event tracking"
9
9
  readme = "README.md"
10
10
  license = { text = "ISC" }
@@ -81,7 +81,7 @@ PROMPT = {
81
81
  {"role": "system", "content": [{"type": "text", "text": "You are {{persona}}."}]},
82
82
  {"role": "user", "content": [{"type": "text", "text": "Hello {{who}}"}]},
83
83
  ],
84
- "model_config": {"provider": "openai", "model": "gpt-4o", "temperature": 0.3},
84
+ "model": {"provider": "openai", "model": "gpt-4o", "temperature": 0.3},
85
85
  "tools": [],
86
86
  "response_format": None,
87
87
  "variables": [
@@ -99,7 +99,7 @@ def test_compile_returns_structured_messages_not_a_string():
99
99
  assert out.messages[1]["content"][0] == {"type": "text", "text": "Hello world"}
100
100
 
101
101
 
102
- def test_compile_carries_model_config_and_tools():
102
+ def test_compile_carries_model_and_tools():
103
103
  out = compile_prompt(PROMPT, {"who": "world"})
104
104
  assert out.model == {"provider": "openai", "model": "gpt-4o", "temperature": 0.3}
105
105
  assert out.tools == []
@@ -132,7 +132,7 @@ def test_compile_treats_values_as_inert_data():
132
132
  def test_compile_coerces_declared_types():
133
133
  p = {
134
134
  "messages": [{"role": "user", "content": [{"type": "text", "text": "n={{n}}"}]}],
135
- "model_config": {},
135
+ "model": {},
136
136
  "tools": [],
137
137
  "response_format": None,
138
138
  "variables": [{"name": "n", "type": "number"}],
@@ -148,7 +148,7 @@ def test_compile_expands_placeholders_and_preserves_injected_messages():
148
148
  {"role": "system", "content": [{"type": "text", "text": "sys"}]},
149
149
  {"type": "placeholder", "name": "hist"},
150
150
  ],
151
- "model_config": {},
151
+ "model": {},
152
152
  "tools": [],
153
153
  "response_format": None,
154
154
  "variables": [{"name": "hist", "type": "messages"}],
@@ -211,7 +211,7 @@ def test_get_maps_wire_shape_and_binds_compile():
211
211
  assert p.version == 2
212
212
  assert p.labels == ["production"]
213
213
  assert p.tags == ["support"]
214
- assert p.model_config["model"] == "gpt-4o"
214
+ assert p.model["model"] == "gpt-4o"
215
215
  assert p.is_fallback is False
216
216
  assert p.compile(who="world").messages[1]["content"][0]["text"] == "Hello world"
217
217
 
@@ -41,7 +41,7 @@ Downstream microservice (join the caller's run instead of making a new one):
41
41
 
42
42
  from __future__ import annotations
43
43
 
44
- __version__ = "2.12.0"
44
+ __version__ = "2.13.0"
45
45
 
46
46
  from typing import Any, Callable, Dict, List, Optional, Union
47
47
 
@@ -16,7 +16,7 @@ from __future__ import annotations
16
16
 
17
17
  import threading
18
18
  import time
19
- from typing import Any, Callable, Dict, List, Optional, Set
19
+ from typing import Any, Callable, Dict, List, Optional, Set, Union
20
20
 
21
21
  from ..prompts.compile import CompileError, compile_prompt
22
22
  from ..prompts.template import TemplateError, render
@@ -38,7 +38,7 @@ __all__ = [
38
38
  DEFAULT_TTL_SECONDS = 60.0
39
39
 
40
40
 
41
- def _cache_key(name: str, version: Optional[int], label: Optional[str]) -> str:
41
+ def _cache_key(name: str, version: Optional[Union[int, str]], label: Optional[str]) -> str:
42
42
  # Resolution happens server-side on every fetch; the client only caches
43
43
  # under whatever selector was asked for. So a label flip propagates within
44
44
  # one TTL without the client knowing anything about labels.
@@ -73,9 +73,12 @@ def _to_prompt(raw: Dict[str, Any], is_fallback: bool = False) -> ManagedPrompt:
73
73
  description=raw.get("description"),
74
74
  tags=list(raw.get("tags") or []),
75
75
  version=int(raw.get("version") or 0),
76
+ version_hash=raw.get("version_hash"),
77
+ content_hash=raw.get("content_hash"),
78
+ parent_hash=raw.get("parent_hash"),
76
79
  labels=list(raw.get("labels") or []),
77
80
  messages=list(raw.get("messages") or []),
78
- model_config=dict(raw.get("model_config") or {}),
81
+ model=dict(raw.get("model") or {}),
79
82
  tools=list(raw.get("tools") or []),
80
83
  response_format=raw.get("response_format"),
81
84
  variables=_to_variables(raw.get("variables")),
@@ -172,7 +175,7 @@ class PromptManager:
172
175
  self,
173
176
  name: str,
174
177
  label: Optional[str] = None,
175
- version: Optional[int] = None,
178
+ version: Optional[Union[int, str]] = None,
176
179
  cache_ttl_seconds: Optional[float] = None,
177
180
  fallback: Optional[Dict[str, Any]] = None,
178
181
  max_retries: int = 2,
@@ -181,7 +184,8 @@ class PromptManager:
181
184
 
182
185
  Without arguments you get the version labelled ``production``; pass
183
186
  ``label`` to follow a different deploy label, or ``version`` to pin
184
- exactly.
187
+ exactly. ``version`` may be the integer ``version_no`` or a
188
+ ``version_hash`` (full, or an unambiguous short prefix like ``a3f9c2``).
185
189
 
186
190
  Availability ladder — fresh cache -> stale cache -> ``fallback`` ->
187
191
  raise. A prompt fetch is on your hot path, so a Trodo outage degrades
@@ -245,7 +249,7 @@ class PromptManager:
245
249
  "labels": [],
246
250
  "tags": [],
247
251
  "messages": fallback.get("messages") or [],
248
- "model_config": fallback.get("model_config") or {},
252
+ "model": fallback.get("model") or {},
249
253
  "tools": [],
250
254
  "response_format": None,
251
255
  "variables": fallback.get("variables") or [],
@@ -175,7 +175,7 @@ def compile_prompt(prompt: Any, values: Optional[Dict[str, Any]] = None) -> Comp
175
175
 
176
176
  return CompiledPrompt(
177
177
  messages=out,
178
- model=get("model_config") or {},
178
+ model=get("model") or {},
179
179
  tools=get("tools") or [],
180
180
  response_format=get("response_format"),
181
181
  )
@@ -54,11 +54,18 @@ class ManagedPrompt:
54
54
 
55
55
  name: str
56
56
  messages: List[PromptNode] = field(default_factory=list)
57
- model_config: ModelConfig = field(default_factory=dict)
57
+ model: ModelConfig = field(default_factory=dict)
58
58
  tools: List[PromptTool] = field(default_factory=list)
59
59
  response_format: Optional[ResponseFormat] = None
60
60
  variables: List[PromptVariable] = field(default_factory=list)
61
61
  version: int = 0
62
+ #: Git-style commit id of this version (content + parent + message + author
63
+ #: + time). Stable and immutable — the recommended way to reference a version.
64
+ version_hash: Optional[str] = None
65
+ #: sha256 of the content; identical content shares it.
66
+ content_hash: Optional[str] = None
67
+ #: The preceding version's ``version_hash`` (None for the first).
68
+ parent_hash: Optional[str] = None
62
69
  labels: List[str] = field(default_factory=list)
63
70
  tags: List[str] = field(default_factory=list)
64
71
  description: Optional[str] = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trodo-python
3
- Version: 2.12.0
3
+ Version: 2.14.0
4
4
  Summary: Trodo Analytics SDK for Python — server-side event tracking
5
5
  License: ISC
6
6
  Keywords: analytics,tracking,trodo,server-side
File without changes
File without changes