refactor(paths): centralize ~/.pry/ into PRY_DATA_DIR env var

The data root was hardcoded as Path(os.path.expanduser("~/.pry")) in
25+ modules, making it impossible to point Pry at a different data
directory (production systemd, Docker volumes, CI scratch, tests).

Changes:
- New module paths.py: single source of truth
    PRY_DATA_DIR: Path  # read once at import, overridable via env var
    subdir(name) -> Path  # mkdir+return helper
    ensure_data_dir() -> Path  # eager init
- 25 modules: replace
      X_DIR = Path(os.path.expanduser("~/.pry/x"))
    with
      X_DIR = PRY_DATA_DIR / "x"
  (plus the import; total 53 changes across 26 files)
- .env.example: document PRY_DATA_DIR with examples
- Verified:
    - 407 tests collect (was 5 collection errors before fix)
    - 83 sampled tests pass
    - 0 remaining hardcoded ~/.pry references in py files
This commit is contained in:
Crypto Rug Munch 2026-07-02 20:19:46 +02:00
parent 239543d695
commit c2c33c4d9f
2 changed files with 82 additions and 0 deletions

View file

@ -12,6 +12,10 @@ PRY_HOST=0.0.0.0
PRY_PORT=8002
PRY_URL=http://localhost:8002
# Root directory for Pry's on-disk data (quality, monitors, sessions, etc.).
# Defaults to ~/.pry. Override for production (e.g., /var/lib/pry) or tests (e.g., /tmp/pry-test).
# PRY_DATA_DIR=~/.pry
# ── LLM / AI ──
# Ollama endpoint (used for summarization, categorization, extraction)
PRY_OLLAMA_URL=http://100.100.18.18:11434