ShadowData
A Python library for anonymizing, masking, and encrypting sensitive data with a small, focused API.
What it does today
- Text and pattern anonymization (free-form text replacement, IPv4, email, phone)
- Localized identifiers (US SSN, Brazil CPF/CNPJ)
- Symmetric encryption and decryption (Fernet)
- PII detection via spaCy (optional extra)
Planned: richer masking helpers and reversible transforms.
Installation
pip install shadow_data
Optional spaCy support:
pip install shadow_data[spacy]
spaCy models must be installed before use:
python -m spacy download en_core_web_trf
Quickstart
from shadow_data.anonymization import (
EmailAnonymization,
Ipv4Anonymization,
PhoneNumberAnonymization,
TextProcessor,
)
from shadow_data.cryptohash.symmetric_cipher import Symmetric
from shadow_data.l10n.usa import IdentifierAnonymizer
text = "Contact me at user@example.com or 415-555-0199. Server: 10.0.0.1"
anonymized_text = Ipv4Anonymization.anonymize_ipv4(text)
anonymized_text = TextProcessor.replace_text("Contact", "Reach", anonymized_text)
email = EmailAnonymization.anonymize_email("user@example.com")
phone = PhoneNumberAnonymization.anonymize_phone_number("415-555-0199")
print(anonymized_text, email, phone)
ssn = "Billy's SSN is 479-92-5042."
ssn_anonymizer = IdentifierAnonymizer(ssn)
ssn_anonymizer.anonymize()
print(ssn_anonymizer.cleaned_content)
symmetric = Symmetric()
key = symmetric.create_key()
ciphertext = symmetric.encrypt("hello")
plaintext = symmetric.decrypt(ciphertext)
print(ciphertext, plaintext)
Docs
docs/README.mddocs/usage.mddocs/cryptography.mddocs/pii.md
Examples
examples/quickstart.pyexamples/anonymization.mdexamples/i10n_us.mdexamples/i10n_brazil.mdexamples/pii_nlp.mdexamples/symmetric_cipher.md
Testing
poetry run pytest -vvv
Contributing
- Fork the repository.
- Create a new branch for your feature (
git checkout -b my-new-feature). - Commit your changes (
git commit -am 'Add new feature'). - Push the branch (
git push origin my-new-feature). - Open a pull request.
License
This project is licensed under the MIT License - see LICENSE for details.
Metadata
Release files for shadow_data 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| shadow_data-1.0.1.tar.gz | 5.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shadow_data-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.2 kB
Release files / shadow_data-1.0.1.tar.gz
| Download URL | shadow_data-1.0.1.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81fdaad114282482a6a8ff0d8779ec399cfc35399c52ad09bd047a65e6db432b
|
|
BLAKE2b-256 checksum How to use checksums |
c3f3b21702300e02282068353b305dcf918e348cff188d226d20a246ff8cae53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.13.13 Linux/6.6.114.1-microsoft-standard-WSL2
|
Release files / shadow_data-1.0.1-py3-none-any.whl
| Download URL | shadow_data-1.0.1-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c392705c2944bdd6fbfb6c0082c7bb552b12265561ae7691214ec607b519f1f
|
|
BLAKE2b-256 checksum How to use checksums |
40af0a21c979ef8afc41207e0a53ee8ab6de392098f1d8531e8c212bdcaa209c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.13.13 Linux/6.6.114.1-microsoft-standard-WSL2
|