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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
shadow_data-1.0.1.tar.gz
(5.4 kB
view details)
Built Distribution
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 shadow_data-1.0.1.tar.gz.
File metadata
- Download URL: shadow_data-1.0.1.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.4.1 CPython/3.13.13 Linux/6.6.114.1-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81fdaad114282482a6a8ff0d8779ec399cfc35399c52ad09bd047a65e6db432b
|
|
| MD5 |
e9e6c6c661a61f07ae4b68fd8a839c7d
|
|
| BLAKE2b-256 |
c3f3b21702300e02282068353b305dcf918e348cff188d226d20a246ff8cae53
|
File details
Details for the file shadow_data-1.0.1-py3-none-any.whl.
File metadata
- Download URL: shadow_data-1.0.1-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.4.1 CPython/3.13.13 Linux/6.6.114.1-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c392705c2944bdd6fbfb6c0082c7bb552b12265561ae7691214ec607b519f1f
|
|
| MD5 |
b0afc78465b2f6355749b0bdf5fd44e7
|
|
| BLAKE2b-256 |
40af0a21c979ef8afc41207e0a53ee8ab6de392098f1d8531e8c212bdcaa209c
|