Metadata-Version: 2.4
Name: streamview
Version: 1.0.0
Summary: Zero-copy non-blocking pipe-like structure
Author-email: Miguel Ángel Prosper <mprosper@uji.es>
License-Expression: GPL-3.0-or-later
Project-URL: Homepage, https://github.com/hpca-uji/streamview
Project-URL: Repository, https://github.com/hpca-uji/streamview.git
Keywords: Pipe,Structure,Python
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.13
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: fast
Requires-Dist: sabctools>=9.3.0; extra == "fast"
Dynamic: license-file

# streamview
Zero-copy non-blocking pipe-like structure

## Install
### Production
```bash
pip install streamview
```

### Development
```bash
git clone https://github.com/hpca-uji/streamview.git
cd streamview
pip install -e .
```

## Documentation
### Classes
- `Stream()`

  Zero-copy non-blocking pipe-like

  Interface mimics a non-blocking BufferedIOBase,
  but operations return memoryviews instead of bytes.

  Operations are not thread-safe.
  Reader is responsible of releasing chunks.
  Writer hands off responsibility over chunks.

  Stream has `with`, `bytes`, `bool`, `copy` and `deepcopy` support.

  Extends: `BufferedIOBase`

  - `nbytes -> int`

    Number of bytes held in stream

  - `nchunks -> int`

    Number of chunks held in stream

  - `readchunk() -> memoryview`

    Read a chunk from stream

  - `unreadchunk(chunk: memoryview) -> int`

    Unread a chunk into the stream

  - `readchunk() -> memoryview`

    Read a chunk from stream

  - `unwritechunk() -> memoryview`

    Unwrite a chunk from the stream

  - `writechunk(chunk: memoryview) -> int`

    Write a chunk into the stream

  - `peekchunk() -> memoryview`

    Peek a chunk from stream

  - `readchunks() -> Iterable[memoryview]`

    Read all chunks from stream

  - `writechunks(chunks: Iterable[memoryview]) -> int`

    Write many chunks into the stream

  - `update(bs: Iterable[Buffer]) -> int`

    Write many buffers into the stream

  - `clear() -> None`

    Release all chunks

  - `copy() -> Stream`

    Shallow copy of stream

  - `tobytes() -> bytes`

      Transform stream to bytes (will copy)

  - `frombytes(b: Buffer) -> Stream`

      Construct a stream from bytes

### Functions
- `byteview(b: Buffer) -> memoryview`

  Return a byte view of a buffer

## Acknowledgments
The library has been partially supported by:
- Project PID2023-146569NB-C22 "Inteligencia sostenible en el Borde-UJI" funded by the Spanish Ministry of Science, Innovation and Universities.
- Project C121/23 Convenio "CIBERseguridad post-Cuántica para el Aprendizaje FEderado en procesadores de bajo consumo y aceleradores (CIBER-CAFE)" funded by the Spanish National Cybersecurity Institute (INCIBE).

![](footer.jpg)
