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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| piitag-0.1.0.tar.gz | 253.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| piitag-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 283.6 kB
Release files / piitag-0.1.0.tar.gz
| Download URL | piitag-0.1.0.tar.gz |
|---|---|
| Size | 253.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dcc03df1da05024df5c61d5c2649e6c866a9b5c58a363cd80fd61c64ee3f434d
|
|
BLAKE2b-256 checksum How to use checksums |
b0f2d6e03898cf1ec27a744394e7faaa8b6d1f0f3f3854309dd45ce632f90959
|
| 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 logRelease files / piitag-0.1.0-py3-none-any.whl
| Download URL | piitag-0.1.0-py3-none-any.whl |
|---|---|
| Size | 29.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
788d006f6097b6026bc009c0f725a97c2c2008e65168eff5024a6768862aed3a
|
|
BLAKE2b-256 checksum How to use checksums |
9b0a37491e9c3a3f644eef0790cf79911d81bdb840dc1ff1ba7aae4714949117
|
| 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