Skip to main content

Library for creating stream data producer / consumer client library.

Project description

Documentation Status https://github.com/MacHu-GWU/unistream-project/actions/workflows/main.yml/badge.svg https://codecov.io/gh/MacHu-GWU/unistream-project/branch/main/graph/badge.svg https://img.shields.io/pypi/v/unistream.svg https://img.shields.io/pypi/l/unistream.svg https://img.shields.io/pypi/pyversions/unistream.svg https://img.shields.io/badge/✍️_Release_History!--None.svg?style=social&logo=github https://img.shields.io/badge/⭐_Star_me_on_GitHub!--None.svg?style=social&logo=github
https://img.shields.io/badge/Link-API-blue.svg https://img.shields.io/badge/Link-Install-blue.svg https://img.shields.io/badge/Link-GitHub-blue.svg https://img.shields.io/badge/Link-Submit_Issue-blue.svg https://img.shields.io/badge/Link-Request_Feature-blue.svg https://img.shields.io/badge/Link-Download-blue.svg

Welcome to unistream Documentation

https://unistream.readthedocs.io/en/latest/_static/unistream-logo.png

unistream is a universal Producer / Consumer abstraction layer for stream systems. It lets you use a single, unified interface to send data to and pull data from any streaming backend — Apache Kafka, AWS Kinesis, AWS CloudWatch Logs, Apache Pulsar, or even local files — while the library handles batching, fault tolerance, retries, and exactly-once consumption behind the scenes.

The core library ships only local-file implementations. Vendor-specific integrations (AWS Kinesis, CloudWatch Logs, DynamoDB checkpoint, etc.) are released as separate plugin packages.

Features

  1. Efficient Record Buffering: Groups records into micro-batches with a Write-Ahead Log (WAL) for crash recovery, optimizing network bandwidth without risking data loss.

  2. Non-blocking Exponential Backoff: Automatic retry with configurable backoff schedules. The retry check is time-based (no sleep), so your application thread is never blocked.

  3. Checkpoint & Exactly-Once Consumption: Per-record status tracking (pending → in_progress → succeeded / failed / exhausted), UUID-based concurrency locking with auto-expiry, and stream pointer persistence for fault-tolerant consumption.

  4. Pluggable Architecture: Five core abstractions (Record, Buffer, Producer, CheckPoint, Consumer) with clean ABC → Base → Concrete layering. Implement send() for a new producer or get_records() for a new consumer — the framework handles everything else.

Core Abstractions

  • AbcRecord / DataClassRecord — the atomic data unit (id + create_at + serialize/deserialize).

  • AbcBuffer / FileBuffer — WAL-backed batch buffer (put → should_i_emit → emit → commit).

  • AbcProducer / BaseProducer / SimpleProducer — non-blocking put() event loop with retry.

  • AbcCheckPoint / BaseCheckPoint / SimpleCheckpoint — per-record state machine + persistence.

  • AbcConsumer / BaseConsumer / SimpleConsumer — consumption loop with tenacity retry + DLQ hook.

AI Agent Skill

A self-contained Claude Code skill is included at .claude/skills/unistream/SKILL.md. It contains the complete API reference, protocols, and usage examples — any AI coding agent with this skill loaded can build custom producers, consumers, buffers, checkpoints, and records without reading the source code.

Install

unistream is released on PyPI, so all you need is to:

$ pip install unistream

To upgrade to latest version:

$ pip install --upgrade unistream

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

unistream-0.1.2.tar.gz (38.6 kB view details)

Uploaded Source

Built Distribution

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

unistream-0.1.2-py3-none-any.whl (38.3 kB view details)

Uploaded Python 3

File details

Details for the file unistream-0.1.2.tar.gz.

File metadata

  • Download URL: unistream-0.1.2.tar.gz
  • Upload date:
  • Size: 38.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for unistream-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4a98bb79ae45fd2eaf8b118768824385bc7288995d5295aebece0798bdb34f36
MD5 8fe0af0c49dac93fe1f38c9753504bd7
BLAKE2b-256 a5774ef9e740f50fd9b314d204e106d88e829485656272fd4997cce6f4ffc822

See more details on using hashes here.

File details

Details for the file unistream-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: unistream-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 38.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for unistream-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 866dbb48bfd5d5ec1e41d3d358d87ef69dbcf5ef5793acdc2b978e2c3b0d493a
MD5 c1f3c47843e35710b3a79118f5724e2a
BLAKE2b-256 c892d2ad6e61380995cc877d7886d7eb974fff3297edd2c19a6cac1dc8724a8d

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