Skip to main content

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 signalling such as shutdown, heartbeat etc.
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pychanio-0.1.3.tar.gz (27.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pychanio-0.1.3-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file pychanio-0.1.3.tar.gz.

File metadata

  • Download URL: pychanio-0.1.3.tar.gz
  • Upload date:
  • Size: 27.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.20

File hashes

Hashes for pychanio-0.1.3.tar.gz
Algorithm Hash digest
SHA256 1020ee341022bcc661e34f73c85a5521dd99e89566daafd99ce017b1de886b64
MD5 3e74254963c7111cbd52bc26d3368754
BLAKE2b-256 697bf1c5a61d4ccdd9cf1c4f8d8f1b02a8be12cffbf27d1b9ae26332927c3680

See more details on using hashes here.

File details

Details for the file pychanio-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: pychanio-0.1.3-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

Hashes for pychanio-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 37e4da021c131fd99fc1f192d511326fcb00b7e80b580044a990df79d7ddc79d
MD5 455267d3047af3c22a6e282c3284d6d8
BLAKE2b-256 ec0309cbacec9dfe3cc22eb08032404fd6500e818a52e806b9f5dffe3297d7ed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page