Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

anonyma for Python

PII detection and anonymization on a Rust core, with no runtime dependencies, no models to download and no cold start. It shields prompts before they reach an LLM and restores the answers.

from anonyma import Anonyma

engine = Anonyma(categories=["email", "credit-card", "iban"])
shielded = engine.shield_prompt("Mail ana@example.com about card 4111 1111 1111 1111.")
shielded.text   # 'Mail {{EMAIL_1}} about card {{CREDIT_CARD_1}}.'

answer = call_your_model(shielded.text)            # the model never sees the values
engine.restore(answer, shielded.vault)             # values back in the answer
  • Detectors with checksums. Card numbers pass Luhn, IBANs MOD-97, CPF and CNPJ their check digits, PIX payloads their CRC, so a well-formed number with a wrong check digit is not reported.
  • Reversible tokens. {{EMAIL_1}}, {{CREDIT_CARD_1}} keep a prompt readable for the model. One vault per conversation keeps the numbering across turns, and {{PERSON_1}} is never mistaken for part of {{PERSON_10}}.
  • Compliance presets. Anonyma(presets=["lgpd", "hipaa"]) combines presets; each category gets the most protective strategy.
  • Signed receipts. ReceiptIssuer(key).issue(output, counts) records what was replaced, without the data, signed with HMAC-SHA-256.
  • The same results as the TypeScript package. Both run the same conformance suite.

Status: alpha

The Rust core does not detect every category of the TypeScript package yet (names, phone numbers, addresses and others). A preset or category it cannot detect in full raises UnsupportedCategoriesError and names what is missing, instead of silently letting the data through:

Anonyma(presets=["lgpd"])                      # UnsupportedCategoriesError: name, phone, ...
engine = Anonyma(presets=["lgpd"], allow_partial=True)
engine.undetected                              # ('name', 'phone', 'address', ...)

anonyma.capabilities() lists what the core passes in the conformance suite. If you need every category from Python today, run the sidecar (packages/sidecar) and call it over HTTP.

Integrations

Module For
anonyma.integrations.chat message lists in OpenAI and Anthropic formats: shield_messages()
anonyma.integrations.openai shielded_chat_completions(client, engine) wraps chat.completions.create
anonyma.integrations.langchain shield_and_restore(engine): two runnables for an LCEL chain (pip install 'anonyma[langchain]')

Building from source

pip install ./bindings/python[test]     # builds the wheel with maturin; needs a Rust toolchain
pytest bindings/python/tests            # includes the conformance suite

Offsets in Match are code points: text[m.start:m.end] == m.value.

Metadata

Release files for anonyma 0.1.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anonyma 0.1.0a1
File Size Uploaded Provenance Actions
anonyma-0.1.0a1.tar.gz 64.5 kB With provenance Details for anonyma-0.1.0a1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for anonyma 0.1.0a1
File Actions
anonyma-0.1.0a1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for anonyma-0.1.0a1-cp310-abi3-win_amd64.whl
anonyma-0.1.0a1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for anonyma-0.1.0a1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
anonyma-0.1.0a1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for anonyma-0.1.0a1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
anonyma-0.1.0a1-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for anonyma-0.1.0a1-cp310-abi3-macosx_11_0_arm64.whl
anonyma-0.1.0a1-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for anonyma-0.1.0a1-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 4.7 MB

Release files / anonyma-0.1.0a1.tar.gz

Download URL anonyma-0.1.0a1.tar.gz
Size 64.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4f3345477807a7f58cf2d793a535c0a66e668eccf1a40cc6694213f6a781e331
BLAKE2b-256 checksum
How to use checksums
a17a7fa63920403bedb850daf07ed17b56b5d0bf3eae5bff6f7545f8d8ce1c52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / anonyma-0.1.0a1-cp310-abi3-win_amd64.whl

Download URL anonyma-0.1.0a1-cp310-abi3-win_amd64.whl
Size 924.3 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
9ea24aaf12902a0683bb06bfe8659bc70069c78aab1fb4a32e49fcd52e424126
BLAKE2b-256 checksum
How to use checksums
c31b3ee3c16ac7f4885e9d0538c9590e56bf2a4278eed9a26985e139778533fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / anonyma-0.1.0a1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL anonyma-0.1.0a1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 994.1 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
d56937ca672395a246cd47bf1cca47c4d4c5555c37169595283ea88fb14df934
BLAKE2b-256 checksum
How to use checksums
8dbc360d3dfc04fa5f644338a2f60a89ffcd09d02c6c6340b48f2eed518462e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / anonyma-0.1.0a1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL anonyma-0.1.0a1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 927.3 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
b141db1348eb35113f883a418b1f96d850d490796ea0e66fa871e3663e0a50a3
BLAKE2b-256 checksum
How to use checksums
33a48d049539ca3ff5cf423f13f4a0888c6b719b1fc75416c2567aaa1d448527
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / anonyma-0.1.0a1-cp310-abi3-macosx_11_0_arm64.whl

Download URL anonyma-0.1.0a1-cp310-abi3-macosx_11_0_arm64.whl
Size 883.5 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
28b5cc1492f566becca2d2726e93491d97a5be2b0b7685db11f5bfe9aaafa862
BLAKE2b-256 checksum
How to use checksums
d3f914416e164c3f87846130341bd1d75625f8f72bef76682d7a12f77d9d85ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / anonyma-0.1.0a1-cp310-abi3-macosx_10_12_x86_64.whl

Download URL anonyma-0.1.0a1-cp310-abi3-macosx_10_12_x86_64.whl
Size 947.8 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
d74e2041acf895f94729f1536053f0a625f9082ef641aa376317129533981cbc
BLAKE2b-256 checksum
How to use checksums
e0a2135fa9b89f52c3ba71d492c21eb68acac7903f6ae90b3ce9133346ec31e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Security for anonyma 0.1.0a1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for anonyma-0.1.0a1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page