Skip to main content

piitag

Python port of Desert Ant Labs' Redact on-device PII detector.

The package is under active development. The implementation is being built in stages described in the implementation plan.

Quick start

Install the package and one of the supported TFLite runtimes:

uv add piitag ai-edge-litert

The first detection downloads the pinned model assets into the Hugging Face cache. You can also provide a directory containing the three model files:

from piitag import Label, Options, Redact

redactor = Redact()
result = redactor.redaction("Email anna@example.com")
print(result.redacted_text)
print(result.restore(result.redacted_text))

only_email = redactor.redaction(
    "Email anna@example.com",
    Options(labels=frozenset({Label.EMAIL})),
)

The command-line interface accepts the same model cache by default:

uv run piitag "Email anna@example.com"
uv run piitag "Call +44 20 7946 0958" --labels PHONE --json

Use --directory PATH for an offline directory containing redact_tokenizer.bin, labels.json, and redact.tflite.

Development setup

Requirements:

  • Python 3.10 or newer
  • uv

Create an isolated environment and install the development dependencies:

uv venv
source .venv/bin/activate
uv sync --extra dev --extra litert

Use --extra tensorflow instead of --extra litert when TensorFlow is the preferred TFLite runtime.

Build, test, and check

uv run pytest
uv run ruff check src/ tests/ scripts/
uv run ruff format --check src/ tests/ scripts/
uv run mypy src/
uv run python -m build
uv run twine check dist/*

Model weights and taxonomy assets are not bundled with the package. See NOTICE.md for the applicable model license.

Release

Releases use Conventional Commits on main with python-semantic-release. The release workflow updates the package version, synchronizes uv.lock, updates CHANGELOG.md, creates a tag and GitHub release, and publishes the wheel and source archive to PyPI.

PyPI publishing uses Trusted Publishing. Configure the PyPI project publisher for this repository, workflow, and the pypi environment before publishing.

  • fix: creates a patch release.
  • feat: creates a minor release.
  • BREAKING CHANGE: or a ! after the commit type creates a major release.

Preview the next release locally without changing files:

uv run semantic-release --noop version

License

The piitag wrapper code is available under the MIT license. Model weights and taxonomy assets are not bundled with the package. Runtime downloads from the desert-ant-labs/redact Hugging Face repository at revision v0.4.0 are subject to the Desert Ant Labs Source-Available License. See NOTICE.md before using those assets commercially.

AI-generated code disclaimer

This codebase was generated with assistance from GitHub Copilot. The exact underlying model identifier used for this session is not exposed by the available session metadata, so no more specific model name is claimed here. Review and test all generated code before using it in production.

Metadata

Release files for piitag 0.1.3

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

Source distribution (sdist)

Source distribution for piitag 0.1.3
File Size Uploaded Provenance Actions
piitag-0.1.3.tar.gz 261.6 kB With provenance Details for piitag-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for piitag 0.1.3
File Interpreter ABI Platform Actions
piitag-0.1.3-py3-none-any.whl Python 3 none any Details for piitag-0.1.3-py3-none-any.whl

Total release size: 291.9 kB

Release files / piitag-0.1.3.tar.gz

Download URL piitag-0.1.3.tar.gz
Size 261.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6abf71591e1a76903a3bb2f06d3cc623286bee439627e613d2c2c732f24ea685
BLAKE2b-256 checksum
How to use checksums
42b2d705c32e51e78c1465f498ce978b840a63b9c675b980b259479e25dcb7d6
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 2, 2026.

Transparency log

Release files / piitag-0.1.3-py3-none-any.whl

Download URL piitag-0.1.3-py3-none-any.whl
Size 30.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e63eacaa425db271d65164416ecfe2a41eb45b96158f8a792bf05027bbe7be60
BLAKE2b-256 checksum
How to use checksums
1a110b1625a627e98dee28f4353fe37ae72cc44b82f7c3223d5e5b12cc8741e8
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 2, 2026.

Transparency log

Security for piitag 0.1.3

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for piitag-0.1.3.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 2, 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.

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