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.

Release files for piitag 0.1.1

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.1
File Size Uploaded
piitag-0.1.1.tar.gz 251.9 kB Details

Built distribution (wheel)

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

Total release size: 281.9 kB

Release files / piitag-0.1.1.tar.gz

Download URL piitag-0.1.1.tar.gz
Size 251.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c832a27bd6e89846839387b93a3a16b555e68c8e8cd6f4682d09e96a12f4ee28
BLAKE2b-256 checksum
How to use checksums
8650ef38e918b9f068d5b52f8785791b984d0af0ec0574477ab700d6600221f6
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.1-py3-none-any.whl

Download URL piitag-0.1.1-py3-none-any.whl
Size 30.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e45d5b989f7f196a6d4d64875c263c1f373801d7fc9110a0f34a11899b0ec98
BLAKE2b-256 checksum
How to use checksums
894106278a5b9b81d922c46b641dc53af3723e49dbcbf167e8f8af8bbb859bb4
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 history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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