"""Inspect the small set of settings this demo needs. Python 3.9+."""
import os
from pathlib import Path
import sys


def main():
    print(f"cwd={Path.cwd()}", flush=True)
    print(f"python={sys.executable}", flush=True)
    print(f"venv={sys.prefix != sys.base_prefix}", flush=True)
    print(f"PATH={os.environ.get('PATH', '<unset>')}", flush=True)
    try:
        rows = Path("data.txt").read_text(encoding="utf-8").splitlines()
    except OSError as exc:
        print(f"ERROR: {exc}", file=sys.stderr)
        return 1
    if os.environ.get("REPORT_MODE") != "daily":
        print("ERROR: REPORT_MODE must be daily", file=sys.stderr)
        return 2
    count = sum(bool(row.strip()) for row in rows)
    print(f"OK: records={count}; mode=daily", flush=True)
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
