Skip to main content

A fast, zero-copy, circular buffer for Python

Project description

https://travis-ci.org/peteut/circbuf.svg?branch=master https://img.shields.io/coveralls/peteut/circbuf.svg

circbuf implements a circular buffer for Python. It allows for zero copy operation, i.e. it uses memoryview to expose consumer and producer buffers. Access to the buffer is synchronised by locks, managed by context managers.

Example

import circbuf

buf = circbuf.CircBuf()
# Produce data
with buf.producer_buf as mv:
    mv[0] = 42
    buf.produced(1)

print('First entry: {}'.format(next(iter(buf)))) # First entry: 42

Features

  • Pure Python
  • Minimises allocation of big memory chunks
  • Automatic access synchronisation
  • Tested on Python 3.2, 3.3, 3.4

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

circbuf-0.1b1.linux-x86_64.tar.gz (7.1 kB view hashes)

Uploaded source

Built Distribution

circbuf-0.1b1-py32, py33, py34-none-any.whl (4.9 kB view hashes)

Uploaded py32, py33, py34

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page