{"id":18733528,"url":"https://github.com/insightsengineering/presidio-cli","last_synced_at":"2025-08-08T20:16:50.861Z","repository":{"id":43693038,"uuid":"437851082","full_name":"insightsengineering/presidio-cli","owner":"insightsengineering","description":"CLI tool that analyze Text for PII Entities with Microsoft Presidio framework.","archived":false,"fork":false,"pushed_at":"2024-04-29T16:22:15.000Z","size":140,"stargazers_count":5,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-23T08:17:23.632Z","etag":null,"topics":["pii","presidio","python"],"latest_commit_sha":null,"homepage":"https://github.com/insightsengineering/presidio-cli","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/insightsengineering.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2021-12-13T11:43:45.000Z","updated_at":"2025-01-16T15:44:07.000Z","dependencies_parsed_at":"2023-01-31T04:45:57.793Z","dependency_job_id":null,"html_url":"https://github.com/insightsengineering/presidio-cli","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insightsengineering%2Fpresidio-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insightsengineering%2Fpresidio-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insightsengineering%2Fpresidio-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insightsengineering%2Fpresidio-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/insightsengineering","download_url":"https://codeload.github.com/insightsengineering/presidio-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248613541,"owners_count":21133530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pii","presidio","python"],"created_at":"2024-11-07T15:10:13.611Z","updated_at":"2025-04-12T18:31:47.980Z","avatar_url":"https://github.com/insightsengineering.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Presidio CLI\n\n[![Test 🧪](https://github.com/insightsengineering/presidio-cli/actions/workflows/test-python.yaml/badge.svg)](https://github.com/insightsengineering/presidio-cli/actions/workflows/test-python.yaml)\n[![SuperLinter 🦸‍♀️](https://github.com/insightsengineering/presidio-cli/actions/workflows/lint.yaml/badge.svg)](https://github.com/insightsengineering/presidio-cli/actions/workflows/lint.yaml)\n[![PyPI license](https://img.shields.io/pypi/l/presidio-cli.svg)](https://pypi.python.org/pypi/presidio-cli/)\n[![PyPI version](https://badge.fury.io/py/presidio-cli.svg)](https://badge.fury.io/py/presidio-cli)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/Naereen/StrapDown.js/graphs/commit-activity)\n[![PyPI download month](https://img.shields.io/pypi/dm/presidio-cli.svg)](https://pypi.python.org/pypi/presidio-cli/)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/presidio-cli.svg)](https://pypi.python.org/pypi/presidio-cli/)\n\nCLI tool that analyzes text for PII Entities with [Microsoft Presidio framework](https://github.com/microsoft/presidio).\n\n## Prerequisities\n\n`Python` version: 3.8, 3.9, 3.10\n\n`pipenv` app installed:\n\n```shell\n# check if app is installed\npipenv --version\n\n# install, if not available\npip install pipenv\n```\n\n## Install `presidio-cli` in a virtual env\n\n### Install from Python Package Index\n\ninstall in current python env\n\n```shell\npython -m pip install presidio-cli\n```\n\ninstall required apps and presidio-cli in virtual environment\n\n```shell\npipenv install presidio-cli\n```\n\n### Install from source\n\n```shell\n# clone from git\ngit clone https://github.com/insightsengineering/presidio-cli\ncd presidio-cli\n# install required apps and presidio-cli\npipenv install --deploy --dev\n```\n\n## Install language models for `spaCy`\n\nLoad models for the English (en) language using the command presented below. For further information please visit section [models](https://spacy.io/models/en).\n\n```shell\npython -m spacy download en_core_web_sm\npython -m spacy download en_core_web_lg\n```\n\n## Configuration file syntax\n\nThe default configuration is taken from the `.presidiocli` file in a current directory.\n\nConfiguration file supports the following parameters in a yaml file:\n\n- language - by default only models and recognizers for `en` are available.\n The list of [languages](https://microsoft.github.io/presidio/analyzer/languages/) can be extended.\n\n- entities - limit list of recognized entities to be listed in parameter. It is mapped directly to `presidio framework`.\n  List of [supported entities](https://microsoft.github.io/presidio/supported_entities/)\n\n- ignore - list of ignored files/folders/directories based on pattern. It is recommended to ignore `Version Control` files, for example `.git`\n\nNote: a file requires at least one parameter to be set.\n\nAn example of yaml configuration file content:\n\n```yaml\n---\nlanguage: en\nignore: |\n  .git\n  *.cfg\nentities:\n  - PERSON\n  - CREDIT_CARD\n  - EMAIL_ADDRESS\n\n```\n\n## Run the Presidio CLI\n\nRun the Presidio CLI to execute [Presidio Analyzer](https://microsoft.github.io/presidio/analyzer/)\nwith specified configuration: language, threshold, entities and ignore pre-configured files/paths.\n\n### Configuration from a file\n\nAn example of running script with configuration from a file.\n\nThere are two example `.yaml` configuration files in the [`conf`](presidio_cli/conf) directory:\n\n- [default.yaml](presidio_cli/conf/default.yaml) - ignore the `.git` directory\n- [limited.yaml](presidio_cli/conf/limited.yaml) - limit list of entities used to only 3 of them, ignore `.git` directory and `.cfg` files.  \n\n```shell\n# run with default configuration (file `.presidiocli`) in the current directory\npresidio .\n\n# run with configuration limited.yaml in the \"tests\" directory\npresidio -c presidio_cli/conf/limited.yaml tests/\n\n# run with configuration limited.yaml in single file only tests/test_analyzer.py\npresidio -c presidio_cli/conf/limited.yaml tests/test_analyzer.py\n```\n\n### Configuration as a parameter\n\nAn example of using configuration as data in parameter:\n\n```shell\n# ignore paths .git and *.cfg\npresidio -d \"ignore: |\n  .git\n  *.cfg\" tests/\n\n# limit list of entities to CREDIT_CARD\npresidio-d \"entities:\n  - CREDIT_CARD\" tests/\n\n# equivalent to use -c parameter \npresidio -d \"$(cat presidio_cli/conf/limited.yaml)\" tests/\n```\n\n### Formatting output\n\nOutput can be formatted using `-f` or `--format` parameter. The default format is `auto`.\n\nAvailable formats:\n\n- standard - standard output format\n\n```shell\npresidio -d \"entities:\n  - PERSON\" -f standard tests/conftest.py\n# result\ntests/conftest.py\n  34:58     0.85     PERSON\n  37:33     0.85     PERSON\n```\n\n- github - similar to diff function in github\n\n```shell\npresidio -d \"entities:\n  - PERSON\" -f github tests/conftest.py\n# result\n::group::tests/conftest.py\n::0.85 file=tests/conftest.py,line=34,col=58::34:58 [PERSON] \n::0.85 file=tests/conftest.py,line=37,col=33::37:33 [PERSON] \n::endgroup::\n```\n\n- colored - standard output format but with colors\n\n- parsable - easy to parse automaticaly\n\n```shell\npresidio -d \"entities:\n  - PERSON\" -f parsable tests/conftest.py\n# result\n{\"entity_type\": \"PERSON\", \"start\": 57, \"end\": 62, \"score\": 0.85, \"analysis_explanation\": null}\n{\"entity_type\": \"PERSON\", \"start\": 32, \"end\": 37, \"score\": 0.85, \"analysis_explanation\": null}\n```\n\n- auto - default format, switches automatically between those 2 modes:\n  - github, if run on github - environment variables `GITHUB_ACTIONS` and `GITHUB_WORKFLOW` are set\n  - colored, otherwise\n\n### List of all parameters\n\nSimply run the following to get a list of all available options for the CLI:\n\n```shell\npresidio --help\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsightsengineering%2Fpresidio-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finsightsengineering%2Fpresidio-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsightsengineering%2Fpresidio-cli/lists"}