Skip to main content

Python SDK for StreamHouse — S3-native event streaming

Project description

StreamHouse Python SDK

Python client for StreamHouse — S3-native event streaming.

Install

pip install streamhouse

Quick Start

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

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

Consumer

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

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

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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamhouse-0.1.0.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamhouse-0.1.0-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

Details for the file streamhouse-0.1.0.tar.gz.

File metadata

  • Download URL: streamhouse-0.1.0.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for streamhouse-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4faa43fd5b2a40f2b0d9eb66360fd2cb9af58db29cccf1125da82ef2a6b99ef4
MD5 2b23365662f7adab5b1f2dac7c57418c
BLAKE2b-256 a629e46b14a6652f5d22beb55cb58d187f3d1870521115725e326a7f6b692dca

See more details on using hashes here.

File details

Details for the file streamhouse-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: streamhouse-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for streamhouse-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c75c719bbb1c5ca3ca32422c769e40b5d138be27a02a387d7dbe6c7b40333679
MD5 0b9b2c36878d9fdeb12d9666a6fc95e9
BLAKE2b-256 becd527022de7e909dc9e476999a34760735a57b8a838b03a1103c9124d97c23

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page