xrtm-data 0.2.2__tar.gz → 0.2.3__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 (40) hide show
  1. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/PKG-INFO +1 -1
  2. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/pyproject.toml +1 -1
  3. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/cli/__init__.py +12 -4
  4. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/version.py +1 -1
  5. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm_data.egg-info/PKG-INFO +1 -1
  6. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm_data.egg-info/SOURCES.txt +1 -0
  7. xrtm_data-0.2.3/tests/test_cli_ux.py +41 -0
  8. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/LICENSE +0 -0
  9. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/README.md +0 -0
  10. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/setup.cfg +0 -0
  11. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/__init__.py +0 -0
  12. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/core/__init__.py +0 -0
  13. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/core/interfaces.py +0 -0
  14. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/core/schemas/__init__.py +0 -0
  15. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/core/schemas/forecast.py +0 -0
  16. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/core/schemas/prior.py +0 -0
  17. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/core/schemas/trade.py +0 -0
  18. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/corpora/__init__.py +0 -0
  19. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/corpora/real_binary.py +0 -0
  20. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/kit/__init__.py +0 -0
  21. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/kit/processors/__init__.py +0 -0
  22. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/providers/__init__.py +0 -0
  23. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/providers/local/__init__.py +0 -0
  24. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/providers/local/csv.py +0 -0
  25. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/providers/online/__init__.py +0 -0
  26. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/providers/online/polymarket.py +0 -0
  27. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/providers/subgraph/__init__.py +0 -0
  28. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm/data/providers/subgraph/polymarket.py +0 -0
  29. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm_data.egg-info/dependency_links.txt +0 -0
  30. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm_data.egg-info/entry_points.txt +0 -0
  31. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm_data.egg-info/requires.txt +0 -0
  32. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/src/xrtm_data.egg-info/top_level.txt +0 -0
  33. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/tests/test_beta_fitter.py +0 -0
  34. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/tests/test_cli_loading.py +0 -0
  35. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/tests/test_local_datasource.py +0 -0
  36. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/tests/test_polymarket_source.py +0 -0
  37. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/tests/test_polymarket_subgraph.py +0 -0
  38. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/tests/test_prior_schemas.py +0 -0
  39. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/tests/test_real_binary_corpus.py +0 -0
  40. {xrtm_data-0.2.2 → xrtm_data-0.2.3}/tests/test_schemas.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xrtm-data
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: The Snapshot Vault for XRTM.
5
5
  Author-email: XRTM Team <moy@xrtm.org>
6
6
  License-Expression: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "xrtm-data"
7
- version = "0.2.2"
7
+ version = "0.2.3"
8
8
  description = "The Snapshot Vault for XRTM."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -75,6 +75,9 @@ def collect(
75
75
  xrtm-data collect -m 0x1234... -d 30 -o data/trades.parquet
76
76
  """
77
77
  output_path = Path(output)
78
+ output_suffix = output_path.suffix.lower()
79
+ if output_suffix not in {".parquet", ".json"}:
80
+ raise click.ClickException("Output path must end with .parquet or .json")
78
81
 
79
82
  # Check cache
80
83
  if output_path.exists() and not force:
@@ -124,10 +127,12 @@ def collect(
124
127
  # Save output
125
128
  output_path.parent.mkdir(parents=True, exist_ok=True)
126
129
 
127
- if output_path.suffix == ".parquet":
130
+ if output_suffix == ".parquet":
128
131
  _save_parquet(window, output_path)
129
- else:
132
+ elif output_suffix == ".json":
130
133
  _save_json(window, output_path)
134
+ else: # pragma: no cover - guarded before collection
135
+ raise click.ClickException("Output path must end with .parquet or .json")
131
136
 
132
137
  console.print(f"[green]✓ Saved {len(window.trades)} trades to:[/green] {output_path}")
133
138
 
@@ -214,8 +219,9 @@ def info(file_path: str):
214
219
  Displays summary statistics for trade files or prior files.
215
220
  """
216
221
  path = Path(file_path)
222
+ suffix = path.suffix.lower()
217
223
 
218
- if path.suffix == ".json":
224
+ if suffix == ".json":
219
225
  with open(path) as f:
220
226
  data = json.load(f)
221
227
 
@@ -230,7 +236,7 @@ def info(file_path: str):
230
236
  ))
231
237
  else:
232
238
  console.print(f"JSON file with {len(data)} keys")
233
- elif path.suffix == ".parquet":
239
+ elif suffix == ".parquet":
234
240
  import pyarrow.parquet as pq
235
241
 
236
242
  table = pq.read_table(path)
@@ -240,6 +246,8 @@ def info(file_path: str):
240
246
  f"Columns: {table.column_names}",
241
247
  title=path.name,
242
248
  ))
249
+ else:
250
+ raise click.ClickException("Unsupported file type. Expected .json or .parquet")
243
251
 
244
252
 
245
253
  def _save_parquet(window, path: Path) -> None:
@@ -21,7 +21,7 @@ This module provides the single source of truth for the package version.
21
21
 
22
22
  __all__ = ["__version__", "__author__", "__contact__", "__license__", "__copyright__"]
23
23
 
24
- __version__ = "0.2.2"
24
+ __version__ = "0.2.3"
25
25
  __author__ = "XRTM Team"
26
26
  __contact__ = "moy@xrtm.org"
27
27
  __license__ = "Apache-2.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xrtm-data
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: The Snapshot Vault for XRTM.
5
5
  Author-email: XRTM Team <moy@xrtm.org>
6
6
  License-Expression: Apache-2.0
@@ -29,6 +29,7 @@ src/xrtm_data.egg-info/requires.txt
29
29
  src/xrtm_data.egg-info/top_level.txt
30
30
  tests/test_beta_fitter.py
31
31
  tests/test_cli_loading.py
32
+ tests/test_cli_ux.py
32
33
  tests/test_local_datasource.py
33
34
  tests/test_polymarket_source.py
34
35
  tests/test_polymarket_subgraph.py
@@ -0,0 +1,41 @@
1
+ import json
2
+ from pathlib import Path
3
+
4
+ from click.testing import CliRunner
5
+
6
+ from xrtm.data.cli import main
7
+
8
+
9
+ def test_info_rejects_unsupported_suffix() -> None:
10
+ runner = CliRunner()
11
+
12
+ with runner.isolated_filesystem():
13
+ path = Path("trades.txt")
14
+ path.write_text("not a supported data file")
15
+
16
+ result = runner.invoke(main, ["info", str(path)])
17
+
18
+ assert result.exit_code != 0
19
+ assert "Unsupported file type" in result.output
20
+
21
+
22
+ def test_collect_rejects_unsupported_output_suffix_before_fetching() -> None:
23
+ runner = CliRunner()
24
+
25
+ result = runner.invoke(main, ["collect", "-m", "0x1234", "-o", "trades.txt"])
26
+
27
+ assert result.exit_code != 0
28
+ assert "Output path must end with .parquet or .json" in result.output
29
+
30
+
31
+ def test_info_accepts_json_file() -> None:
32
+ runner = CliRunner()
33
+
34
+ with runner.isolated_filesystem():
35
+ path = Path("prior.json")
36
+ path.write_text(json.dumps({"family": "beta", "alpha": 1, "beta": 2}))
37
+
38
+ result = runner.invoke(main, ["info", str(path)])
39
+
40
+ assert result.exit_code == 0
41
+ assert "Prior File" in result.output
File without changes
File without changes
File without changes