Dmitry Voropaev 645dfa1cc6 fix(cli): fix --no-warnings, exit code, github output and threshold config (#2266)
* fix(cli): make --no-warnings, the exit code and -f github work

PIIProblem never got the `level` attribute that show_problems() reads for
--no-warnings, so the flag crashed with AttributeError as soon as a file
had a finding. Findings now have level "error" (score 1.0) or "warning",
the same split the colored output already used.

show_problems() always returned 0 and run() overwrote its result for every
file, so the CLI exited with 0 even when it reported PII. show_problems()
now returns the number of findings it printed and run() adds them up, so
the exit code is 1 when any finding is reported.

-f github printed `::<score> file=...`, which is not a workflow command, so
GitHub Actions never created annotations. It now prints ::warning and
::error commands with escaped property values and message, and drops the
./ prefix that `presidio .` adds to file paths.

The problems test fixture used Mock objects, which create any attribute on
access and so hid the missing `level`; it now builds real PIIProblem
objects.

* fix(cli): validate the threshold read from the config file

PresidioCLIConfig.parse() range-checked the current threshold (the default
0) instead of the configured value, and only converted the configured
value afterwards. `threshold: 5` was accepted and filtered out every
finding, and `threshold: abc` raised an uncaught ValueError. The
configured value is now converted and range-checked before it is stored,
and invalid values raise PresidioCLIConfigError. This also covers YAML
booleans such as `true`, which float() would accept as 1.0, and integers
too large for a float.
2026-09-20 09:15:55 +00:00
2026-07-04 18:25:54 +03:00
2026-07-22 10:43:33 +03:00
2026-06-28 11:12:21 +03:00
2025-09-28 08:44:04 +03:00
2026-06-28 10:27:33 +03:00
2026-06-28 10:27:33 +03:00

Presidio - Data Protection and De-identification SDK

📣 Presidio has moved to a new home! Read more here 📣

Context aware, pluggable and customizable PII de-identification service for text and images.


Build Status MIT license Release OpenSSF Best Practices PyPI pyversions Discord

Component Downloads Coverage
Presidio Analyzer Pypi Downloads Coverage
Presidio Anonymizer Pypi Downloads Coverage
Presidio Image-Redactor Pypi Downloads Coverage
Presidio Structured Pypi Downloads Coverage

What is Presidio

Presidio (Origin from Latin praesidium protection, garrison) helps to ensure sensitive data is properly managed and governed. It provides fast identification and anonymization modules for private entities in text such as credit card numbers, names, locations, social security numbers, bitcoin wallets, US phone numbers, financial data and more.

Presidio demo gif


📘 Full documentation

📣 Project transition update

Frequently Asked Questions

💭 Demo

🛫 Examples


Goals

  • Allow organizations to preserve privacy in a simpler way by democratizing de-identification technologies and introducing transparency in decisions.
  • Embrace extensibility and customizability to a specific business need.
  • Facilitate both fully automated and semi-automated PII de-identification flows on multiple platforms.

Main features

  1. Predefined or custom PII recognizers leveraging Named Entity Recognition, regular expressions, rule based logic and checksum with relevant context in multiple languages.
  2. Options for connecting to external PII detection models.
  3. Multiple usage options, from Python or PySpark workloads through Docker to Kubernetes.
  4. Customizability in PII identification and de-identification.
  5. Module for redacting PII text in images (standard image types and DICOM medical images).

⚠️ Presidio can help identify sensitive/PII data in un/structured text. However, because it is using automated detection mechanisms, there is no guarantee that Presidio will find all sensitive information. Consequently, additional systems and protections should be employed.

Installing Presidio

  1. Using pip
  2. Using Docker
  3. From source
  4. Migrating from V1 to V2

Running Presidio

  1. Getting started
  2. Setting up a development environment
  3. PII de-identification in text
  4. PII de-identification in images
  5. Usage samples and example deployments

Support

Contributing

For details on contributing to this repository, see the contributing guide.

This project has adopted the Contributor Covenant Code of Conduct.

Contributors

Languages
Python 99.5%
HTML 0.2%
Dockerfile 0.2%