Skip to content

Add CLI threshold override#2129

Open
mturac wants to merge 2 commits into
data-privacy-stack:mainfrom
mturac:izon/fix-2101-cli-threshold
Open

Add CLI threshold override#2129
mturac wants to merge 2 commits into
data-privacy-stack:mainfrom
mturac:izon/fix-2101-cli-threshold

Conversation

@mturac

@mturac mturac commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Change Description

Adds a --threshold option to presidio-cli, validates it as a 0..1 confidence score, and applies it after loading the selected configuration so one-off runs can override the configured threshold without inline YAML or a temporary config file.

Also documents the flag and records the change in the unreleased changelog.

Issue reference

Fixes #2101

Tests

  • uv run --project presidio-cli --python python3.13 --with pytest --with pytest-mock pytest presidio-cli/tests -q
  • uv run --project presidio-cli --python python3.13 --with 'ruff==0.9.2' ruff check\n- printf 'hello\\n' | uv run --project presidio-cli --python python3.13 presidio --threshold 0.7 -\n\n## Checklist\n\n- [x] I have reviewed the contribution guidelines\n- [ ] I have signed the CLA (if required)\n- [x] My code includes unit tests\n- [x] All unit tests and lint checks pass locally\n- [x] My PR contains documentation updates / additions if required\n

@mturac mturac force-pushed the izon/fix-2101-cli-threshold branch from 8193c35 to 9610831 Compare June 29, 2026 05:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a --threshold override to presidio-cli, allowing one-off runs to set the minimum confidence score without editing or generating a YAML configuration file, aligning with the requested behavior in #2101.

Changes:

  • Added a --threshold CLI flag with 0..1 validation and applied it after config loading so it overrides configured values.
  • Added unit tests covering threshold override behavior and CLI value validation.
  • Updated CLI documentation and added an Unreleased changelog entry for the new flag.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
presidio-cli/presidio_cli/cli.py Adds --threshold parsing/validation and applies it as a post-config override.
presidio-cli/tests/test_cli.py Adds tests for threshold override precedence and threshold input validation.
presidio-cli/README.md Documents the config threshold field and shows an example of overriding it via --threshold.
CHANGELOG.md Records the new CLI flag under Unreleased changes.

Comment on lines +114 to +117
config_data="threshold: 0.2",
config_file=None,
files="",
threshold=0.8,
Comment on lines +136 to +140
stdin=True,
config_data=None,
config_file=str(config_file),
files="",
threshold=0.8,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add --threshold CLI flag to presidio-cli to override config-file threshold

3 participants