Metadata-Version: 2.4
Name: streamhouse
Version: 0.1.0
Summary: Python SDK for StreamHouse — S3-native event streaming
Project-URL: Homepage, https://streamhouse.app
Project-URL: Documentation, https://docs.streamhouse.app/sdk/python
Project-URL: Repository, https://github.com/gbram1/streamhouse-python
Author-email: StreamHouse <hello@streamhouse.app>
License-Expression: Apache-2.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Requires-Dist: httpx<1,>=0.27
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest-httpx>=0.30; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Provides-Extra: grpc
Requires-Dist: grpcio<2,>=1.60; extra == 'grpc'
Requires-Dist: protobuf<6,>=4.25; extra == 'grpc'
Description-Content-Type: text/markdown

# StreamHouse Python SDK

Python client for [StreamHouse](https://streamhouse.app) — S3-native event streaming.

## Install

```bash
pip install streamhouse
```

## Quick Start

```python
from streamhouse import StreamHouse

sh = StreamHouse("http://localhost:8080", api_key="sk_...")

# Create a topic
sh.admin.create_topic("events", partitions=3)

# Produce
producer = sh.producer()
producer.send("events", key="user-1", value={"action": "click"})

# Consume
consumer = sh.consumer()
for record in consumer.stream("events", partition=0):
    print(f"{record.key_str}: {record.value_str}")

# Schema Registry
registry = sh.schema_registry()
schema_id = registry.register("events-value", '{"type": "object"}')

sh.close()
```

## API

### `StreamHouse(url, api_key?, organization_id?, timeout?)`

Main client. Provides:
- `sh.admin` — topic, consumer group, agent, and metrics management
- `sh.producer()` — send records
- `sh.consumer()` — poll/stream records
- `sh.schema_registry()` — register and retrieve schemas

### Producer

```python
producer = sh.producer()
result = producer.send("topic", value="hello", key="k1", partition=0)
# result.offset, result.partition
```

### Consumer

```python
consumer = sh.consumer()
records = consumer.poll("topic", partition=0, offset=0, max_records=100)
# or stream continuously:
for record in consumer.stream("topic", partition=0):
    process(record)
```

### Admin

```python
sh.admin.create_topic("name", partitions=3)
sh.admin.list_topics()
sh.admin.delete_topic("name")
sh.admin.list_consumer_groups()
sh.admin.get_consumer_lag("group-id")
sh.admin.list_agents()
sh.admin.get_metrics()
```

### Schema Registry

```python
registry = sh.schema_registry()
schema_id = registry.register("subject", schema_str, format=SchemaFormat.AVRO)
schema = registry.get_by_id(schema_id)
subjects = registry.list_subjects()
```
