Metadata-Version: 2.5
Name: provably-sdk
Version: 0.3.2
Summary: Python SDK for the Provably API: OAuth sign-in, sandboxes, collections, queries and proofs.
Project-URL: Homepage, https://provably.ai
Project-URL: Repository, https://github.com/ProvablyAI/provably-sdk-python
Author: Provably Technologies Ltd
License: Business Source License 1.1
License-File: LICENSE.md
Keywords: oauth,proofs,provably,sdk,verifiable
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: httpx>=0.26
Requires-Dist: msgspec>=0.18.0
Requires-Dist: pydantic>=2.6
Requires-Dist: structlog>=24.1
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.3; extra == 'dev'
Description-Content-Type: text/markdown

# provably-sdk

Python SDK for the Provably API: OAuth browser sign-in, sandboxes, middlewares,
databases, collections, preprocessing, queries and proofs.

```bash
pip install provably-sdk
```

## Configure

The SDK reads nothing from the environment or disk. Tell it where the API is,
which organisation to act for and where to keep the session:

```python
import uuid

import provably
from provably import MemoryTokenStore, ProvablyConfig

provably.configure(
    config=ProvablyConfig(org_id=uuid.UUID("...")),  # api_url / app_url default to production
    tokens=MemoryTokenStore(),
)
```

- `config` may be a callable, read whenever a client is built, for apps whose
  settings change at runtime. It must not raise before sign-in; leave `org_id`
  unset and org-scoped calls raise `ProvablyConfigError`.
- `tokens` is any object with `load()`, `save(tokens)` and
  `clear_refresh_token()` (see `provably.TokenStore`). Rotated tokens are written
  back to it, together with the OAuth client they were issued to.
- `egress` is an optional context manager every HTTP call runs inside, for apps
  that intercept their own outbound traffic.

## Sign in

Each app signs in as its own registered OAuth client, on its own loopback port:

```python
tokens = await provably.browser_login(client_id="my-app", port=8911)
store.save(tokens)
```

## Use

```python
from provably.service import service

sandbox = await service.get_sandbox()
query_id = await service.run_query(middleware_id, collection_id, "SELECT 1")
await service.wait_for_proof_computation(query_id)
```

## Development

```bash
uv sync --extra dev
uv run pytest
uv run ruff check . && uv run ruff format --check .
uv run mypy
```
