Aiochan is a library written to bring the wonderful idiom of CSP-style concurrency to python. The implementation is based on the battle-tested Clojure library core.async, while the API is carefully crafted to feel as pythonic as possible.
Based on the "Concurrency and Parallelism" category.
Alternatively, view aiochan alternatives based on common mentions on social networks and blogs.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of aiochan or a related project?
Build Status Documentation Status codecov PyPI version PyPI version PyPI status GitHub license
[logo](logo.gif "aiochan logo")
Aiochan is a library written to bring the wonderful idiom of CSP-style concurrency to python. The implementation is based on the battle-tested Clojure library core.async, while the API is carefully crafted to feel as pythonic as possible.
pip3 install aiochan
Read the beginner-friendly tutorial that starts from the basics. Or if you are already experienced with golang or Clojure's core.async, start with the quick introduction and then dive into the API documentation.
The quick introduction and the beginner-friendly tutorial can both be run in jupyter notebooks, online in binders if you want (just look for the binder link at the top of each tutorial).
In addition to the introduction and the tutorial, we have the [complete set of examples](examples/concurrency_patterns) from Rob Pike's Go concurrency patterns translated into aiochan. Also, here is a [solution](examples/dining_philosophers.py) to the classical dining philosophers problem.
We are just starting out, but we will try to answer aiochan-related questions on stackoverflow as quickly as possible.
File an issue, or if you think you can solve it, a pull request is even better.
aiochan is definitely not a toy and we do use it in production, mainly in the two following scenarios:
It is our 'hello world' example:
import aiochan as ac
async def blue_python(c):
while True:
# do some hard work
product = "a product made by the blue python"
await c.put(product)
async def yellow_python(c):
while True:
result = await c.get()
# use result to do amazing things
print("A yellow python has received", result)
async def main():
c = ac.Chan()
for _ in range(3):
ac.go(blue_python(c))
for _ in range(3):
ac.go(yellow_python(c))
in other words, it is a 3-fan-in on top of a 3-fan-out. If you run it, you will have an endless stream of
A yellow python has received a product made by the blue python.
If you have no idea what this is, read the tutorial.
*Note that all licence references and agreements mentioned in the aiochan README section above
are relevant to that project's source code only.
Do not miss the trending, packages, news and articles with our weekly report.