Skip to main content

Python implementation of stream library

Project description

Build Status PyPI Release PyPI Status Python License

pyStream

Python implementation of stream library.

Introduction

This library enables stream processing of protobuf messages (or any serializable objects since v1.6.3); i.e. multiple protobuf messages can be written/read into/from a single stream or file.

It was originally developed to parse/write vg file formats (.vg, .gam, etc). However, it can be used for any arbitrary protocol buffer messages.

Refer to the C++ stream library for more details.


NOTE

@vg users: The new version of stream library, now as a part of libvgio, writes a header tag at the start of the stream depending on the output format. For example, headers like b'GAM' or b'VG' can be found before the actual protobuf messages in GAM and VG files repectively. In this case, you should provide the expected value using header keyword argument; e.g. stream.parse('file.gam', vg_pb2.Alignment, header=b'GAM', persistent_header=True) for GAM files (since version v1.6.2).


Encoding

The encoding is simple. Messages are written in groups of different sizes. Each group starts with its size; i.e. the number of messages in that group. Then, the size of each message is followed by the encoded message itself. Quoted from Google Protobuf Developer Guide:

The Protocol Buffer wire format is not self-delimiting, so protocol buffer parsers cannot determine where a message ends on their own. The easiest way to solve this problem is to write the size of each message before you write the message itself. When you read the messages back in, you read the size, then read the bytes into a separate buffer, then parse from that buffer.

By default, the stream is considered compressed by GZip. However, uncompressed stream processing is possible by passing gzip=False to any API calls.

Installation

You can install pyStream using pip:

pip install pystream-protobuf

Usage

See Wiki for usage documentation.

Development

In case, you work with the source code and need to build the package:

python setup.py build

The proto files in the test module required to be compiled before running test cases. To do so, it is required to have Google protobuf compiler (>=3.0.2) installed. After installing protobuf compiler, run:

make init

to compile proto files required for test module and then:

make test

to run tests.

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

pystream-protobuf-1.6.4.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

pystream_protobuf-1.6.4-py2.py3-none-any.whl (9.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pystream-protobuf-1.6.4.tar.gz.

File metadata

  • Download URL: pystream-protobuf-1.6.4.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for pystream-protobuf-1.6.4.tar.gz
Algorithm Hash digest
SHA256 1fb2c71c54bb84b56f40fc07d5a6539bbb1fb226b294c62d46e65127952c2a7c
MD5 869e0794d400eb120d92164c7b772491
BLAKE2b-256 894aab5bd8cca64786d2167743a68c60affd7148789fb497d984bc428bcae1be

See more details on using hashes here.

File details

Details for the file pystream_protobuf-1.6.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pystream_protobuf-1.6.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7129949a278276a7fc54497ca3fb0333ce905777b871eeccefcc0936bb30f631
MD5 d04c9ae88dcbc23883a616fb0e7b95e5
BLAKE2b-256 ba165de204e3dc28f8841283a37b197e5a535d3f62906106ca52d6d03b6fea2e

See more details on using hashes here.

Supported by

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