|
| 1 | +# Changelog |
| 2 | + |
| 3 | +## 2.0.0 |
| 4 | + |
| 5 | +A hard-break rewrite. No 1.x import path still works, and there is no |
| 6 | +compatibility layer. The [migration guide](https://classvsoftware.github.io/t3api-python-utils/migration/) |
| 7 | +maps every 1.x name to its replacement and shows the example scripts before |
| 8 | +and after. |
| 9 | + |
| 10 | +### Highlights |
| 11 | + |
| 12 | +- **`t3.connect()`** is the one way in. It finds a credential (argument, then |
| 13 | + `T3_SECRET_KEY` / `T3_JWT`, then the saved profile, then an interactive |
| 14 | + login only when a person can answer), validates it, and returns a |
| 15 | + `T3Client`. Scripts get from `import` to data in three lines. |
| 16 | +- **Secret keys first.** `t3api login` creates a T3 secret key from your Metrc |
| 17 | + login and saves it to a named profile, with the secret in the OS keyring. |
| 18 | + The Metrc password is never stored. `client.secret_keys` and `t3api keys` |
| 19 | + list, create, rotate and revoke keys. JWTs remain as a fallback. |
| 20 | +- **Spec-driven endpoints.** Endpoints are named by T3 endpoint ID |
| 21 | + (`METRC_ACTIVE_ITEMS`) or path, checked against the T3 OpenAPI spec at |
| 22 | + runtime. A live copy is fetched and cached per host, with the spec bundled |
| 23 | + in the package as a fallback, so new endpoints work without a release. |
| 24 | + Missing required parameters fail before any request is sent. |
| 25 | +- **Collections:** `client.collect()` loads every page of any of the 187 |
| 26 | + paginated endpoints in parallel behind one shared rate limiter; 1.x's |
| 27 | + picker found 138. `client.iter_rows()` streams large collections. Rows are |
| 28 | + plain dicts, exactly as the API returns them. |
| 29 | +- **Safe writes.** Metrc writes are a dry run unless `submit=True`. Routes |
| 30 | + with no dry run reject `submit=`. `client.bulk()` validates every row before |
| 31 | + submitting any, and can log each row's outcome to CSV. |
| 32 | +- **Server-side reports:** `client.report()` downloads any of the 83 report |
| 33 | + endpoints as CSV, XLSX, JSON or a Google Sheet, for up to 20 licenses. |
| 34 | + `client.report_url()` builds a secret-key URL for spreadsheets to pull. |
| 35 | +- **Tag lists:** `client.tag_lists` creates lists from a CSV column or rows and |
| 36 | + resolves them to packages, items, harvests and more, with per-handle errors |
| 37 | + when something doesn't match. |
| 38 | +- **A `t3api` command** for login, profiles, keys, default license, endpoint |
| 39 | + search, `pull` (collection to CSV/JSON or the inspector), `report`, |
| 40 | + `tag-lists`, `inspect` and `spec info` / `spec refresh`. |
| 41 | +- **Local helpers:** `t3.filter_rows()` (indexed, with dotted paths), |
| 42 | + `t3.to_csv()` (UTF-8 with BOM for Excel, lists as JSON), `t3.to_json()` |
| 43 | + (optionally JSON Lines), `t3.read_rows()`, and `t3.pick_file()`. |
| 44 | +- **The Textual inspector** is kept as `t3.inspect()`, behind the optional |
| 45 | + `[tui]` extra. |
| 46 | +- **Errors keep their response.** Every `APIError` has `status_code`, |
| 47 | + `detail`, `errors`, `code` and the `response`; 1.x always reported |
| 48 | + `status_code=None`. Auth errors say whether to rotate a key or log in again. |
| 49 | +- Runs the same on Linux, macOS, Windows and in Jupyter. CI covers all three |
| 50 | + operating systems on Python 3.12 and 3.13, with 100% line and branch |
| 51 | + coverage. |
| 52 | + |
| 53 | +### Fixed (compared with 1.x) |
| 54 | + |
| 55 | +- Writes are no longer retried after a 5xx or a timeout, and a POST that gets |
| 56 | + a 400 is sent once, not three times. Reads retry only on connection errors, |
| 57 | + 429, 502, 503 and 504, honouring `Retry-After`. |
| 58 | +- The rate limiter really limits: 1.x let 20 requests through in 0.2 seconds. |
| 59 | +- HTTP debug logging masks auth headers, secret keys in paths and queries, and |
| 60 | + password, OTP, OTP seed, secret key and token fields in bodies. 1.x logged |
| 61 | + credential-login bodies, password included. |
| 62 | +- Secret keys are sent in the `X-T3-API-Key` header instead of the URL. |
| 63 | +- Exported CSV lists are JSON text instead of Python reprs. |
| 64 | + |
| 65 | +### Removed |
| 66 | + |
| 67 | +- The async `T3APIClient`, its sync wrappers, `send_api_request`, the |
| 68 | + `request_*` helpers and the `get_collection` / `load_all_data_*` / |
| 69 | + `parallel_load_*` family. Use `T3Client` methods, or `client.http` for the |
| 70 | + configured `httpx2.Client`. |
| 71 | +- `get_authenticated_client_or_error()` and the other ~22 auth functions, |
| 72 | + including the `*_with_validation` variants. |
| 73 | +- API-key auth (`/v2/auth/apikey`, `API_KEY`, `API_STATE_CODE`). |
| 74 | +- The `.t3.env` file, `ConfigManager` and the 37 `EnvKeys`. 2.0 reads eight |
| 75 | + environment variables: `T3_SECRET_KEY`, `T3_JWT`, `T3_PROFILE`, |
| 76 | + `T3_LICENSE`, `T3_API_HOST`, `T3_SPEC`, `T3_LOG_HTTP`, `T3_LOG_FILE`. |
| 77 | +- DuckDB and pyarrow, and the `db/` module (relational tables, schema export). |
| 78 | +- `interactive_collection_handler` and the numbered menu, `match_collection_from_csv`, |
| 79 | + `save_collection_to_*` / `save_dicts_to_*`, `pick_collection`. |
| 80 | +- The `MetrcObject`, `MetrcCollectionResponse` and other TypedDicts. |
| 81 | +- The public `style/` module and `logging.setup_logging()`. |
| 82 | +- The `intro.py` tutorial, now the Getting started docs page. |
| 83 | +- Dependencies: `httpx` (replaced by `httpx2`), `duckdb`, `pyarrow`, |
| 84 | + `questionary`, `python-dotenv`, `certifi`. |
| 85 | + |
| 86 | +### Packaging |
| 87 | + |
| 88 | +- Still published as `t3api-utils`, imported as `t3api_utils`, for Python |
| 89 | + 3.12 or later. License GPL-3.0-only. Built with `uv_build`. |
| 90 | +- Core dependencies: `httpx2`, `rich`, `typer`, `keyring`, `platformdirs`, |
| 91 | + `pyotp`, `tomli-w`. Textual is no longer installed by default; it's in the |
| 92 | + `[tui]` extra. |
| 93 | + |
| 94 | +## 1.5.0 |
| 95 | + |
| 96 | +Final 1.x release. 1.x is frozen: no further releases or fixes. Pin |
| 97 | +`t3api-utils<2` to keep using it. |
0 commit comments