Package: aiochan
aiochanAiochan is a library written to bring the wonderful idiom ofCSP-styleconcurrency to python. The implementation
is based on the battle-tested Clojure librarycore.async, while the API is
carefully crafted to feel as pythonic as possible.Why?Doing concurrency in Python was painfulasyncio sometimes feels too low-levelI am constantly missing capabilities fromgolangandcore.asyncIt is much easier to portcore.asyncto Python than to port all thosewonderfulpythonpackagesto some other
language.What am I getting?PythonicAPIthat includes everything you'd need for CSP-style
concurrency programmingWorks seamlessly with existing asyncio-based librariesFullytestedFullydocumentedGuaranteed to work with Python 3.5.2 or above and PyPy 3.5 or aboveDepends only on python's core libraries, zero external dependenciesProven, efficient implementation based on Clojure's battle-testedcore.asyncFamiliar semantics for users ofgolang's channels and Clojure's core.async channelsFlexible implementation that does not depend on the inner workings of asyncio at allPermissivelylicensedAbeginner-friendly tutorialto get newcomers onboard as
quickly as possibleHow to install?pip3installaiochanHow to use?Read thebeginner-friendly tutorialthat starts from the
basics. Or if you are already experienced withgolangor Clojure'score.async, start with thequick introductionand then dive into theAPI documentation.I want to try it firstThequick introductionand thebeginner-friendly tutorialcan both be run in jupyter
notebooks, online in binders if you want (just look forat the top of each tutorial).ExamplesIn addition to theintroductionand thetutorial, we have thecomplete set of examplesfrom Rob Pike'sGo concurrency patternstranslated into aiochan. Also, here is asolutionto the classicaldining philosophers problem.I still don't know how to use itWe are just starting out, but we will try to answer aiochan-related questions onstackoverflowas quickly as possible.I found a bugFile anissue, or if you think you can solve it, a pull request is even
better.Do you use it in production? For what use cases?aiochanis definitely not a toy and we do use it in production, mainly in the two following scenarios:Complex data-flow in routing.  We integrate aiochan with an asyncio-based web server.
This should be easy to understand.Data-preparation piplelines.  We prepare and pre-process data to feed into our machine learning
algorithms as fast as possible so that our algorithms spend no time waiting for data
to come in, but no faster than necessary so that we don't have a memory explosion due to
data coming in faster than they can be consumed.  For this we make heavy use ofparallel_pipeandparallel_pipe_unordered.
Currently we are not aware of any other library that can completely satisfy this need of ours.What's up with the logo?It is our 'hello world' example:importaiochanasacasyncdefblue_python(c):whileTrue:# do some hard workproduct="a product made by the blue python"awaitc.put(product)asyncdefyellow_python(c):whileTrue:result=awaitc.get()# use result to do amazing thingsprint("A yellow python has received",result)asyncdefmain():c=ac.Chan()for_inrange(3):ac.go(blue_python(c))for_inrange(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 ofA yellow python has received a product made by the blue python.If you have no idea what this is, read thetutorial.