This is reed, a convenient CLI for text-to-speech using piper-tts.
- uv — package manager and virtual environment tool
- Python 3.14+
- piper-tts (dependency in pyproject.toml, run via
uv run reed) - pypdf (PDF text extraction)
- stdlib
zipfile+xml.etree(EPUB reading — no external dependency) - macOS
afplayfor audio playback,pbpastefor clipboard access - Linux:
paplay/aplay/ffplayfor audio,wl-paste/xclip/xselfor clipboard - Windows:
powershell/ffplayfor audio,powershell Get-Clipboardfor clipboard - Rich (terminal UI library for styled output)
- Voice models stored in
~/.local/share/reed/(Linux/macOS) or%LOCALAPPDATA%\reed\(Windows)
reed.py— single-file CLI module, installed as console script via pyproject.toml
- Run:
reed 'text' - Read PDF:
reed -f doc.pdforreed -f doc.pdf --pages 1,3-5 - Read EPUB:
reed -f book.epuborreed -f book.epub --pages 1,3-5 - Interactive mode:
reed(launches automatically when no input provided) - List voices:
reed voices - Download voice:
reed download en_US-amy-medium - Typecheck:
mypy reed.py --ignore-missing-imports - Sync deps:
uv sync - Test (unit):
uv run pytest - Test (smoke):
echo 'test' | reed -o /dev/null
- Always write tests first (TDD) — create failing tests before implementing features
- Test file:
test_reed.pyusingpytest - Tests use dependency injection (fake
run,stdin,print_fn) to avoid real subprocess calls - The
reedmodule is imported directly (import reed as _reed) - Run full test suite before and after every change:
uv run pytest -v
- Single-file script, installed as console script via pyproject.toml
- Use
argparsefor CLI argument parsing - Use
subprocessto invoke piper and platform audio player - Default model auto-downloaded to
_data_dir()on first run ReedConfigdataclass for core configuration
- Use Rich library for terminal UI enhancements (colors, panels, spinners, tables)
- Banner styled with rich markup in
BANNER_MARKUPconstant - Visual feedback includes spinner during TTS generation
- Commands available in interactive mode:
/quit,/exit,/help,/clear,/replay - Tab autocomplete available for commands
- Include
print_fnparameter for testability with dependency injection