Metadata-Version: 2.5
Name: warehouse-sdk
Version: 0.1.0
Summary: Python SDK for the Warehouse platform HTTP API.
Project-URL: Repository, https://github.com/warehousedevteam/warehouse-monorepo
Requires-Python: <3.13,>=3.12
Requires-Dist: jsonschema<5,>=4.26
Requires-Dist: keyring<26,>=25.6
Requires-Dist: pydantic<3,>=2.14
Requires-Dist: pyyaml>=6.0
Description-Content-Type: text/markdown

# warehouse-sdk

Python client for the Warehouse platform. The distribution name is `warehouse-sdk`. The
import name is `plat_sdk`.

Requires Python 3.12.

```bash
pip install warehouse-sdk
```

`PlatClient.connect` takes a bearer token, or a client id and secret. A client id and
secret are exchanged at the issuer's token endpoint. Pass the issuer URL
(`https://cognito-idp.<region>.amazonaws.com/<pool id>` for a Cognito user pool).
`token=` skips the exchange.

```python
from plat_sdk import PlatClient

client = PlatClient.connect(
    host="https://demo.wrhs.ai/api",
    client_id="<minted client id>",
    client_secret="<minted secret>",
    issuer="https://cognito-idp.us-east-1.amazonaws.com/<pool id>",
)

for dataset in client.datasets_list().data:
    print(dataset["dataset_id"], dataset["name"], dataset["row_count"])

page = client.sandbox_query(sql="select * from orders limit 20")
print([column["name"] for column in page.data["columns"]])
for row in page.data["rows"]:
    print(row)
```

`host` for a token or a client secret is the API base URL, `https://<slug>.wrhs.ai/api`.
Dataset rows from `sandbox_query` are arrays in `columns` order. `objects_list` returns
live objects (`object_type`, `key`, `properties`).

PKCE login is `plat login --host <slug>` from the platform CLI. A slug becomes
`https://<slug>.wrhs.ai/api`, and the refresh token is stored in the OS keychain. This
package does not prompt. With that profile saved, `PlatClient.connect()` with no
arguments reads `~/.plat/config`.
