trodo-python 2.13.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.13.0 → trodo_python-2.14.0}/PKG-INFO +1 -1
  2. {trodo_python-2.13.0 → trodo_python-2.14.0}/pyproject.toml +1 -1
  3. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/managers/prompt_manager.py +8 -4
  4. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/prompts/types.py +7 -0
  5. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo_python.egg-info/PKG-INFO +1 -1
  6. {trodo_python-2.13.0 → trodo_python-2.14.0}/README.md +0 -0
  7. {trodo_python-2.13.0 → trodo_python-2.14.0}/setup.cfg +0 -0
  8. {trodo_python-2.13.0 → trodo_python-2.14.0}/tests/test_anon_distinct_id.py +0 -0
  9. {trodo_python-2.13.0 → trodo_python-2.14.0}/tests/test_auto_instrument_fixes.py +0 -0
  10. {trodo_python-2.13.0 → trodo_python-2.14.0}/tests/test_cross_process_session.py +0 -0
  11. {trodo_python-2.13.0 → trodo_python-2.14.0}/tests/test_end_run.py +0 -0
  12. {trodo_python-2.13.0 → trodo_python-2.14.0}/tests/test_error_enrichment.py +0 -0
  13. {trodo_python-2.13.0 → trodo_python-2.14.0}/tests/test_llm_usage_cost.py +0 -0
  14. {trodo_python-2.13.0 → trodo_python-2.14.0}/tests/test_processor_methods.py +0 -0
  15. {trodo_python-2.13.0 → trodo_python-2.14.0}/tests/test_prompts.py +0 -0
  16. {trodo_python-2.13.0 → trodo_python-2.14.0}/tests/test_register_otel.py +0 -0
  17. {trodo_python-2.13.0 → trodo_python-2.14.0}/tests/test_start_run.py +0 -0
  18. {trodo_python-2.13.0 → trodo_python-2.14.0}/tests/test_wrap_agent_unchanged.py +0 -0
  19. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/__init__.py +0 -0
  20. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/api/__init__.py +0 -0
  21. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/api/async_client.py +0 -0
  22. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/api/endpoints.py +0 -0
  23. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/api/http_client.py +0 -0
  24. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/auto/__init__.py +0 -0
  25. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/auto/auto_event_manager.py +0 -0
  26. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/client.py +0 -0
  27. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/managers/__init__.py +0 -0
  28. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/managers/group_manager.py +0 -0
  29. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/managers/people_manager.py +0 -0
  30. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/otel/__init__.py +0 -0
  31. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/otel/auto_instrument.py +0 -0
  32. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/otel/context.py +0 -0
  33. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/otel/helpers.py +0 -0
  34. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/otel/processor.py +0 -0
  35. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/otel/register.py +0 -0
  36. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/otel/transport.py +0 -0
  37. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/otel/wrap_agent.py +0 -0
  38. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/prompts/__init__.py +0 -0
  39. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/prompts/compile.py +0 -0
  40. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/prompts/template.py +0 -0
  41. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/queue/__init__.py +0 -0
  42. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/queue/batch_flusher.py +0 -0
  43. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/queue/event_queue.py +0 -0
  44. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/session/__init__.py +0 -0
  45. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/session/server_session.py +0 -0
  46. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/session/session_manager.py +0 -0
  47. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/types.py +0 -0
  48. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo/user_context.py +0 -0
  49. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo_python.egg-info/SOURCES.txt +0 -0
  50. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo_python.egg-info/dependency_links.txt +0 -0
  51. {trodo_python-2.13.0 → trodo_python-2.14.0}/trodo_python.egg-info/requires.txt +0 -0
  52. {trodo_python-2.13.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.13.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.13.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" }
@@ -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,6 +73,9 @@ 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
81
  model=dict(raw.get("model") or {}),
@@ -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
@@ -59,6 +59,13 @@ class ManagedPrompt:
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.13.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