Metadata-Version: 2.4
Name: pymizu
Version: 0.0.1.dev0
Summary: Single-producer single-consumer channels
Author: pymizu authors
License-Expression: MIT
Project-URL: Homepage, https://github.com/shikokuchuo/mizu-py
Project-URL: Issues, https://github.com/shikokuchuo/mizu-py/issues
Keywords: channel,concurrency,spsc
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# pymizu

Single-producer single-consumer channels for Python: a bounded ring
buffer with optional timeouts on receives and sentinel return values
for full, timeout, and closed states. The transport is in-process.

## Installation

```sh
pip install pymizu
```

## Usage

```python
import pymizu

ch = pymizu.inproc_channel(2)

ch.send("a")
ch.send(42)
ch.send("b")        # full: returns the pymizu.FULL sentinel

ch.recv()
# 'a'
ch.recv()
# 42
ch.recv(timeout=0)  # empty: do not wait
# <pymizu.TIMEOUT>

ch.close()
```

`timeout` is in seconds on a monotonic clock: `None` (the default) and
`math.inf` wait indefinitely, and `0` polls. The buffer is
lock-guarded, so a producer thread and a consumer thread may exchange
values without an external lock.

Terminal states surface as sentinel singletons, not exceptions:
`pymizu.FULL`, `pymizu.TIMEOUT`, and `pymizu.CLOSED`.
`pymizu.is_sentinel(x)` is an identity test for use where payloads are
untrusted.

## License

MIT
