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.2

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.2
File Size Uploaded Provenance Actions
piitag-0.1.2.tar.gz 253.9 kB With provenance Details for piitag-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 284.2 kB

Release files / piitag-0.1.2.tar.gz

Download URL piitag-0.1.2.tar.gz
Size 253.9 kB
Tags Source
SHA-256 checksum
How to use checksums
687ddf0a66d7f4f5eb276a5fa98af10e6e8b65d459b2a0c36fc4ab1be8f3ab7f
BLAKE2b-256 checksum
How to use checksums
25e6e9d27f669c7112cafb38c561474e45b1534c7e41e960b204981fce28fba0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 20, 2026.

Transparency log

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

Download URL piitag-0.1.2-py3-none-any.whl
Size 30.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3aaff1cf236f45db9b6679b5df608837f71b3f213d6932fec44b6241ef5f3319
BLAKE2b-256 checksum
How to use checksums
9c8bf96137c89a1f18c53fc8926696f6a910655074280a0b6e4ba837aeb614a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 20, 2026.

Transparency log

Security for piitag 0.1.2

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.2.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 Sep 20, 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