feat: per-user TOML config for default voice/speed/lang#19
Merged
Conversation
Adds a small config-file layer so users don't have to repeat `--voice bf_emma --speed 1.1` on every invocation. - Reads `$XDG_CONFIG_HOME/stackvox/config.toml` (falling back to `~/.config/stackvox/config.toml`) or whatever `STACKVOX_CONFIG` points at if set. - File format: a [defaults] table with `voice`, `speed`, `lang` keys. Per-key fallback to built-in engine defaults — set only what you care about. - Tolerant: missing file → built-ins, malformed TOML → warning + built-ins, wrong shape → warning + built-ins. Never blocks startup. - Argparse priority: CLI flag > config file > engine default. - tomllib on 3.11+, conditional `tomli>=2.0` dep on 3.10. - tests/test_config.py: path resolution (env + XDG + ~/.config), loading (missing/empty/full/partial/malformed/wrong-shape), and smoke tests that argparse defaults pick up the config (and that explicit flags still override it). - README gets a Configuration section showing the file. - mypy `ignore_missing_imports` extended to `tomli` so the 3.10 fallback branch type-checks on 3.11+. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2ff279d to
78189bf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Small config-file layer so users don't have to pass `--voice bf_emma --speed 1.1` on every invocation. Drop the values into a TOML file and they become argparse defaults; flags still override.
```toml
~/.config/stackvox/config.toml
[defaults]
voice = "bf_emma"
speed = 1.1
lang = "en-gb"
```
Resolution rules
Changes
Coverage
84 tests pass (was 73). Overall coverage: 87% → 87% (new module fully tested). `stackvox/config.py` at 100%.
Test plan