Improve config handling and add root tests#63
Conversation
🤖 Automated First-Pass ReviewModel: SummaryThis PR improves configuration handling by deep-merging user config with defaults, adjusts CLI argument behavior, restructures tests into a pytest framework, enhances prompt loading, and updates documentation. New tests ensure correctness of config merging, CLI flags, and prompt loading. Recommendation📝 REQUEST_CHANGES — The PR introduces a new dependency 'audioop-lts' without justification and changes the '--config' CLI behavior in a backwards-incompatible way. |
|
|
||
| ## Configuration System | ||
|
|
||
| The tool uses a cascading configuration system with the following priority: |
There was a problem hiding this comment.
Changed '--config' behavior from expecting a directory in v0 to a JSON file in this PR is a breaking change. Old interface must be deprecated with warning or documented in migration notes, not just changed unconditionally.
|
|
||
| .DS_Store | ||
| .aider* | ||
|
|
There was a problem hiding this comment.
User config path '.gitignore' entry should match the new default config path used in the PR ('video_analyzer/config/config.json') rather than referencing the entire config directory.
| args = argparse.Namespace( | ||
| video_path="video.mp4", | ||
| config=str(config_path), | ||
| output=None, |
There was a problem hiding this comment.
The test for resolve_max_frames includes no validation that the CLI parameter works correctly with a negative value - this could silently produce invalid output. Should explicitly test min(1, args.max_frames) or similar behavior.
|
Thanks for contributing. |
Summary
--configaccept a user config JSON file path and clarify that behavior in the docs--output,--keep-frames, andmax_framesdevextra so test dependencies can be installed withpip install \".[dev]\"Details
Config loading and CLI behavior
default_config.jsonfirst, then deep-merge the user config on topclientsandaudioare initialized before CLI overrides are applied--outputtooutput_dir, which is the config key the CLI actually uses--keep-frameshandling so omitting the flag no longer overwriteskeep_framesfrom user configframes.max_framesmax_frameswith the expected precedence:--max-framesframes.max_framessys.maxsizePrompt loading
PromptLoaderprefer a user-specified prompt directory over packaged prompts so custom prompts can actually override defaultsTest setup
pytest.ini--outputmapping--keep-framesprecedencemax_framesconfig support and CLI precedencePackaging and contributor workflow
devextra insetup.py:pip install \".[dev]\"README.mdanddocs/CONTRIBUTING.mdDocumentation
docs/USAGES.mdto match current behaviorpromptsaudio.whisper_modelaudio.device--configpoints to a user config JSON file--max-framesdefault assys.maxsize (effectively no limit)Testing
python -m pytest -qResult