validata-py
Conceal sensitive data in Python — strings, emails, phone numbers, IDs, cards, payloads, and free text — with one import and one clean API.
Installation
pip install validata-py
Why validata-py?
Most masking libraries solve only one problem:
- Email masking
- Card masking
- Regex scrubbing
- Payload anonymization
You end up combining multiple libraries with inconsistent APIs.
validata-py keeps everything in one lightweight package:
- One import
- One class
- Consistent API
- Zero dependencies
- Production-ready utilities
- Preserves formatting automatically
Quick Start
from validata_py import Veil
# Generic string masking
Veil.cover("order-REF-99812", from_index=10)
# "order-REF-*****"
# Email masking
Veil.shield_email("alice@example.com")
# "a****@e******.com"
# Phone masking
Veil.shield_phone("+91 98765-43210", expose_last=4)
# "+91 *****-3210"
# Number masking
Veil.shield_number(987654321, expose_first=3)
# "987******"
# Card masking
Veil.shield_card("4111 1111 1111 1111")
# "**** **** **** 1111"
# CPF masking
Veil.shield_cpf("123.456.789-01")
# "123.***.789-01"
# CNPJ masking
Veil.shield_cnpj("12.345.678/0001-99")
# "12.***.***/**01-99"
Dictionary Payload Masking
from validata_py import Veil
payload = {
"name": "Priya Sharma",
"email": "priya@example.com",
"mobile": "+91-98765-43210",
"salary": 950000,
"pan": "ABCDE1234F",
}
blueprint = {
"name": "text",
"email": "email",
"mobile": "phone",
"salary": "zero",
"pan": "drop",
}
Veil.shield_payload(payload, blueprint)
Output:
{
"name": "P**********a",
"email": "p****@e******.com",
"mobile": "+91-*****-3210",
"salary": 0,
"pan": "**********",
}
Free Text PII Scrubbing
from validata_py import Veil
Veil.scrub_text(
"Reach me at dev@example.com or +91 9876543210"
)
# "Reach me at [EMAIL] or [PHONE]"
Features
- Generic string concealment
- Email masking
- Phone masking
- Card masking
- Integer masking
- CPF masking
- CNPJ masking
- Payload anonymization
- Regex-based PII detection
- Free-text scrubbing
- Preserves formatting characters
- No external dependencies
- Lightweight and fast
Full API
Veil.cover(text, char="*", from_index=0, length=None)
Mask part of any string.
Veil.cover("secret-token", from_index=3)
# "sec*********"
Veil.shield_email(email, char="*", reveal_user=1, reveal_host=1)
Mask email addresses.
Veil.shield_email("alice@example.com")
# "a****@e******.com"
Veil.shield_phone(phone, char="*", expose_last=4)
Mask phone numbers while preserving formatting.
Veil.shield_phone("+91 98765-43210")
# "+91 *****-3210"
Veil.shield_number(value, char="*", expose_first=2)
Mask integers.
Veil.shield_number(987654321)
# "98*******"
Veil.shield_card(card_number, char="*", expose_last=4)
Mask card numbers.
Veil.shield_card("4111 1111 1111 1111")
# "**** **** **** 1111"
Veil.shield_cpf(cpf, char="*")
Mask Brazilian CPF numbers.
Veil.shield_cnpj(cnpj, char="*")
Mask Brazilian CNPJ numbers.
Veil.shield_payload(data, blueprint, in_place=False)
Mask selected fields in dictionaries.
Blueprint strategies
| Strategy | Description |
|---|---|
"text" |
Conceal middle text |
"email" |
Apply email masking |
"phone" |
Apply phone masking |
"card" |
Apply card masking |
"zero" |
Replace value with zero |
"scramble" |
Randomize digits |
"drop" |
Replace entire value |
Veil.scrub_text(text, ...)
Automatically detect and scrub:
- Emails
- Phone numbers
- Card numbers
Project Structure
validata-py/
│
├── pyproject.toml
├── README.md
├── LICENSE
│
├── validata_py/
│ ├── __init__.py
│ └── veil.py
│
└── tests/
└── test_veil.py
Running Tests
Install development dependencies:
pip install pytest
Run tests:
pytest
Requirements
- Python 3.8+
License
MIT License
Author
Vishnu Sharma
Metadata
Release files for validata-py 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| validata_py-1.0.2.tar.gz | 11.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| validata_py-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.5 kB
Release files / validata_py-1.0.2.tar.gz
| Download URL | validata_py-1.0.2.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c558e696dd583372d208ae3c1587462f5304e0ce46811ee7454c7da5d17d90d9
|
|
BLAKE2b-256 checksum How to use checksums |
04d39f6238d8d852b208213017b75546bee17c65a86a5f18cf5feba7cc1eccb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / validata_py-1.0.2-py3-none-any.whl
| Download URL | validata_py-1.0.2-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc604089b2046ec1aa1e1cbbb9ad5d263b59a9003091d89bc9ac3ee711d62b62
|
|
BLAKE2b-256 checksum How to use checksums |
526a00d1aefe689d9130b18d791c6e81cff6fc0a52079bc190a311ff97e93cfa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|