Rust-backed Python library for detecting and redacting common PII in text
Project description
Redactix
Redactix is a lightweight Rust-backed Python library for detecting and redacting common PII in text.
Redactix is currently an alpha release. The detector set is intentionally small, and public APIs may change before a stable
1.0release.
- Rust-backed speed for high-throughput text redaction.
- Simple Python API for detection, redaction, and reporting.
- Lightweight design focused on common structured PII and custom regex detectors.
Default Detectors
| Name | Detection method | Validator |
|---|---|---|
email |
Regex | NULL |
phone |
Regex | Boundary checks; 10-15 digits; rejects repeated single-digit numbers |
credit_card |
Regex | Luhn checksum; 13-19 digits |
Comparison
Redactix is focused on lightweight, deterministic text redaction for common structured PII. It is intentionally smaller than full PII detection frameworks.
| Library | Difference |
|---|---|
| Redactix | Lightweight Rust-backed Python library with a simple API, built-in regex/validator detectors, custom regex detectors, and deterministic overlap resolution. |
| Microsoft Presidio | Much broader framework: NLP, regex, checksums, context-aware recognizers, multilingual support, text/images/structured data, Docker/PySpark/K8s options. More powerful but heavier. Source: Presidio README. |
| scrubadub | Python free-text scrubber with more built-in PII types: names, addresses, DOBs, URLs, credentials, SSNs, tax IDs, etc., plus optional/external detectors. Source: scrubadub docs. |
Installation
Install from PyPI:
pip install pyredactix
Import the package as:
import redactix
For local development builds:
uv run maturin develop
Quick Start
import redactix
redactor = redactix.Redactor(
detectors=["email", "credit_card"],
mask_strategy="placeholder",
)
redactor.register_detector(
name="employee_id",
pattern=r"\bEMP\d{6}\b",
placeholder="{{EMPLOYEE_ID}}",
enabled=True,
)
cleaned = redactor.redact(text)
detections = redactor.detect(text)
report = redactor.redact_with_report(text)
redact() returns only redacted text:
redactix.redact("Email alex@example.com")
# "Email {{EMAIL}}"
detect() returns structured Detection dataclasses:
[
redactix.Detection(
start=6,
end=22,
value="alex@example.com",
entity_type="EMAIL",
detector_name="email",
replacement="{{EMAIL}}",
)
]
redact_with_report() returns a RedactionResult dataclass with both the cleaned text and detections used for redaction.
Redactor API
redactix.Redactor(
detectors: Optional[Sequence[str]] = None,
mask_strategy: "placeholder" | "fixed" | "length_preserving" = "placeholder",
placeholder_format: str = "{{{entity_type}}}",
mask_char: str = "*",
fixed_mask: str = "***",
)
detectors=None enables all built-in detectors. Pass a subset such as ["email"] to enable only those detectors, or [] to start with no built-ins and register only custom detectors.
Masking Strategies
placeholderreplaces matches with stable placeholders such as{{EMAIL}}.fixedreplaces every match withfixed_mask, which defaults to***.length_preservingreplaces each Python character in the match withmask_char.
Examples:
redactix.redact("Email alex@example.com", mask_strategy="fixed")
# "Email ***"
redactix.redact("Email alex@example.com", mask_strategy="length_preserving")
# "Email ****************"
Custom Detectors
Register custom regex-based detectors on a Redactor:
redactor = redactix.Redactor(detectors=[])
redactor.register_detector(
name="employee_id",
pattern=r"\bEMP\d{6}\b",
placeholder="{{EMPLOYEE_ID}}",
enabled=True,
priority=100,
)
Detector names are normalized to lowercase identifiers for detector_name; placeholders and entity types use uppercase forms such as EMPLOYEE_ID.
Overlapping matches are resolved deterministically:
- Higher
prioritywins. - If priority is equal, the longer match wins.
- Remaining ties are resolved by source position and registration order.
Roadmap
- Add more common PII detectors and localized PII patterns.
- Add optional AI-powered NER detection for advanced use cases while keeping the core library lightweight.
Contributing
Development setup, test commands, and contribution guidance are documented in CONTRIBUTING.md.
License
Redactix is distributed under the MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyredactix-0.1.0.tar.gz.
File metadata
- Download URL: pyredactix-0.1.0.tar.gz
- Upload date:
- Size: 830.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4994626e70103bd0867a4e748d189da0d96524442a6bf2eac99607f365599589
|
|
| MD5 |
cf1277b8d9f967e670150ceea80ad53c
|
|
| BLAKE2b-256 |
42ba7b72830d40cfe11621bda6fb7803d81417b19d5f6ae08a49be15e30bf393
|
Provenance
The following attestation bundles were made for pyredactix-0.1.0.tar.gz:
Publisher:
release.yml on RikidWai/Redactix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyredactix-0.1.0.tar.gz -
Subject digest:
4994626e70103bd0867a4e748d189da0d96524442a6bf2eac99607f365599589 - Sigstore transparency entry: 1800063845
- Sigstore integration time:
-
Permalink:
RikidWai/Redactix@8ce47df530795f13d652790db19734539e6cba3e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/RikidWai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8ce47df530795f13d652790db19734539e6cba3e -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pyredactix-0.1.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: pyredactix-0.1.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 768.5 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06d9320eee14981b8a2e95be2f4f876a78b151e4d665153c0fce91b362245992
|
|
| MD5 |
7c285e61cea96d130f80daa7dfbc69e3
|
|
| BLAKE2b-256 |
2f3c24d6b6b0c0d337cb771c2d4cce6792c809c6eb37d28688ffec75944fa83a
|
Provenance
The following attestation bundles were made for pyredactix-0.1.0-cp39-abi3-win_amd64.whl:
Publisher:
release.yml on RikidWai/Redactix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyredactix-0.1.0-cp39-abi3-win_amd64.whl -
Subject digest:
06d9320eee14981b8a2e95be2f4f876a78b151e4d665153c0fce91b362245992 - Sigstore transparency entry: 1800064654
- Sigstore integration time:
-
Permalink:
RikidWai/Redactix@8ce47df530795f13d652790db19734539e6cba3e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/RikidWai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8ce47df530795f13d652790db19734539e6cba3e -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pyredactix-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pyredactix-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e217d05cd367d92b4a087c60ce2d219d5bc7d900b16cfd26a89969641ed8df30
|
|
| MD5 |
745449681ac3facc6dafbf1377c61a77
|
|
| BLAKE2b-256 |
cc6b3c3f66f4041f181b9118ecf498b59ca3f8a1d62be525207322d621cfe63f
|
Provenance
The following attestation bundles were made for pyredactix-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on RikidWai/Redactix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyredactix-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
e217d05cd367d92b4a087c60ce2d219d5bc7d900b16cfd26a89969641ed8df30 - Sigstore transparency entry: 1800064752
- Sigstore integration time:
-
Permalink:
RikidWai/Redactix@8ce47df530795f13d652790db19734539e6cba3e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/RikidWai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8ce47df530795f13d652790db19734539e6cba3e -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pyredactix-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: pyredactix-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 989.6 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6ab7405d5608bcd1dcdf2a5a19dc6c698ea95a226ff6f6d36c8945b3283e5ef
|
|
| MD5 |
216dad7f33e25479e9f074ad4e254e0e
|
|
| BLAKE2b-256 |
682c45dc18bd35aaf91615e6ced8648ded09f26865d055967ec154c670bd818a
|
Provenance
The following attestation bundles were made for pyredactix-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on RikidWai/Redactix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyredactix-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
c6ab7405d5608bcd1dcdf2a5a19dc6c698ea95a226ff6f6d36c8945b3283e5ef - Sigstore transparency entry: 1800064300
- Sigstore integration time:
-
Permalink:
RikidWai/Redactix@8ce47df530795f13d652790db19734539e6cba3e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/RikidWai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8ce47df530795f13d652790db19734539e6cba3e -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pyredactix-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyredactix-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 863.4 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a68cf9b75cdc93e500e45cf43779cbc79847acc21f32a1a03a042b8167aed3a
|
|
| MD5 |
05e7b0ae0586e6d57c8a80f5d5a3b9dc
|
|
| BLAKE2b-256 |
0e01e5ad6365d8491374947417b5ca5afb7bd906df45fa78064b921f5e7d6606
|
Provenance
The following attestation bundles were made for pyredactix-0.1.0-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on RikidWai/Redactix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyredactix-0.1.0-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
3a68cf9b75cdc93e500e45cf43779cbc79847acc21f32a1a03a042b8167aed3a - Sigstore transparency entry: 1800064027
- Sigstore integration time:
-
Permalink:
RikidWai/Redactix@8ce47df530795f13d652790db19734539e6cba3e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/RikidWai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8ce47df530795f13d652790db19734539e6cba3e -
Trigger Event:
workflow_dispatch
-
Statement type: