Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/drakkar-software/async-channel
Python async multi-task communication library. Used by OctoBot project.
https://github.com/drakkar-software/async-channel
async channels concurrency cython go-channel parallelism python
Last synced: about 1 month ago
JSON representation
Python async multi-task communication library. Used by OctoBot project.
- Host: GitHub
- URL: https://github.com/drakkar-software/async-channel
- Owner: Drakkar-Software
- License: lgpl-3.0
- Created: 2019-05-16T20:46:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-05T10:23:19.000Z (about 1 year ago)
- Last Synced: 2024-10-31T20:48:32.035Z (about 2 months ago)
- Topics: async, channels, concurrency, cython, go-channel, parallelism, python
- Language: Python
- Homepage: https://www.octobot.cloud
- Size: 350 KB
- Stars: 19
- Watchers: 4
- Forks: 23
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Async-Channel [2.2.1](https://github.com/Drakkar-Software/Async-Channel/blob/master/CHANGELOG.md)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/523d43c62f1d4de08395752367f5fddc)](https://www.codacy.com/gh/Drakkar-Software/Async-Channel/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Drakkar-Software/Async-Channel&utm_campaign=Badge_Grade)
[![PyPI](https://img.shields.io/pypi/v/async-channel.svg)](https://pypi.python.org/pypi/async-channel/)
[![Github-Action-CI](https://github.com/Drakkar-Software/Async-Channel/workflows/Async-Channel-Default-CI/badge.svg)](https://github.com/Drakkar-Software/Async-Channel/actions)
[![Build Status](https://cloud.drone.io/api/badges/Drakkar-Software/Async-Channel/status.svg)](https://cloud.drone.io/Drakkar-Software/Async-Channel)
[![Coverage Status](https://coveralls.io/repos/github/Drakkar-Software/OctoBot-Channels/badge.svg?branch=master)](https://coveralls.io/github/Drakkar-Software/OctoBot-Channels?branch=master)
[![Doc Status](https://readthedocs.org/projects/octobot-channels/badge/?version=stable)](https://octobot-channels.readthedocs.io/en/stable/?badge=stable)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)Python multi-task communication library. Used by [OctoBot](https://github.com/Drakkar-Software/OctoBot) project.
## Installation
With python3 : `pip install async-channel`## Usage
Example
```python
import async_channel.consumer as consumer
import async_channel.producer as producer
import async_channel.channels as channels
import async_channel.util as utilclass AwesomeProducer(producer.Producer):
passclass AwesomeConsumer(consumer.Consumer):
passclass AwesomeChannel(channels.Channel):
PRODUCER_CLASS = AwesomeProducer
CONSUMER_CLASS = AwesomeConsumerasync def callback(data):
print("Consumer called !")
print("Received : " + data)# Creates the channel
await util.create_channel_instance(AwesomeChannel, channels.Channels)# Add a new consumer to the channel
await channels.Channels.get_chan("Awesome").new_consumer(callback)# Creates a producer that send data to the consumer through the channel
producer = AwesomeProducer(channels.Channels.get_chan("Awesome"))
await producer.run()
await producer.send("test")# Stops the channel with all its producers and consumers
# await channels.Channels.get_chan("Awesome").stop()
```# Developer documentation
On [readthedocs.io](https://octobot-channels.readthedocs.io/en/latest/)