Skip to main content

High-performance Python client for Rivven distributed streaming platform

Project description

rivven-python

Python bindings for Rivven using PyO3.

Installation

pip install rivven

Usage

Producer

from rivven import Client, ProducerConfig

client = Client.connect("localhost:9092")
producer = client.producer()

# Send a message
producer.send("my-topic", key=b"user-123", value=b'{"event": "login"}')

# Send with headers
producer.send(
    "my-topic",
    key=b"user-123",
    value=b'{"event": "purchase"}',
    headers={"source": "api", "version": "1.0"}
)

# Flush and close
producer.flush()

Consumer

from rivven import Client, ConsumerConfig

client = Client.connect("localhost:9092")
consumer = client.consumer(
    group_id="my-group",
    topics=["my-topic"]
)

# Poll for messages
for record in consumer.poll(timeout_ms=1000):
    print(f"Key: {record.key}, Value: {record.value}")
    consumer.commit(record)

# Or use iterator
for record in consumer:
    process(record)
    consumer.commit(record)

Admin Operations

from rivven import Client

client = Client.connect("localhost:9092")

# Create topic
client.create_topic("new-topic", partitions=3, replication_factor=2)

# List topics
topics = client.list_topics()
for topic in topics:
    print(f"{topic.name}: {topic.partitions} partitions")

# Delete topic
client.delete_topic("old-topic")

Async Support

import asyncio
from rivven import AsyncClient

async def main():
    client = await AsyncClient.connect("localhost:9092")
    producer = await client.producer()
    
    await producer.send("my-topic", key=b"key", value=b"value")
    await producer.flush()

asyncio.run(main())

Configuration

from rivven import ClientConfig

config = ClientConfig(
    bootstrap_servers=["node1:9092", "node2:9092"],
    connection_timeout_ms=10000,
    request_timeout_ms=30000,
)

client = Client.connect_with_config(config)

Building from Source

# Install maturin
pip install maturin

# Build wheel
cd crates/rivven-python
maturin build --release

# Install locally
pip install target/wheels/rivven-*.whl

License

See root LICENSE file.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

rivven-0.0.1-cp312-cp312-manylinux_2_28_aarch64.whl (632.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

rivven-0.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (654.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

rivven-0.0.1-cp312-cp312-macosx_11_0_arm64.whl (594.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file rivven-0.0.1-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for rivven-0.0.1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8cd2e7b961d3d600e7d44986595f44dbaa877e3aa69cb1132549fe1007d3ff69
MD5 435b5286e9f187b9a9263540f68869c0
BLAKE2b-256 1cc83722d1de57a32ac5708d7ef1ff17b8164d67fc68bc3a258352840ef9c728

See more details on using hashes here.

Provenance

The following attestation bundles were made for rivven-0.0.1-cp312-cp312-manylinux_2_28_aarch64.whl:

Publisher: release.yml on hupe1980/rivven

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rivven-0.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rivven-0.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1667d9f8d4b0d48a5a5873d9ef0f5eb5cb47a6a6160ce022e784c9c1fc8d910f
MD5 f145cc59c41f1526dfc0e7ff8d516241
BLAKE2b-256 858236fb9f97e2b2ae0cf6a50b0c3278827f3dc996c3d8bc0ac4cc40c14c095d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rivven-0.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on hupe1980/rivven

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rivven-0.0.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rivven-0.0.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6c2391eb4b088462271302bd9253b503ded5f8418a88a9df6ffb72206c01de69
MD5 beeb25072229a3630339705c043872e5
BLAKE2b-256 5b0a204166d5641e8ddb6258143632d31f9e43265677dc57b4bd2eec2074b9fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for rivven-0.0.1-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on hupe1980/rivven

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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