r/Python • u/AutoModerator • Nov 04 '26
Showcase Showcase Thread
Post all of your code/projects/showcases/AI slop here.
Recycles once a month.
34
Upvotes
r/Python • u/AutoModerator • Nov 04 '26
Post all of your code/projects/showcases/AI slop here.
Recycles once a month.
View all comments
1
u/Niceyellowduck 10d ago
polanon: reversible PII masking for LLM calls, with a standard-library-only core
What My Project Does
polanon replaces personal data with stable tokens before a prompt goes to a model, and puts the originals back into the answer:
The mapping never leaves your process. The Python side:
Anonymizer.stream_restorer(mapping)restores a streamed answer chunk by chunk, holding back anything that could still grow into a token (providers split<OSOBA_1>into<OSO+BA_1>).anonymize_syncfor scripts, Django/Flask views, Celery tasks and notebooks,await anonymizer.anonymize(...)in async code.polanon-gateway, a plain ASGI app on uvicorn and httpx, speaks the OpenAI and Anthropic APIs, so tools you can't change (Open WebUI, n8n, Claude Code) get masking by switching their base URL.py.typed), Python 3.11+, MIT.Target Audience
Developers who send user text to OpenAI, Anthropic or a local model, especially with Polish data: names are recognised in all seven grammatical cases ("Jan Kowalski", "Jana Kowalskiego", "z Janem Kowalskim" are one person). Beta (0.4.x), used as the masking engine of a few apps of mine (a self-hosted company chat, a CV writer). The API may still change between minor versions.
Comparison
<OSOBA_1:celownik>), so the restored answer can put the name in the right form.Limits: pseudonymisation, not anonymisation. In English text it catches e-mails, phones, cards, IPs, keys and passwords, but it is not an English name detector. Threat model: https://github.com/boromat/polanon/blob/main/docs/THREAT_MODEL.md
Source: https://github.com/boromat/polanon ·
pip install polanon· browser demo (Pyodide, nothing is sent): https://boromat.pl/en/demo/Feedback welcome, especially inputs that get a value through unmasked.