feat: add YAML/TOML/JSON config file loading#69
Merged
maskedsyntax merged 1 commit intomainfrom Mar 3, 2026
Merged
Conversation
…errides - Add `config_from_dict()` to config.py for building HashPrepConfig from a partial nested dict (unknown keys silently ignored, missing keys use defaults) - Add `hashprep/utils/config_loader.py` with `load_config(path)` supporting .yaml/.yml, .toml, and .json config files - Add `config: HashPrepConfig | None = None` parameter to DatasetAnalyzer so custom configs are respected at analysis time - Update all 11 check modules to read thresholds from `analyzer.config` at call time instead of frozen module-level constants - Add `--config PATH` option to scan, details, and report CLI commands - Export `HashPrepConfig` and `load_config` from the top-level `hashprep` package - Add `tests/test_config_loader.py` with 24 tests covering dict merging, YAML/JSON loading, error cases, and end-to-end threshold overrides - Fix `_FakeAnalyzer` in datetime, statistical_tests, and mutual_info tests to include a `config` attribute
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
config_from_dict()to build aHashPrepConfigfrom a partial nested dict - missing keys fall back to defaults, unknown keys are silently ignoredhashprep/utils/config_loader.pywithload_config(path)supporting.yaml/.yml,.toml, and.jsonconfig filesanalyzer.configat call time instead of frozen module-level constantsconfig: HashPrepConfig | None = NonetoDatasetAnalyzer.__init__--config PATHCLI option toscan,details, andreportcommandsHashPrepConfigandload_configfrom the top-levelhashpreppackageTest plan
tests/test_config_loader.py24 new tests:config_from_dictpartial overrides, YAML/JSON loading, error cases (missing file, bad extension), and end-to-end threshold overrides viaDatasetAnalyzer(config=...)🤖 Generated with Claude Code