xrtm-data 0.2.1__tar.gz → 0.2.2__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 (39) hide show
  1. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/PKG-INFO +2 -2
  2. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/pyproject.toml +2 -3
  3. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm/data/cli/__init__.py +1 -2
  4. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm/data/core/schemas/forecast.py +45 -8
  5. xrtm_data-0.2.2/src/xrtm/data/corpora/__init__.py +36 -0
  6. xrtm_data-0.2.2/src/xrtm/data/corpora/real_binary.py +506 -0
  7. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm/data/kit/processors/__init__.py +11 -5
  8. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm/data/providers/local/csv.py +74 -29
  9. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm/data/providers/online/polymarket.py +37 -2
  10. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm/data/version.py +1 -1
  11. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm_data.egg-info/PKG-INFO +2 -2
  12. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm_data.egg-info/SOURCES.txt +5 -0
  13. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/tests/test_beta_fitter.py +6 -0
  14. xrtm_data-0.2.2/tests/test_cli_loading.py +42 -0
  15. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/tests/test_local_datasource.py +74 -0
  16. xrtm_data-0.2.2/tests/test_polymarket_source.py +101 -0
  17. xrtm_data-0.2.2/tests/test_real_binary_corpus.py +110 -0
  18. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/tests/test_schemas.py +26 -0
  19. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/LICENSE +0 -0
  20. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/README.md +0 -0
  21. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/setup.cfg +0 -0
  22. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm/data/__init__.py +0 -0
  23. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm/data/core/__init__.py +0 -0
  24. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm/data/core/interfaces.py +0 -0
  25. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm/data/core/schemas/__init__.py +0 -0
  26. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm/data/core/schemas/prior.py +0 -0
  27. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm/data/core/schemas/trade.py +0 -0
  28. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm/data/kit/__init__.py +0 -0
  29. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm/data/providers/__init__.py +0 -0
  30. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm/data/providers/local/__init__.py +0 -0
  31. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm/data/providers/online/__init__.py +0 -0
  32. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm/data/providers/subgraph/__init__.py +0 -0
  33. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm/data/providers/subgraph/polymarket.py +0 -0
  34. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm_data.egg-info/dependency_links.txt +0 -0
  35. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm_data.egg-info/entry_points.txt +0 -0
  36. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm_data.egg-info/requires.txt +0 -0
  37. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/src/xrtm_data.egg-info/top_level.txt +0 -0
  38. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/tests/test_polymarket_subgraph.py +0 -0
  39. {xrtm_data-0.2.1 → xrtm_data-0.2.2}/tests/test_prior_schemas.py +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xrtm-data
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: The Snapshot Vault for XRTM.
5
5
  Author-email: XRTM Team <moy@xrtm.org>
6
- License: Apache-2.0
6
+ License-Expression: Apache-2.0
7
7
  Requires-Python: >=3.11
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "xrtm-data"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "The Snapshot Vault for XRTM."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
11
- license = {text = "Apache-2.0"}
11
+ license = "Apache-2.0"
12
12
  authors = [
13
13
  {name = "XRTM Team", email = "moy@xrtm.org"}
14
14
  ]
@@ -38,7 +38,6 @@ package-dir = {"" = "src"}
38
38
  packages = {find = {where = ["src"], include = ["xrtm*"], namespaces = true}}
39
39
 
40
40
  [tool.pytest.ini_options]
41
- pythonpath = ["src"]
42
41
  testpaths = ["tests"]
43
42
  asyncio_mode = "strict"
44
43
 
@@ -289,7 +289,6 @@ def _load_trades(path: Path) -> list:
289
289
  import pyarrow.parquet as pq
290
290
 
291
291
  table = pq.read_table(path)
292
- df = table.to_pandas()
293
292
  return [
294
293
  TradeEvent(
295
294
  price=row["price"],
@@ -298,7 +297,7 @@ def _load_trades(path: Path) -> list:
298
297
  maker=row["maker"],
299
298
  taker=row["taker"],
300
299
  )
301
- for _, row in df.iterrows()
300
+ for row in table.to_pylist()
302
301
  ]
303
302
  else:
304
303
  with open(path) as f:
@@ -28,7 +28,7 @@ Example:
28
28
  from datetime import datetime, timezone
29
29
  from typing import Any, Dict, List, Optional
30
30
 
