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.0.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 t3api-utils 2.0.1
File Size Uploaded Provenance Actions
t3api_utils-2.0.1.tar.gz 278.7 kB With provenance Details for t3api_utils-2.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 566.4 kB

Release files / t3api_utils-2.0.1.tar.gz

Download URL t3api_utils-2.0.1.tar.gz
Size 278.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2708e02207ffcdd72ac336a0d3d1314d462e30f622ae191d552e45e474a6fdd8
BLAKE2b-256 checksum
How to use checksums
296312b8286ed86f803f11d9afc5ba61d24025923983207d5156ea52f08b8cad
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 24, 2026.

Transparency log

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

Download URL t3api_utils-2.0.1-py3-none-any.whl
Size 287.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7706193da9d31557c2b9fc82f55767be57d878dc02c156a995b323ddb40e57c
BLAKE2b-256 checksum
How to use checksums
9a6e4126d6ef9eacaab4c5f6c58095a5b3192942397ce15af2ba4de0b3f27e84
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 24, 2026.

Transparency log

Security for t3api-utils 2.0.1

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.0.1.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 24, 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