Skip to content

CLI Reference

SergeyGer edited this page Nov 23, 2026 · 4 revisions

CLI reference

The topomarket console script is installed with the package. Running from a fresh checkout without installation also works via python -m topomarket with PYTHONPATH=src.

Commands

topomarket --help
topomarket --version
topomarket demo [--json]
topomarket info [--profile {demo,private}]
topomarket validate [--profile {demo,private}] [--data-dir PATH]
topomarket status [--profile {demo,private}] [--data-dir PATH] [--json]
topomarket synthetic [--out PATH] [--seed INT]
topomarket import (--input-dir PATH | --input-zip PATH | --input PATH) [--output-dir PATH]
                   [--profile {demo,private}] [--registry PATH] [--reports PATH]
                   [--require SOURCE_ID]... [--strict] [--json]
topomarket report --data-dir PATH [--json]
topomarket refresh --data-dir PATH [--sources fred,cboe,french,ofr] [--json]
topomarket sources --data-dir PATH [--json]

demo

Generates the deterministic synthetic demo tables in memory and prints a summary (profile, data source, tables, row counts). Offline, no credentials, no private data. --json emits the machine-readable summary.

synthetic

Writes the spec-aligned synthetic tables to --out (default: temporary workspace) plus manifest.json:

  • sp500_daily.csv - date, sp500_close, price_source, sp500_log_return
  • industries_daily.csv - date, ind_<code>_return (12 industries)
  • tda_daily.csv - date, sp500_close, sp500_log_return, vix_close, 12 industry returns
  • manifest.json - synthetic flag, seed, generator version, per-file SHA-256 and row counts, latest_data_date

The same seed produces byte-identical tables.

import

Imports a private seed directory or ZIP into a local data directory (no network):

  • discovers the five suppliers by content/filename, writes the raw hash registry, parser reports and normalized tables;
  • publishes an atomic import manifest with a deterministic snapshot id;
  • --require asserts a source is present (repeatable); --strict treats optional-source failures as fatal.
topomarket import --input-dir /path/to/seed/raw --output-dir /path/to/data
topomarket import --input-zip /path/to/seed.zip --output-dir /path/to/data --json

report / status / validate

  • status shows the resolved profile, data source, manifest validity, snapshot count and latest data date for a profile or --data-dir.
  • validate validates a profile configuration or a local data directory (manifest hashes and snapshots); exits 2 on invalid data.
  • report prints per-source row counts/ranges, normalized table row counts, warnings and the active snapshot id for an imported data directory.
topomarket status --profile demo
topomarket status --data-dir ./data --json
topomarket validate --data-dir ./data
topomarket report --data-dir ./data

refresh

Fetches the fixed provider sources (conditional GET), stages and validates received bytes, merges them into the active snapshot and publishes a new immutable snapshot atomically. A failed required source aborts publication and keeps the last good snapshot active; an optional OFR failure is recorded as optional_failed. --sources accepts comma-separated source ids. A 304 keeps the current snapshot and publishes nothing. Writes stay inside --data-dir.

topomarket refresh --data-dir /path/to/data
topomarket refresh --data-dir /path/to/data --sources fred,cboe --json

sources

Shows the active snapshot and per-source freshness recorded by the last refresh (last attempt, last success, HTTP status, outcome, error). Useful after a failed or partial refresh.

topomarket sources --data-dir /path/to/data
topomarket sources --data-dir /path/to/data --json

Interactive dashboard

The Streamlit shell is not a CLI command; it runs from the repository root with the optional [ui] extra:

python -m pip install -e ".[ui]"
streamlit run app.py -- --profile demo
streamlit run app.py -- --profile private --data-dir /path/to/data

Without Streamlit, python app.py --profile demo prints the overview plus a plain-text four-screen summary. Frozen evaluation reports are discovered from reports/evaluation*.json written by topomarket evaluate --report-out.

release-check

Runs the offline Step 8 release checks: version consistency, repository hygiene, packaged JSON resources and profile-template parity, dependency lock, committed synthetic showcase hashes, deterministic synthetic fixture regeneration and offline public-mode smoke commands. Exits 2 when a check fails. --json emits the full report; --skip-smoke skips the fixture/smoke executions.

topomarket release-check
topomarket release-check --json --skip-smoke

Environment variables

Variable Used by Meaning
TOPOMARKET_DATA_DIR profiles Overrides the private profile data directory
TOPOMARKET_SEED_DIR opt-in tests Location of the private seed archive for the private acceptance suite only
PYTHONPATH source runs Add src and the repository root when not installing the package

Exit codes

Code Meaning
0 Success
2 Invalid usage/data (validation failure, missing input, parse error)
1 Unexpected error

Planned commands (Steps 3-8)

Snapshot switching/inspection, replay export and evaluation report commands will be added with their steps; see Roadmap and releases. Refresh and recovery operational details are in the runbook.

Clone this wiki locally