31
- from pydantic import AliasChoices, BaseModel, ConfigDict, Field
31
+ from pydantic import AliasChoices, BaseModel, ConfigDict, Field, model_validator
32
32
 
33
33
 
34
34
  class MetadataBase(BaseModel):
@@ -202,6 +202,41 @@ class ForecastOutput(BaseModel):
202
202
  calibration_metrics: Dict[str, Any] = Field(default_factory=dict, description="Performance metrics")
203
203
  metadata: MetadataBase = Field(default_factory=MetadataBase) # type: ignore[arg-type]
204
204
 
205
+ @model_validator(mode="before")
206
+ @classmethod
207
+ def _apply_reasoning_trace_alias(cls, data: Any) -> Any:
208
+ r"""Accept governance ``reasoning_trace`` as an alias for runtime trace fields."""
209
+ if not isinstance(data, dict) or "reasoning_trace" not in data:
210
+ return data
211
+
212
+ trace = data["reasoning_trace"]
213
+ updated = dict(data)
214
+ if isinstance(trace, dict):
215
+ if "reasoning" not in updated and isinstance(trace.get("narrative"), str):
216
+ updated["reasoning"] = trace["narrative"]
217
+
218
+ causal_graph = trace.get("causal_graph")
219
+ if isinstance(causal_graph, dict):
220
+ if "logical_trace" not in updated and "nodes" in causal_graph:
221
+ updated["logical_trace"] = causal_graph["nodes"]
222
+ if "logical_edges" not in updated and "edges" in causal_graph:
223
+ updated["logical_edges"] = causal_graph["edges"]
224
+ elif isinstance(trace, list) and "logical_trace" not in updated:
225
+ updated["logical_trace"] = trace
226
+
227
+ return updated
228
+
229
+ @property
230
+ def reasoning_trace(self) -> Dict[str, Any]:
231
+ r"""Governance-compatible alias for the narrative and causal graph trace."""
232
+ return {
233
+ "narrative": self.reasoning,
234
+ "causal_graph": {
235
+ "nodes": [node.model_dump(exclude_none=True) for node in self.logical_trace],
236
+ "edges": [edge.model_dump(exclude_none=True) for edge in self.logical_edges],
237
+ },
238
+ }
239
+
205
240
  @property
206
241
  def confidence(self) -> float:
207
242
  r"""Backward compatibility alias for probability."""
@@ -227,15 +262,17 @@ class ForecastOutput(BaseModel):
227
262
  except ImportError:
228
263
  raise ImportError("networkx is required for to_networkx(). Install it with 'uv add networkx'.")
229
264
  dg = nx.DiGraph()
230
- for node in self.logical_trace:
231
- dg.add_node(
265
+ dg.add_nodes_from(
266
+ (
232
267
  node.node_id,
233
- event=node.event,
234
- probability=node.probability,
235
- description=node.description,
268
+ {"event": node.event, "probability": node.probability, "description": node.description},
236
269
  )
237
- for edge in self.logical_edges:
238
- dg.add_edge(edge.source, edge.target, weight=edge.weight, description=edge.description)
270
+ for node in self.logical_trace
271
+ )
272
+ dg.add_edges_from(
273
+ (edge.source, edge.target, {"weight": edge.weight, "description": edge.description})
274
+ for edge in self.logical_edges
275
+ )
239
276
  return dg
240
277
 
241
278
 
@@ -0,0 +1,36 @@
1
+ # coding=utf-8
2
+ # Copyright 2026 XRTM Team. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ r"""Deterministic fixture corpora for offline validation."""
17
+
18
+ from xrtm.data.corpora.real_binary import (
19
+ REAL_BINARY_CORPUS_ID,
20
+ RealBinaryCorpusSource,
21
+ RealBinaryQuestionRecord,
22
+ load_real_binary_corpus,
23
+ load_real_binary_questions,
24
+ load_real_binary_resolved_outcomes,
25
+ validate_real_binary_corpus,
26
+ )
27
+
28
+ __all__ = [
29
+ "REAL_BINARY_CORPUS_ID",
30
+ "RealBinaryQuestionRecord",
31
+ "RealBinaryCorpusSource",
32
+ "load_real_binary_corpus",
33
+ "load_real_binary_questions",
34
+ "load_real_binary_resolved_outcomes",
35
+ "validate_real_binary_corpus",
36
+ ]