DEPRECATED — use pii-veil + pii-core instead. Reversible PII anonymization for Polish documents.
Project description
llm-safe-pl
⚠️ DEPRECATED — use
pii-toolkitinstead
llm-safe-plis end-of-life as of v0.2.1 (2026-04-29). No further features, fixes, or security updates will be released. The library has been superseded by thepii-toolkitfamily on PyPI:
Was Now llm_safe_pl.Shield,Anonymizer,Deanonymizerpii-veilllm_safe_pl.detectors.*pii-corellm_safe_pl.validators.*(checksums)pii-coreMicrosoft Presidio integration pii-presidioSee
MIGRATION.mdfor a full symbol-by-symbol map and before/after code samples.v0.2.1 is a deprecation tombstone: the public API still works exactly as it did in 0.2.0, but
import llm_safe_plnow emits aDeprecationWarning. Existing pinned installs keep functioning; you just won't get any new releases. Migrate at your own pace.
Why pii-toolkit replaces this
llm-safe-pl started as a Polish-only reversible-anonymization library.
Building it surfaced a cleaner three-package architecture:
pii-core— language-agnostic detectors and checksum validators with zero runtime dependencies. Polish detectors (PESEL, NIP, REGON, Polish IBAN, ID card, passport) ship out of the box alongside multi-language ones.pii-veil— the reversibleShield-style facade for LLM workflows, layered on top ofpii-core. Same round-trip contract (anonymize→ call LLM →deanonymize) you had inllm-safe-pl.pii-presidio— optional Microsoft Presidio plugin for projects that already standardize on Presidio's recognizer ecosystem.
The split lets each piece evolve independently: detectors without dragging in the LLM-workflow surface, the LLM workflow without locking in any one detection backend, and Presidio integration without infecting the dependency tree of users who don't use it.
Migrating
The fastest path:
pip uninstall llm-safe-pl
pip install pii-veil
Then update imports:
# Before (llm-safe-pl 0.2.x)
from llm_safe_pl import Shield
# After (pii-veil)
from pii_veil import Shield
Polish detectors are part of pii-core's default registry and are auto-loaded
by pii-veil — no extra setup needed for the common case. For the full map
including Match, Mapping, AnonymizeResult, PIIType, individual
detector classes, and checksum validators, see MIGRATION.md.
The CLI is replaced by pii-veil's CLI; same subcommands (detect,
anonymize, deanonymize).
Reporting issues
Issues against llm-safe-pl are no longer accepted. If you hit a bug while
migrating, please open it against the relevant successor package:
Legacy documentation (v0.2.0)
The original v0.2.0 documentation is preserved below for users still on pinned installs. Nothing in this section will receive further updates.
What this library does
Reversible PII anonymization for Polish documents, designed for LLM workflows.
When you send a Polish document to an LLM (OpenAI, Anthropic, a local model),
you're exposing PESEL numbers, NIPs, ID card numbers, addresses, and names to
a third party. llm-safe-pl is built around the full round-trip:
- Anonymize — detect Polish PII, replace with stable tokens, return a reversible mapping.
- Call the LLM — the request contains no raw PII.
- Deanonymize — restore original values in the response using the saved mapping.
Checksum validation (PESEL, NIP, REGON, Luhn, IBAN mod-97) is first-class, so valid-looking-but-wrong numbers are rejected before they become false positives.
Quick example — Python API
from llm_safe_pl import Shield
shield = Shield()
result = shield.anonymize(
"Jan Kowalski ma PESEL 44051401359, NIP 526-000-12-46, email jan@example.pl."
)
# result.text -> "Jan Kowalski ma PESEL [PESEL_001], NIP [NIP_001], email [EMAIL_001]."
# result.mapping -> reversible Mapping object (JSON-serializable)
# result.matches -> tuple[Match, ...] for audit
# Safe to send to an LLM now.
# response = call_any_llm(result.text)
restored = shield.deanonymize(result.text)
# "Jan Kowalski ma PESEL 44051401359, NIP 526-000-12-46, email jan@example.pl."
Quick example — CLI
# Detect PII without modifying the file
llm-safe detect document.txt
# Anonymize: writes rewritten text and a reversible mapping
llm-safe anonymize document.txt -o anon.txt -m mapping.json --force
# Restore original values
llm-safe deanonymize anon.txt -m mapping.json
What's supported (v0.2.0)
| PII type | Format examples | Checksum validated |
|---|---|---|
| PESEL | 44051401359 |
✅ |
| NIP | 5260001246, 526-000-12-46 |
✅ |
| REGON | 123456785 (9-digit), 12345678500001 (14-digit) |
✅ |
| ID card (dowód) | ABC123456 |
regex only |
| Passport | AB1234567 |
regex only |
| Phone | +48 600 123 456, 600-123-456 |
— |
user@example.pl |
— | |
| IBAN | PL61109010140000071219812874 (bare or 4-digit-grouped) |
✅ (mod-97, ~80 countries) |
| Credit card | 4532 0151 1283 0366 (13-19 digits, various groupings) |
✅ (Luhn) |
License
MIT. See LICENSE.
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 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 llm_safe_pl-0.2.1.tar.gz.
File metadata
- Download URL: llm_safe_pl-0.2.1.tar.gz
- Upload date:
- Size: 42.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18d014cce9799d51fc3906e22d1d679fe08e659741361020e221533e6764b746
|
|
| MD5 |
9740972d6abc8a2162034201e45dcf7e
|
|
| BLAKE2b-256 |
7d169bbfff765996c72c81751afec00553ced4ca41116d28fcd8cbea79cebc9a
|
Provenance
The following attestation bundles were made for llm_safe_pl-0.2.1.tar.gz:
Publisher:
publish.yml on Tatarinho/llm-safe-pl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_safe_pl-0.2.1.tar.gz -
Subject digest:
18d014cce9799d51fc3906e22d1d679fe08e659741361020e221533e6764b746 - Sigstore transparency entry: 1404825813
- Sigstore integration time:
-
Permalink:
Tatarinho/llm-safe-pl@75f1c1edb4c4cfab57e0f70fb2bd8742d2fa14b0 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/Tatarinho
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@75f1c1edb4c4cfab57e0f70fb2bd8742d2fa14b0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file llm_safe_pl-0.2.1-py3-none-any.whl.
File metadata
- Download URL: llm_safe_pl-0.2.1-py3-none-any.whl
- Upload date:
- Size: 26.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
296201ea6c25abceb5c1095e73a0ccd1e83e0a98e61551e9613a028c1f4637a9
|
|
| MD5 |
aff91ae73aad6d7628872f0bbd5ca266
|
|
| BLAKE2b-256 |
b136affd3487e48128b599c4788196f9d158cf51f51d4e5d3b179335a8ddc8d2
|
Provenance
The following attestation bundles were made for llm_safe_pl-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on Tatarinho/llm-safe-pl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_safe_pl-0.2.1-py3-none-any.whl -
Subject digest:
296201ea6c25abceb5c1095e73a0ccd1e83e0a98e61551e9613a028c1f4637a9 - Sigstore transparency entry: 1404825921
- Sigstore integration time:
-
Permalink:
Tatarinho/llm-safe-pl@75f1c1edb4c4cfab57e0f70fb2bd8742d2fa14b0 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/Tatarinho
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@75f1c1edb4c4cfab57e0f70fb2bd8742d2fa14b0 -
Trigger Event:
push
-
Statement type: