Skip to main content

A Python package from the DS library collection

Project description

ds-event-stream-py-sdk

A Python package from the DS Event Stream Python SDK.

Installation

Install the package using pip:

pip install ds-event-stream-py-sdk

Or using uv (recommended):

uv pip install ds-event-stream-py-sdk

Quick Start

from ds_event_stream_py_sdk import __version__

print(f"ds-event-stream-py-sdk version: {__version__}")

Features

  • Kafka producer
  • Kafka consumer
  • Event stream model

Usage

import logging
from uuid import uuid4

from ds_common_logger_py_lib import Logger
from ds_event_stream_py_sdk.errors import ProducerError
from ds_event_stream_py_sdk.models.v1 import EventStream
from ds_event_stream_py_sdk.producer import KafkaProducer

Logger.configure(level=logging.DEBUG)
logger = Logger.get_logger(__name__)


producer = KafkaProducer(
    bootstrap_servers="b0.dev.kafka.ds.local:9095",
    sasl_username="ds.test.producer.v1",
    sasl_password="",
    timeout=5.0,
)

event = EventStream(
    session_id=uuid4(),
    tenant_id=uuid4(),
    event_type="example.event",
    event_source="examples",
    created_by="John Doe",
    payload={"hello": "world"},
)
producer.send_message(
    topic="ds.test.message.created.v1",
    message=event,
    key=str(event.session_id),
    timeout=5.0,
)

Requirements

  • Python 3.10 or higher
  • ds-common-logger-py-lib
  • ds-common-serde-py-lib
  • confluent-kafka

Documentation

Full documentation is available at:

Development

To contribute or set up a development environment:

# Clone the repository
git clone https://github.com/grasp-labs/ds-event-stream-py-sdk.git
cd ds-event-stream-py-sdk

# Install development dependencies
uv sync --all-extras --dev

# Run tests
make test

See the README for more information.

License

This package is licensed under the Apache License 2.0. See the LICENSE-APACHE file for details.

Support

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

ds_event_stream_py_sdk-0.1.0a1.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

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

ds_event_stream_py_sdk-0.1.0a1-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file ds_event_stream_py_sdk-0.1.0a1.tar.gz.

File metadata

  • Download URL: ds_event_stream_py_sdk-0.1.0a1.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ds_event_stream_py_sdk-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 793db912561e680cfe1aeb13c259fda7d0d0bde659287f929f422e238c4fc85b
MD5 090b31f225b91edc1a4762fe3a4575ed
BLAKE2b-256 89bd0d0cad235661a9dbc80fee2fbbe0be9fa49397c512ac46023badc1dc603e

See more details on using hashes here.

File details

Details for the file ds_event_stream_py_sdk-0.1.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for ds_event_stream_py_sdk-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 ed656612cbac323cf483f0d805e189c40a3a6c5230676920868ddcabbf9d77db
MD5 0d651f637dced36099d9dde4fae22480
BLAKE2b-256 4338f657c3f851f94c786399ed2fd617e3351628d6a054293c06bd69d6657eca

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