Skip to main content

taxotag

Python port of Desert Ant Labs' Gist on-device topic tagger.

The package is under active development. The inference pipeline and model asset downloads are implemented in the package; remaining work follows the project plan.

Use as a library

Install taxotag with the LiteRT runtime for the smallest on-device setup:

pip install "taxotag[litert]"

If your application already uses TensorFlow, install the TensorFlow extra instead:

pip install "taxotag[tensorflow]"

The package downloads the pinned model assets from the Desert Ant Labs Gist model repository on Hugging Face when the model is first constructed. To use assets that you downloaded or packaged yourself, pass their directory explicitly. The directory must contain the tokenizer, embedding table and metadata, config, taxonomy, and gist.tflite files.

Classify text

Create one Gist instance and reuse it for multiple inputs. classify returns ranked Topic objects. Each topic has a slug, display name, and model score between 0 and 1:

from taxotag import Gist

gist = Gist()
topics = gist.classify("How to start a podcast with just your iPhone")

for topic in topics:
    print(topic.slug, topic.name, topic.score)
# technology Technology & Software 0.93

The default result contains at most three topics. Set top_k to change the maximum, and set threshold to override the model's configured cutoff. The highest-scoring topic is retained even when it is below the threshold:

topics = gist.classify(
    "A short article about software development",
    top_k=5,
    threshold=0.7,
)

Get all topic scores

Use scores when you need the complete multi-label distribution, such as for storing scores or aggregating results across a collection. It returns a dictionary containing all 36 topic slugs:

scores = gist.scores("A new camera app uses machine learning")
print(scores["technology"])

Scores are independent probabilities and do not sum to 1. Empty or whitespace-only input returns {} from scores and [] from classify.

Choose a model variant

The default multilingual variant covers 101 languages. Use english only when input is reliably English or Latin-script text; it is smaller but does not cover scripts such as Arabic, Cyrillic, Chinese, Japanese, or Devanagari:

gist = Gist(variant="english")

Use local model assets

For offline or controlled deployments, point directory at a complete local asset directory. This skips network access when all required files are present:

from pathlib import Path
from taxotag import Gist

gist = Gist(directory=Path("/opt/models/gist"))
topics = gist.classify("A guide to personal finance")

The model is a 36-topic, multi-label classifier. It is intended for short content such as titles, posts, and title-plus-description text. Reuse the same Gist instance because loading the tokenizer, embedding table, and inference head is substantially more expensive than classifying one input.

Development setup

Requirements:

  • Python 3.10 or newer
  • uv

Create an isolated virtual environment and install the package with its development tools:

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

On Windows PowerShell, activate the environment with:

.venv\Scripts\Activate.ps1

uv sync keeps the environment and uv.lock reproducible. The commands below also work without activating the environment by using uv run.

Build, test, and check

Run the test suite:

uv run pytest

Run linting and formatting checks:

uv run ruff check src/
uv run ruff format --check src/

Run the type checker:

uv run mypy src/

Build and validate the distribution:

uv run python -m build
uv run twine check dist/*

Release

Releases are driven by Conventional Commits on main using python-semantic-release. It updates the version in pyproject.toml, keeps uv.lock synchronized, updates CHANGELOG.md, creates a v* tag and GitHub release, and publishes the wheel and source archive to PyPI.

PyPI publishing uses Trusted Publishing, so no PyPI token is stored in GitHub Actions. Configure the PyPI project publisher for this repository, workflow, and the pypi environment before publishing.

Use commit prefixes to select the release level:

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

To preview the next release locally without changing files, run:

uv run semantic-release --noop version

Push a Conventional Commit to main to trigger the release workflow:

git commit -m "fix: improve model loading error"
git push origin main

Continuous integration

GitHub Actions checks Python 3.10 through 3.14 with Ruff, mypy, and pytest. The pinned model assets are cached by revision so model-backed tests do not redownload them on every run. Scheduled and manual workflows also run the explicit slow model-integration group.

Run

The command-line interface is exposed as taxotag:

uv run taxotag "How to start a podcast with your iPhone" \
  --directory tests/fixtures/model

The inference pipeline is available when the local model assets and an optional TFLite runtime are installed. The command uses the multilingual model by default and downloads missing assets from the pinned Hugging Face revision. Use --json for machine-readable output, --top-k to limit results, and --threshold to override the configured cutoff. Use --variant english for the English-only model build.

Choose an inference runtime

Use LiteRT for new installations. It is the official successor to tflite-runtime and is the lighter, purpose-built option for running the bundled TFLite head:

uv sync --extra dev --extra litert

Use TensorFlow instead when your project already depends on TensorFlow or you need its broader compatibility with an existing TensorFlow toolchain:

uv sync --extra dev --extra tensorflow

The head tries LiteRT first and falls back to TensorFlow. Install only one runtime when possible; if both are installed, LiteRT is used.

Reference assets

Phase 1 reference fixtures are stored under tests/fixtures/ and the pinned Swift implementation is under tests/reference/swift/. Download the local model assets from Hugging Face revision v2.2.0 with:

uv run python scripts/fetch_test_assets.py

The model files are ignored by git and are not included in distributions. The script downloads them into tests/fixtures/model/ for local development.

License

The taxotag 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/gist Hugging Face repository at revision v2.2.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 taxotag 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 taxotag 0.1.3
File Size Uploaded Provenance Actions
taxotag-0.1.3.tar.gz 228.4 kB With provenance Details for taxotag-0.1.3.tar.gz

Built distribution (wheel)

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

Total release size: 243.8 kB

Release files / taxotag-0.1.3.tar.gz

Download URL taxotag-0.1.3.tar.gz
Size 228.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2c5b53863cc6f824564ce4a5ce245d4bb269df819b0bf310df6ab1371d1cd93c
BLAKE2b-256 checksum
How to use checksums
73128dd1a0620ceb1d6f0b2baac326c59de589bc9016b228cc788fab60028898
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 Oct 3, 2026.

Transparency log

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

Download URL taxotag-0.1.3-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93e0103e3712e724ee430073352212d7b7666351c92bc88f367eb441efc18b68
BLAKE2b-256 checksum
How to use checksums
ee7ced84b877577fda04f62801a06c934d771dff5043220303ee2ce1b94e5f3d
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 Oct 3, 2026.

Transparency log

Security for taxotag 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 taxotag-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 Oct 3, 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