trodo-python 2.18.2__py3-none-any.whl → 2.20.0__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.
trodo/__init__.py CHANGED
@@ -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.18.0"
44
+ __version__ = "2.20.0"
45
45
 
46
46
  from typing import Any, Callable, Dict, List, Optional, Union
47
47
 
@@ -56,10 +56,12 @@ def _to_variables(raw: Any) -> List[PromptVariable]:
56
56
  out.append(v)
57
57
  elif isinstance(v, dict) and isinstance(v.get("name"), str):
58
58
  out.append(
59
+ # Named fields only — a stored version may carry keys this SDK
60
+ # no longer models (`required`, retired in 2.20.0), and fetching
61
+ # one must never raise.
59
62
  PromptVariable(
60
63
  name=v["name"],
61
64
  type=v.get("type") or "string",
62
- required=bool(v.get("required")),
63
65
  default=v.get("default"),
64
66
  description=v.get("description"),
65
67
  )
trodo/prompts/compile.py CHANGED
@@ -74,8 +74,10 @@ def build_scope(
74
74
  ) -> Dict[str, Any]:
75
75
  """Build the render scope from declarations + caller values.
76
76
 
77
- Resolution order: caller value declared default required-and-absent
78
- raises → optional-and-absent renders empty.
77
+ Resolution order: caller value -> declared default -> empty.
78
+
79
+ A missing value never raises. The one thing this does reject is a value for
80
+ a variable the prompt does not declare, which is almost always a typo.
79
81
  """
80
82
  errors: List[str] = []
81
83
  scope: Dict[str, Any] = {}
@@ -100,8 +102,10 @@ def build_scope(
100
102
  has = name in values
101
103
  value = values.get(name) if has else None
102
104
 
103
- # Missing value -> the declared default, or empty. Nothing is
104
- # "required": compile always succeeds with whatever the caller provides.
105
+ # A missing value resolves, it never fails: the declared default, or
106
+ # empty. That IS the point of declaring a default -- there is no third
107
+ # case where the caller has to have supplied something, and adding one
108
+ # would turn an empty render into a crash for no gain.
105
109
  if not has or value is None:
106
110
  value = default if has_default else ([] if type_ == "messages" else "")
107
111
 
trodo/prompts/types.py CHANGED
@@ -26,14 +26,18 @@ class PromptVariable:
26
26
  """A declared variable.
27
27
 
28
28
  Every competitor leaves variables undeclared and untyped — discovered by
29
- regex, with no defaults and no required-ness. The declaration is what lets
30
- ``compile()`` fail before the model call rather than shipping a literal
31
- ``{{typo}}`` and finding out from the bill.
29
+ regex, and with no defaults. Knowing the declared set is what lets
30
+ ``compile()`` catch a value passed for a variable that doesn't exist,
31
+ instead of silently rendering the wrong prompt.
32
+
33
+ A missing value never fails. It resolves to the declared ``default``, or to
34
+ empty — that is what declaring a default is FOR. There is deliberately no
35
+ ``required`` flag: it would give the author a decision to get wrong and the
36
+ caller a crash where an empty render would do.
32
37
  """
33
38
 
34
39
  name: str
35
40
  type: str = "string"
36
- required: bool = False
37
41
  default: Any = None
38
42
  description: Optional[str] = None
39
43
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trodo-python
3
- Version: 2.18.2
3
+ Version: 2.20.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
@@ -1,4 +1,4 @@
1
- trodo/__init__.py,sha256=LxN-qzeCDU_SpYs0gsZQxvdj5PuWd8cOBUqYGk9viLc,26928
1
+ trodo/__init__.py,sha256=ueM-l4KXHdP42DzvCRN9Zc5d4OsCxOSjiT-NIGAiLyQ,26928
2
2
  trodo/client.py,sha256=9UYaHZtWPMYdlG2xWVf77PQJ9DfFgN-zobTh60i8_Cc,22453
3
3
  trodo/types.py,sha256=eySgUvCXROG2TxtxgiU0MNr5iH0DEcduK8bmYtTKG44,3138
4
4
  trodo/user_context.py,sha256=uHCI2WYoOI3cNwdIUEuZdX4VYSu14pzm348ksn6hn_c,8195
@@ -13,7 +13,7 @@ trodo/managers/dataset_manager.py,sha256=gx0S8ujG3cbw4IskBNMdceBjDbcEh_nebwKSzEv
13
13
  trodo/managers/experiment_manager.py,sha256=V-vemLtenfSI5VIcP0HPiXzEy8AyTrRrbJVCA9Z6wjo,10579
14
14
  trodo/managers/group_manager.py,sha256=ki3Se3qEoSZfREX63oeDeBmEfZF-ISHLE8azEtLg0tM,3542
15
15
  trodo/managers/people_manager.py,sha256=mMVnx40Mlifx6NGgChvohC9ViK6dQu2mkXNHbV8pK1E,2882
16
- trodo/managers/prompt_manager.py,sha256=jFHkdvDSxvvb9c53EQvBQygdDJ7X-ylNWEY_ag_SeC0,11227
16
+ trodo/managers/prompt_manager.py,sha256=4xj_38b2qU31aTs5fIq-wNJnPisqf1zre0u8jvjZOF4,11375
17
17
  trodo/managers/user_manager.py,sha256=faJYX3CHrD7ulYiShV7FhThSMX9aJ3kdOgU4Qtdy5FM,2844
18
18
  trodo/otel/__init__.py,sha256=yiRFXWUU45bAM2CV37XeO7zf1hmnmjufdP4XO50yEyE,624
19
19
  trodo/otel/auto_instrument.py,sha256=Iae9A9lvh2PImE6gqnyEMXeRPRpjTxZcxx1zW2KDLac,21467
@@ -25,9 +25,9 @@ trodo/otel/register.py,sha256=bV_ePTfUvPugig2GZnylhzxi2QfoPWs96A9mGLPMrSQ,9387
25
25
  trodo/otel/transport.py,sha256=hzZz8gwSMGJ8CxdijmLn1Ljt18owr9XTWy13DLbwYbw,2441
26
26
  trodo/otel/wrap_agent.py,sha256=cJjrzlZNW2g6q_coLN7UR4uxn65h4u3-LNzMfE4dLVw,40999
27
27
  trodo/prompts/__init__.py,sha256=yunNc8WkTSfEEkRR-NZWXAt_ZB3Ee2INRh-4RE7uHj4,806
28
- trodo/prompts/compile.py,sha256=sEMl8EWdK0G9uOKGcgc39ujnA5RLCUtbk26TYVqK68Q,6345
28
+ trodo/prompts/compile.py,sha256=UhJhu-BtVicaauDEKpAXB17KhgVs4jWos_I60I8kZFk,6583
29
29
  trodo/prompts/template.py,sha256=obQiivPCR6LEdz7q1cby7uL25tYHYui4aoEaiUNqWfs,9357
30
- trodo/prompts/types.py,sha256=3oyrEDb1jfnC4gF02mM3izhNHstJ-bu-8TxoF7Yk6mQ,4425
30
+ trodo/prompts/types.py,sha256=A24njy6qcc8QNzWEfGu28BbBr360S7A5Pw7_ObIWNS4,4684
31
31
  trodo/queue/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  trodo/queue/batch_flusher.py,sha256=4Lg6T3Urwi9U0Q4FpFGPmjDYKg4ZliCTR-ND8BJvWaY,1298
33
33
  trodo/queue/event_queue.py,sha256=EVFZrhlq_kwC3jJ2GK0wMhHISf9UzLCZNDnT_aZ2I2A,872
@@ -36,7 +36,7 @@ trodo/session/server_session.py,sha256=McsudEiq33XDq3nqxgzBcUvIjQxCMscwEuAPnYXrT
36
36
  trodo/session/session_manager.py,sha256=7ht5LeeZX1HLLfPeNV_a8NkXGbHl3up0CRtCGr3EzjQ,2995
37
37
  trodo/util/__init__.py,sha256=Z9c4rPPdKg06Kk3byKheDqksSgR4WNvS475oQ5sNljc,54
38
38
  trodo/util/lru.py,sha256=QIsM7s6J_E9ZjiXatSyReZIEeGypTAcgrPWWy8YsRa4,2465
39
- trodo_python-2.18.2.dist-info/METADATA,sha256=UnFh9i8kRSmo6JfdHcRWy7dYGm7vGW714FgDC_5ckM8,25308
40
- trodo_python-2.18.2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
41
- trodo_python-2.18.2.dist-info/top_level.txt,sha256=VCQu1CJWFmNsqTs1YxMcw4Mq35Tc3z3uI9RwHEXAayQ,6
42
- trodo_python-2.18.2.dist-info/RECORD,,
39
+ trodo_python-2.20.0.dist-info/METADATA,sha256=EYdoY1cwgukIxmryCG6QadL0qiIz5J8harU3y7v6Q0Y,25308
40
+ trodo_python-2.20.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
41
+ trodo_python-2.20.0.dist-info/top_level.txt,sha256=VCQu1CJWFmNsqTs1YxMcw4Mq35Tc3z3uI9RwHEXAayQ,6
42
+ trodo_python-2.20.0.dist-info/RECORD,,