Metadata-Version: 2.5
Name: pinboard-sdk
Version: 0.18.1
Summary: One live instance of your class per id, with an HTTP surface
Project-URL: Repository, https://github.com/assistant-ui/harness-sdk
License-Expression: MIT
Requires-Python: >=3.11
Requires-Dist: fastapi>=0.115
Requires-Dist: httpx>=0.27
Requires-Dist: starlette>=0.37
Requires-Dist: statepatch<0.4,>=0.3.0
Provides-Extra: postgres
Requires-Dist: psycopg>=3.1; extra == 'postgres'
Provides-Extra: psutil
Requires-Dist: psutil>=5.9; extra == 'psutil'
Description-Content-Type: text/markdown

# pinboard-sdk

Durable objects for Python: one live instance of your class per id across a fleet, activated on the first request, with its own HTTP surface. Imports as `pinboard`. Part of [harness-sdk](https://github.com/assistant-ui/harness-sdk), with `statewire` and `harness-sdk`.

## Install

```sh
uv add pinboard-sdk
```

Extras: `uv add "pinboard-sdk[postgres]"`, `uv add "pinboard-sdk[psutil]"`.

## Use

```python
from fastapi import FastAPI
from pinboard import PinboardAPI, Worker, route
from pinboard.durability import MemoryStateStore

class Counter(PinboardAPI):
    async def lifespan(self):
        self.count = 0
        yield

    @route.post("/increment")
    async def increment(self):
        self.count += 1
        return {"id": self.id, "count": self.count}

worker = Worker(hosts={"/counters": Counter}, state_store=MemoryStateStore())
app = FastAPI()
app.include_router(worker)
```

## SQLite

For a SQLite database per object, stored on S3, use [`pinboard-sqlite`](https://github.com/assistant-ui/harness-sdk/tree/main/python/pinboard/pinboard-sqlite) and its `pinboard_sqlite.pinboard` adapter.

## Docs

- Get started: https://github.com/assistant-ui/harness-sdk/blob/main/apps/docs/src/app/pinboard/docs/get-started/durable-host/page.mdx
- Guide: https://github.com/assistant-ui/harness-sdk/blob/main/apps/docs/src/app/pinboard/docs/guides/python/authoring/page.mdx
- Reference: https://github.com/assistant-ui/harness-sdk/blob/main/apps/docs/src/app/pinboard/docs/reference/pinboard-python/page.mdx
- Spec: https://github.com/assistant-ui/harness-sdk/blob/main/apps/docs/src/app/pinboard/docs/spec/gateway-registry/page.mdx
