Wednesday, December 12, 2018

Jean-Louis Fuchs: Announcing libchirp

chirp

I proudly announce libchirp. I believe queues, message-routers and patterns like pub-sub are the way message-passing should be done. However, I also believe they should be optional and tweak-able. libchirp does only one thing: message-passing with encryption. All other building-blocks should be implemented in upper-layer modules or daemons. libchirp is the basis for modular message-passing and actor-based programming.

I want to thank Adfinis-SyGroup who have supported me and allowed me to develop libchirp.

Adfinis-SyGroup

Here the mandatory echo-server example:

import asyncio
from libchirp.asyncio import Chirp, Config, Loop

class EchoChirp(Chirp):
    async def handler(self, msg):
        await self.send(msg)

loop = Loop(); config = Config()
config.DISABLE_ENCRYPTION = True
# Workers are usually asynchronous
config.SYNCHRONOUS = False
aio_loop = asyncio.get_event_loop()
try:
    chirp = EchoChirp(loop, config, aio_loop)
    try:
        aio_loop.run_forever()
    finally:
        chirp.stop()
finally:
    loop.stop()

There is also a ThreadPoolExecutor- and a Queue-based interface.

By the way libchirp for python are bindings to my C99-implementation. My secondary goal is to build a polyglot message-passing toolkit. Please be welcome to contribute bindings for your favorite language.



from Planet Python
via read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...