Skip to main content

A Pythonic client library for streaming data with ZebraStream.

Project description

zebrastream-io

Python IO interface for ZebraStream data streaming services.

Disclaimer:
The code in this package is considered pre-production quality. APIs and functionality may change without notice. Use with caution in production environments.

Features

  • File-like synchronous interface for ZebraStream data streams
  • Async interface (internal, subject to change)
  • Easily extensible for other IO interfaces

Installation

pip install zebrastream-io

Usage

Synchronous file-like interface

The synchronous interface provides a familiar, file-like API for reading from and writing to ZebraStream data streams. This design allows you to interact with remote streams using standard Python file IO, making integration with existing codebases straightforward. The goal is to offer a simple and reliable way to handle streaming data without requiring knowledge of asynchronous programming or custom protocols.

Producer

import zebrastream.io.file as zsfile

with zsfile.open(mode="wb", stream_path="/my-stream", access_token=token) as f:
    f.write(b"Hello ZebraStream!")

Consumer

import zebrastream.io.file as zsfile

with zsfile.open(mode="rb", stream_path="/my-stream", access_token=token) as f:
    data = f.read(1024)  # read 1024 bytes
    # do something with the data

Async interface (internal)

Async interface for performing network operations using the asyncio event loop.

This interface is currently non-public and subject to change, as it is under active development. The primary goal is to provide an internal, robust reference implementation for ZebraStream, leveraging Python's async/await syntax. At present, the implementation exclusively supports execution within the asyncio event loop, as it relies on the httpio library — the only request library currently offering reliable, full-duplex communication required for complete ZebraStream protocol support.

Future plans include stabilizing the API and exposing standard async streaming interfaces such as asyncio StreamReader/StreamWriter.

Producer

from zebrastream.io._core import AsyncWriter
import asyncio

async def main():
    async with AsyncWriter(stream_path="/my-stream", access_token=token) as writer:
        await writer.write(b"Hello ZebraStream!")

asyncio.run(main())

Consumer

from zebrastream.io._core import AsyncReader
import asyncio

async def main():
    async with AsyncReader(stream_path="/my-stream", access_token=token) as reader:
        data = await reader.read(1024)
        # do something with the data

asyncio.run(main())

Documentation

See ZebraStream documentation for more details.

License

MIT License. See LICENSE for details.

See also

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

zebrastream_io-0.1.1.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

zebrastream_io-0.1.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file zebrastream_io-0.1.1.tar.gz.

File metadata

  • Download URL: zebrastream_io-0.1.1.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.1 Linux/6.11.0-1018-azure

File hashes

Hashes for zebrastream_io-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4723efb58534d314d24d0a4889aa233e7ca75fe55b62d0ef35723fdad30471a6
MD5 c346816def1b573c65ddc5acee474339
BLAKE2b-256 ff6cfc2b3a52e7f94198576f2ec795e27f23d3daf1c946cb4e0f6c8cff5bddac

See more details on using hashes here.

File details

Details for the file zebrastream_io-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: zebrastream_io-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.1 Linux/6.11.0-1018-azure

File hashes

Hashes for zebrastream_io-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 559c3f27a12d18a089ebae8e44b22185f98d39549a0802286884a41b109c3e96
MD5 55e94265eb1ee2a2b5a60a8a1c2c032f
BLAKE2b-256 66eecfd0b23ae9123ed36afb023fc3f2d15b910596cb4664d0441103f92a0954

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