Skip to main content

t3api-utils

A Python library and t3api command for the T3 API (Track & Trace Tools), which serves Metrc cannabis-compliance data. It handles login and secret keys, loads whole collections, sends writes safely (dry run unless you say otherwise), downloads server-side reports and builds tag lists.

Documentation: https://classvsoftware.github.io/t3api-python-utils/

2.0 is a rewrite and doesn't share an API with 1.x. See Migrating from 1.x. 1.x is frozen at 1.5.0.

Install

Python 3.12 or later.

uv add t3api-utils
pip install "t3api-utils[tui]"    # [tui] adds the terminal row inspector

Quickstart

Log in once. This creates a T3 secret key from your Metrc login and saves it to your OS keyring; your Metrc password isn't stored.

t3api login

Then, in a script:

import t3api_utils as t3

client = t3.connect()
items = client.collect("METRC_ACTIVE_ITEMS", license="LIC-00001")
t3.to_csv(items, "items.csv")

For scheduled jobs and CI, set T3_SECRET_KEY instead of logging in.

A few more things it does:

# Writes are a dry run unless submit=True
client.post("/v2/items/discontinue", license="LIC-00001", json={"id": 12345}, submit=True)

# Validate every row, show the results, and ask before submitting
client.bulk("/v2/items/discontinue", rows=[{"id": i["id"]} for i in items], license="LIC-00001", submit="ask")

# Server-side report straight to a file
client.report("ITEMS_REPORT", licenses=["LIC-00001"], to="items.xlsx")

# A column of tag labels to full package records
tl = client.tag_lists.from_csv("labels.csv", column="label", license="LIC-00001",
                               endpoint="METRC_ACTIVE_PACKAGES")
packages = tl.resolve()

The t3api command

t3api login                                                   # save a secret key to a profile
t3api pull METRC_ACTIVE_PACKAGES -l LIC-00001 -o packages.csv # a whole collection to CSV or JSON
t3api report ITEMS_REPORT -l LIC-00001 -o items.xlsx          # a server-side report
t3api endpoints harvest --kind collection                     # search the T3 spec
t3api keys list                                               # manage secret keys

t3api --help lists every command.

Development

uv sync
uv run pytest
uv run mypy
uv run mkdocs serve

See CLAUDE.md for the project layout and conventions, and CHANGELOG.md for release notes.

License

GPL-3.0-only.

Metadata

Release files for t3api-utils 2.1.0

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

Source distribution (sdist)

Source distribution for t3api-utils 2.1.0
File Size Uploaded Provenance Actions
t3api_utils-2.1.0.tar.gz 281.7 kB With provenance Details for t3api_utils-2.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for t3api-utils 2.1.0
File Interpreter ABI Platform Actions
t3api_utils-2.1.0-py3-none-any.whl Python 3 none any Details for t3api_utils-2.1.0-py3-none-any.whl

Total release size: 573.4 kB

Release files / t3api_utils-2.1.0.tar.gz

Download URL t3api_utils-2.1.0.tar.gz
Size 281.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9fb65c638774fdb3b8e86f1269f45cc8839e421cb243d71e4e9d2541d61a1bf5
BLAKE2b-256 checksum
How to use checksums
58376bfb351f9870ce9a2dc42096b128b795e42d19bf9f01b0b5d03d53b15ab1
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 30, 2026.

Transparency log

Release files / t3api_utils-2.1.0-py3-none-any.whl

Download URL t3api_utils-2.1.0-py3-none-any.whl
Size 291.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ea88baecdf636e4d77886fae22321c618e164c21a27c065ab73fa75d70615e6
BLAKE2b-256 checksum
How to use checksums
32319eff326e4edbd8ce2b203a584d341d4d9dab23df65fd77aa124bc64a295c
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 30, 2026.

Transparency log

Security for t3api-utils 2.1.0

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 t3api_utils-2.1.0.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 30, 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