mask-pii for Python

Choose the Python implementation of mask-pii to mask email and phone PII in logs and data pipelines. The workflow remains easy to review.

Email masking

Masks the local part while keeping the domain visible.

Phone masking

Masks sensitive digits while preserving the format and visible suffix.

Builder-style API

Enable email and phone rules, and set the mask character explicitly before processing.

Install and run a first example

Install the verified PyPI release, load the Python API, and run the minimal example below. It enables both masking rules explicitly and records the expected output.

Installation

pip install mask-pii

Usage

example.py
from mask_pii import Masker

masker = (
    Masker()
    .mask_emails()
    .mask_phones()
    .with_mask_char("#")
)

input_text = "Contact: alice@example.com or 090-1234-5678."
output = masker.process(input_text)

print(output)
# => "Contact: a####@example.com or ###-####-5678."
Note

Please check the README for exact package ecosystem details and API examples for this language.