ettin-pii: Production-Ready PII Detection & Redaction Toolkit
A high-performance Python PII detection and anonymization library powered by the Ettin Nemotron PII model family (kalyan-ks/ettin-*-nemotron-pii), detecting 50+ Personally Identifiable Information (PII) entity types across healthcare, finance, legal, and cyber domains.
Supported Model Family
| Model Alias | Hugging Face Repository | Parameter Size | Best For |
|---|---|---|---|
"small" (Default) |
kalyan-ks/ettin-68m-nemotron-pii |
~68.5M | Maximum accuracy (~96.27% F1), server workloads, audit pipelines |
"tiny" |
kalyan-ks/ettin-32m-nemotron-pii |
~32M | Balanced speed and accuracy for real-time CPU processing |
"nano" |
kalyan-ks/ettin-17m-nemotron-pii |
~17.5M | Ultra-low latency, serverless functions (AWS Lambda), edge devices |
Features
- Structured Result Objects: Immutable
Entity,DetectionResult, andBatchDetectionResultdataclasses. - 4 Anonymization Strategies:
replace: Tag replacements like<EMAIL>,<NAME>,<SSN>.mask: Character masking with 3 sub-modes:full(****),alternate(a*e*.*u*p*y), andfirst_only(A*** M*****).fake: Format-preserving synthetic scramble preserving symbols, digits, and casing.custom: Dictionary mapping for specific entity types with automatic safe fallback.
- Unified Detection Pipeline: Polymorphic
.detect()method returning single or batch containers with mini-batch inference and adjacent entity stitching. - Summary Metrics & Density:
.statisticsreporting entity counts, unique types, and text density. - Multi-Format Exports:
.to_json(),.to_csv(),.to_dataframe(), and.to_dict()on both single and batch results. - CLI Tool:
ettin-piicommands fordetect,redact, andstats.
Installation
Using uv (recommended):
uv add ettin-pii
Or standard pip:
pip install ettin-pii
Quickstart
from ettin_pii import PIIDetector
# Initialize detector (model="small", "tiny", or "nano")
detector = PIIDetector(model="small", confidence_threshold=0.6)
# 1. Single text detection
result = detector.detect("Customer Alex Murphy (SSN: 987-65-4321) contacted us at alex.murphy@corp.org")
print(f"Found {result.num_entities} PII entities")
# 2. Multi-strategy redaction
print(result.redact(strategy="replace"))
# Output: Customer <NAME> (SSN: <SSN>) contacted us at <EMAIL>
print(result.redact(strategy="mask", mask_mode="first_only"))
# Output: Customer A*** M***** (SSN: 9**-**-****) contacted us at a***.m*****@corp.org
# 3. Export to Pandas DataFrame
df = result.to_dataframe()
print(df)
Command Line Interface (CLI)
# 1. Detect PII inline
ettin-pii detect "Call Dr. John at 555-0144"
# 2. Redact with tiny model and mask strategy
ettin-pii redact "Call Dr. John at 555-0144" --model tiny --strategy mask --mask-mode first_only
# 3. Redact file and save to disk
ettin-pii redact input.txt --output sanitized.txt
# 4. Generate summary statistics
ettin-pii stats "Customer John Doe, email: john@gmail.com, phone: 555-1234"
# 5. Generate summary statistics with verbose entity list
ettin-pii stats "Customer John Doe, email: john@gmail.com, phone: 555-1234" -v
# 6. Generate batch statistics across multi-line file
ettin-pii stats records.txt --batch
# 7. Redact multi-line records in batch mode
ettin-pii redact records.txt --batch --output clean_records.txt
License
MIT License.
Metadata
Release files for ettin-pii 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ettin_pii-0.1.0.tar.gz | 10.0 kB | Without provenance | Details for ettin_pii-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ettin_pii-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ettin_pii-0.1.0-py3-none-any.whl |
Total release size: 23.2 kB
Release files / ettin_pii-0.1.0.tar.gz
| Download URL | ettin_pii-0.1.0.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0acc6720e8493d42299da2b955972a85df0f41e034513dcb234f42c4ed76787c
|
|
BLAKE2b-256 checksum How to use checksums |
8d8d485b15b6a7494f7ceb8e71c7625b79c571f7236bfd9d871c74a8572f8095
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / ettin_pii-0.1.0-py3-none-any.whl
| Download URL | ettin_pii-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
74a2849d1317e475a736787ae24e36d708a38dfc24a7af1964513fd5f6ec7a3f
|
|
BLAKE2b-256 checksum How to use checksums |
f975637d4e0d742362e621df8a1844ff26dd04e2f4f922558f281c4903bcad77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for ettin-pii 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.