Skip to content
This repository has been archived by the owner on Jan 4, 2020. It is now read-only.
/ circbuf Public archive

Circular buffer for Python

Notifications You must be signed in to change notification settings

peteut/circbuf

Repository files navigation

circbuf

https://travis-ci.org/peteut/circbuf.svg?branch=master

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

Useful Links

About

Circular buffer for Python

https://peteut.github.io/circbuf

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published