Slice 1: Project scaffold + config module #2

Closed
opened 2026-06-03 10:26:25 +02:00 by AlexKucera · 0 comments
AlexKucera commented 2026-06-03 10:26:25 +02:00 (Migrated from github.com)

Parent

#1

What to build

Project scaffolding and configuration module — the foundation everything else builds on.

Set up the Python project structure: pyproject.toml (with dependencies: httpx, pyyaml, rich; dev-deps: pytest, pytest-mock), virtual environment, librofm_downloader/ package with __init__.py, tests/ directory tree, tests/fixtures/ for API response JSON samples, and a CHANGELOG.md following Keep a Changelog.

Build the config module that:

  • Loads config.yaml (committed) and secrets.yaml (gitignored)
  • Deep-merges secrets over config (secrets win on conflict)
  • Validates all required fields are present
  • Rejects with a clear error if librofm.username or librofm.password are found in config.yaml
  • Applies sensible defaults for optional fields (e.g., format defaults to m4b_mp3_fallback, output dir to ./audiobooks)
  • Returns a typed config object (dataclass or TypedDict)

No other modules yet — this slice is purely project structure + config loading/validation.

Acceptance criteria

  • pyproject.toml exists with runtime deps (httpx, pyyaml, rich) and test deps (pytest, pytest-mock)
  • Virtual environment set up and dependencies install cleanly
  • librofm_downloader/ package created with __init__.py
  • librofm_downloader/config.py loads and validates config.yaml + secrets.yaml
  • Secrets deep-merge override works (secret value beats config value)
  • Script exits with clear error if credentials found in config.yaml
  • Script exits with clear error if required fields missing
  • Defaults applied for optional fields (format, output dir, download_extras, download_covers)
  • CHANGELOG.md created (Keep a Changelog format, initial Unreleased section)
  • tests/test_config.py with ~25 tests covering: valid YAML, missing fields, invalid format values, secrets merge, cred rejection, defaults, edge cases
  • All tests pass

Blocked by

None - can start immediately

## Parent #1 ## What to build Project scaffolding and configuration module — the foundation everything else builds on. Set up the Python project structure: `pyproject.toml` (with dependencies: httpx, pyyaml, rich; dev-deps: pytest, pytest-mock), virtual environment, `librofm_downloader/` package with `__init__.py`, `tests/` directory tree, `tests/fixtures/` for API response JSON samples, and a `CHANGELOG.md` following [Keep a Changelog](https://keepachangelog.com/). Build the **config** module that: - Loads `config.yaml` (committed) and `secrets.yaml` (gitignored) - Deep-merges secrets over config (secrets win on conflict) - Validates all required fields are present - **Rejects with a clear error** if `librofm.username` or `librofm.password` are found in `config.yaml` - Applies sensible defaults for optional fields (e.g., format defaults to `m4b_mp3_fallback`, output dir to `./audiobooks`) - Returns a typed config object (dataclass or TypedDict) No other modules yet — this slice is purely project structure + config loading/validation. ## Acceptance criteria - [ ] `pyproject.toml` exists with runtime deps (httpx, pyyaml, rich) and test deps (pytest, pytest-mock) - [ ] Virtual environment set up and dependencies install cleanly - [ ] `librofm_downloader/` package created with `__init__.py` - [ ] `librofm_downloader/config.py` loads and validates `config.yaml` + `secrets.yaml` - [ ] Secrets deep-merge override works (secret value beats config value) - [ ] Script exits with clear error if credentials found in `config.yaml` - [ ] Script exits with clear error if required fields missing - [ ] Defaults applied for optional fields (format, output dir, download_extras, download_covers) - [ ] `CHANGELOG.md` created (Keep a Changelog format, initial Unreleased section) - [ ] `tests/test_config.py` with ~25 tests covering: valid YAML, missing fields, invalid format values, secrets merge, cred rejection, defaults, edge cases - [ ] All tests pass ## Blocked by None - can start immediately
Sign in to join this conversation.