Go-style channels and select blocks for asyncio in Python.
Project description
pychanio
Go-style channels and select blocks for Python’s asyncio.
pychanio brings structured concurrency to Python, inspired by Go. It provides chan, select, go, and control signals like DONE and CANCEL.
✅ Features
- Full-duplex and directional channels
- Buffered and unbuffered behavior
<<and>>DSL syntax for send/receive- Go-style
select()block with timeout and default - Background goroutines with
go(fn) - Built-in sentinels for clean shutdown
- Works with native
asyncio
📦 Installation
pip install pychanio
🔁 Example
import asyncio
from pychanio import chan, go, close
async def producer(ch):
for i in range(3):
ch << i
close(ch)
async def consumer(ch):
async for val in ch:
print(val)
async def main():
ch = chan()
go(producer, ch)
await consumer(ch)
asyncio.run(main())
📚 Docs
Find the docs here at: harsh-mishra.gitbook.io/pychanio
🛠 Requirements
- Python 3.8+
asyncio
📄 License
MIT © 2025 Harsh Mishra
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pychanio-0.1.2.tar.gz.
File metadata
- Download URL: pychanio-0.1.2.tar.gz
- Upload date:
- Size: 27.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
757c2174916145d1d091f5734c4af449a9ef1ce2c3b01c12d0143e5120674b1d
|
|
| MD5 |
eb51fc9baa2747b1d37fd3cb9424a2aa
|
|
| BLAKE2b-256 |
ea1da0c31d74cbe94a5a9d35016e206cb9b259b1549b40f15c27de0c79ee2714
|
File details
Details for the file pychanio-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pychanio-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc81c2b0ed9fc6099b4d0045b07bf104ae3b62d1b7fbd25ded1978300f348d46
|
|
| MD5 |
9420c6e994e0ca858cd26babc2899e81
|
|
| BLAKE2b-256 |
ba94a3298d6e2e8fcfa3c8bd33c72d47e07eb1b6d455a3fef18b0beea360e9ca
|