Skip to main content

Python module for integrating Protegrity's Data Discovery and Protection APIs into GenAI and traditional applications.

Project description

Protegrity Developer Edition โ€“ protegrity-developer-python

Welcome to the protegrity-developer-python repository, part of the Protegrity Developer Edition suite. This repository provides the Python module for integrating Protegrity's Data Discovery and Protection APIs into GenAI and traditional applications. Customize, compile, and use the module as per your requirement.

๐Ÿ’กNote: This module should be built and used, only if you intend to change the source and default behavior.

๐Ÿ’กNote: Ensure that the Protegrity Developer Edition is running before installing this module. For setup instructions, please refer to the documentation here.

๐Ÿ“ฆ Repository Structure

.
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ pytest.ini
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ src
โ”‚   โ”œโ”€โ”€ protegrity_developer_python
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ””โ”€โ”€ securefind.py
โ””โ”€โ”€ tests
    โ”œโ”€โ”€ e2e
    โ”‚   โ”œโ”€โ”€ features
    โ”‚   โ”œโ”€โ”€ steps
    โ”‚   โ”œโ”€โ”€ data
    โ”‚   โ””โ”€โ”€ utils
    โ”‚   โ””โ”€โ”€ conftest.py
    โ”‚   โ””โ”€โ”€ README.md
    โ””โ”€โ”€ unit
        โ””โ”€โ”€ test_securefind.py

๐Ÿงฐ Features

  • Find and Redact provides the functionality for classifying PII in unstructured text.
  • Cross-platform support for the Linux, Windows, and MacOS operating systems.

Getting Started

Prerequisites

pip uninstall protegrity-developer-python

Build the protegrity-developer-python module

  1. Clone the repository.
    git clone https://github.com/Protegrity-Developer-Edition/protegrity-developer-python.git
    
  2. Navigate to the protegrity-developer-python directory in the cloned location.
  3. Activate the Python virtual environment.
  4. Install the dependencies.
    pip install -r requirements.txt
    
  5. Build and install the module by running the following command from the root directory of the repository.
    pip install .
    
    The installation completes and the success message is displayed.

๐Ÿงช Sample Usage

import protegrity_developer_python

protegrity_developer_python.configure(
    endpoint_url="http://localhost:8580/pty/data-discovery/v1.0/classify",
    named_entity_map={"PERSON": "NAME", "SOCIAL_SECURITY_NUMBER": "SSN"},
    masking_char="#",
    classification_score_threshold=0.6,
    method="redact",
    enable_logging=True,
    log_level="info"
)

input_text = "John Doe's SSN is 123-45-6789."
output_text = protegrity_developer_python.find_and_redact(input_text)
print(output_text)

๐Ÿ’กNote: Ensure that the Protegrity Developer Edition is running before executing this snippet. For setup instructions, please refer to the documentation here

๐Ÿ“„ Configuration

You can configure the SDK using a config.json file or programmatically. Key parameters include:

  • endpoint_url: URL of the Data Discovery classification API.
  • named_entity_map: Mapping of entity types to label.
  • masking_char: Character used for masking PII.
  • classification_score_threshold: Minimum score to consider classification.
  • method: redact or mask.
  • enable_logging: Enable or disable logging.
  • log_level: Set the logging level.

๐Ÿ“š Documentation

๐Ÿงช Sample Use Case

Use this repo to build GenAI applications like chatbots that:

  • Detect PII in prompts using the classifier.
  • Redact or mask sensitive data before processing.

๐Ÿ“œ License

See LICENSE for terms and conditions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

protegrity_developer_python-0.9.0rc6.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file protegrity_developer_python-0.9.0rc6.tar.gz.

File metadata

File hashes

Hashes for protegrity_developer_python-0.9.0rc6.tar.gz
Algorithm Hash digest
SHA256 ecc118826c2e321209db13ddba8130a92e2a709e74770d9e7cc3341d9ded6940
MD5 5600f834c51dda1e7e170b46c959a697
BLAKE2b-256 75e7b58d0d8e2f41b22dc29cb3e9920a96c36b9562ff55779093136d10124a75

See more details on using hashes here.

File details

Details for the file protegrity_developer_python-0.9.0rc6-py3-none-any.whl.

File metadata

File hashes

Hashes for protegrity_developer_python-0.9.0rc6-py3-none-any.whl
Algorithm Hash digest
SHA256 30a63d5b53ad62908d2e0df1bbabdc3afc758dfe4de9adc9d7d4e7d10d64ea13
MD5 7b5688dc315c1ced1f8157d291109980
BLAKE2b-256 7f615adc947b2941930e60d217b931508c18304cc1bfbd075a321da9d6468f95

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page