# numpy_ringbuffer
[![Build Status](https://github.com/eric-wieser/numpy_ringbuffer/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/eric-wieser/numpy_ringbuffer/actions/workflows/main.yml)
[![codecov](https://codecov.io/gh/eric-wieser/numpy_ringbuffer/branch/master/graph/badge.svg)](https://codecov.io/gh/eric-wieser/numpy_ringbuffer)
Ring (aka circular) buffers backed by a numpy array, supporting:
* Operations from `collections.deque`
* `b.append(val)`
* `b.appendleft(val)`
* `b.extend(val)`
* `b.extendleft(val)`
* `b.pop(val)`
* `b.popleft(val)`
* The `collections.Sequence` protocol (unoptimized)
* C-side unwrapping into an array with `np.array(b)`
* Arbitrary element dtypes, including extra dimensions like `RingBuffer(N, dtype=(int, 3))`
For example:
```python
import numpy as np
from numpy_ringbuffer import RingBuffer
r = RingBuffer(capacity=4, dtype=np.bool)
r.append(True)
r.appendleft(False)
print(np.array(r)) # array([False, True])
```
Raw data
{
"_id": null,
"home_page": "https://github.com/eric-wieser/numpy_ringbuffer",
"name": "numpy-ringbuffer",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "numpy,buffer,ringbuffer,circular buffer",
"author": "Eric Wieser",
"author_email": "wieser.eric+numpy@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/3a/0b/08bc9f01677daa58059325e6a1efb18e79c93fbe5d3ffe910349bfbbdea0/numpy_ringbuffer-0.2.2.tar.gz",
"platform": null,
"description": "# numpy_ringbuffer\n\n[![Build Status](https://github.com/eric-wieser/numpy_ringbuffer/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/eric-wieser/numpy_ringbuffer/actions/workflows/main.yml)\n[![codecov](https://codecov.io/gh/eric-wieser/numpy_ringbuffer/branch/master/graph/badge.svg)](https://codecov.io/gh/eric-wieser/numpy_ringbuffer)\n\nRing (aka circular) buffers backed by a numpy array, supporting:\n\n * Operations from `collections.deque`\n * `b.append(val)`\n * `b.appendleft(val)`\n * `b.extend(val)`\n * `b.extendleft(val)`\n * `b.pop(val)`\n * `b.popleft(val)`\n * The `collections.Sequence` protocol (unoptimized)\n * C-side unwrapping into an array with `np.array(b)`\n * Arbitrary element dtypes, including extra dimensions like `RingBuffer(N, dtype=(int, 3))`\n\nFor example:\n\n```python\nimport numpy as np\nfrom numpy_ringbuffer import RingBuffer\n\nr = RingBuffer(capacity=4, dtype=np.bool)\nr.append(True)\nr.appendleft(False)\nprint(np.array(r)) # array([False, True])\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Ring buffer implementation for numpy",
"version": "0.2.2",
"split_keywords": [
"numpy",
"buffer",
"ringbuffer",
"circular buffer"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "39fd78135ec3fd81fe9ebb44bfc5ae92c2120729008c96fd2be6c2af0dca8126",
"md5": "eb8ed21405bbc594978afeffca05bf82",
"sha256": "8393d82d0a75b4fce2890674a278c28289bc9e10fe0428c24bc1e1176cfe18d7"
},
"downloads": -1,
"filename": "numpy_ringbuffer-0.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "eb8ed21405bbc594978afeffca05bf82",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4466,
"upload_time": "2022-06-28T20:14:57",
"upload_time_iso_8601": "2022-06-28T20:14:57.413333Z",
"url": "https://files.pythonhosted.org/packages/39/fd/78135ec3fd81fe9ebb44bfc5ae92c2120729008c96fd2be6c2af0dca8126/numpy_ringbuffer-0.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3a0b08bc9f01677daa58059325e6a1efb18e79c93fbe5d3ffe910349bfbbdea0",
"md5": "533a8b79130757d8d6a92978ec81a09f",
"sha256": "1b55e1ff473e3d8807067a3ea42b8d6957f6b6239fc0516527252280edb18fa6"
},
"downloads": -1,
"filename": "numpy_ringbuffer-0.2.2.tar.gz",
"has_sig": false,
"md5_digest": "533a8b79130757d8d6a92978ec81a09f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4198,
"upload_time": "2022-06-28T20:14:58",
"upload_time_iso_8601": "2022-06-28T20:14:58.438574Z",
"url": "https://files.pythonhosted.org/packages/3a/0b/08bc9f01677daa58059325e6a1efb18e79c93fbe5d3ffe910349bfbbdea0/numpy_ringbuffer-0.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-06-28 20:14:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "eric-wieser",
"github_project": "numpy_ringbuffer",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "numpy-ringbuffer"
}