kiwipy


Namekiwipy JSON
Version 0.7.0 PyPI version JSON
download
home_pagehttps://github.com/aiidateam/kiwipy.git
SummaryRobust, high-volume, message based communication made easy
upload_time2020-11-04 10:41:49
maintainer
docs_urlNone
authorMartin Uhrin
requires_python>=3.6.2
licenseGPLv3 and MIT
keywords communication messaging rpc broadcast
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. _AiiDA: https://www.aiida.net
.. _rmq tutorial: https://www.rabbitmq.com/getstarted.html
.. _documentation: https://kiwipy.readthedocs.io/en/latest/index.html


kiwiPy
======

.. image:: docs/source/_static/logo.svg
   :height: 64px
   :width: 64px
   :alt: kiwiPy

.. image:: https://codecov.io/gh/aiidateam/kiwipy/branch/develop/graph/badge.svg
    :target: https://codecov.io/gh/aiidateam/kiwipy
    :alt: Coveralls

.. image:: https://github.com/aiidateam/kiwipy/workflows/continuous-integration/badge.svg
    :target: https://github.com/aiidateam/kiwipy/actions?query=workflow%3Acontinuous-integration
    :alt: Github Actions

.. image:: https://img.shields.io/pypi/v/kiwipy.svg
    :target: https://pypi.python.org/pypi/kiwipy/
    :alt: Latest Version

.. image:: https://img.shields.io/pypi/pyversions/kiwipy.svg
    :target: https://pypi.python.org/pypi/kiwipy/

.. image:: https://img.shields.io/pypi/l/kiwipy.svg
    :target: https://pypi.python.org/pypi/kiwipy/

.. image:: https://joss.theoj.org/papers/10.21105/joss.02351/status.svg
   :target: https://doi.org/10.21105/joss.02351



`kiwiPy`_ is a library that makes remote messaging using RabbitMQ (and possibly other message brokers) EASY.  It was
designed to support high-throughput workflows in big-data and computational science settings and is currently used
by `AiiDA`_ for computational materials research around the world.  That said, kiwiPy is entirely general and can
be used anywhere where high-throughput and robust messaging are needed.

Here's what you get:

* RPC
* Broadcast (with filters)
* Task queue messages

Let's dive in, with some examples taken from the `rmq tutorial`_.  To see more detail head over to the `documentation`_.

RPC
---

The client:

.. code-block:: python

    import kiwipy

    with kiwipy.connect('amqp://localhost') as comm:
        # Send an RPC message
        print(" [x] Requesting fib(30)")
        response = comm.rpc_send('fib', 30).result()
        print((" [.] Got %r" % response))

`(rmq_rpc_client.py source) <https://raw.githubusercontent.com/aiidateam/kiwipy/develop/examples/rmq_rpc_client.py>`_


The server:

.. code-block:: python

    import threading
    import kiwipy

    def fib(comm, num):
        if num == 0:
            return 0
        if num == 1:
            return 1

        return fib(comm, num - 1) + fib(comm, num - 2)

    with kiwipy.connect('amqp://127.0.0.1') as comm:
        # Register an RPC subscriber with the name 'fib'
        comm.add_rpc_subscriber(fib, 'fib')
        # Now wait indefinitely for fibonacci calls
        threading.Event().wait()

`(rmq_rpc_server.py source) <https://raw.githubusercontent.com/aiidateam/kiwipy/develop/examples/rmq_rpc_server.py>`_


Worker
------

Create a new task:

.. code-block:: python

    import sys
    import kiwipy

    message = ' '.join(sys.argv[1:]) or "Hello World!"

    with rmq.connect('amqp://localhost') as comm:
        comm.task_send(message)

`(rmq_new_task.py source) <https://raw.githubusercontent.com/aiidateam/kiwipy/develop/examples/rmq_new_task.py>`_


And the worker:

.. code-block:: python

    import time
    import threading
    import kiwipy

    print(' [*] Waiting for messages. To exit press CTRL+C')


    def callback(_comm, task):
        print((" [x] Received %r" % task))
        time.sleep(task.count(b'.'))
        print(" [x] Done")


    try:
        with kiwipy.connect('amqp://localhost') as comm:
            comm.add_task_subscriber(callback)
            threading.Event().wait()
    except KeyboardInterrupt:
        pass

`(rmq_worker.py source) <https://raw.githubusercontent.com/aiidateam/kiwipy/develop/examples/rmq_worker.py>`_

Citing
======

If you use kiwiPy directly or indirectly (e.g. by using `AiiDA`_) then please cite:

Uhrin, M., & Huber, S. P. (2020). kiwiPy : Robust , high-volume , messaging for big-data and computational science workflows, 5, 4–6. http://doi.org/10.21105/joss.02351

This helps us to keep making community software.

Versioning
==========

This software follows `Semantic Versioning`_

Contributing
============

Want a new feature? Found a bug? Want to contribute more documentation or a translation perhaps?

Help is always welcome, get started with the `contributing guide <https://github.com/aiidateam/kiwipy/wiki/Contributing>`__.

.. _Semantic Versioning: http://semver.org/



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/aiidateam/kiwipy.git",
    "name": "kiwipy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6.2",
    "maintainer_email": "",
    "keywords": "communication messaging rpc broadcast",
    "author": "Martin Uhrin",
    "author_email": "martin.uhrin.10@ucl.ac.uk",
    "download_url": "https://files.pythonhosted.org/packages/46/f1/da2ff24f6998c373c3c9b4dc348915d1fca993978becb6d451e6307d0bc2/kiwipy-0.7.0.tar.gz",
    "platform": "",
    "description": ".. _AiiDA: https://www.aiida.net\n.. _rmq tutorial: https://www.rabbitmq.com/getstarted.html\n.. _documentation: https://kiwipy.readthedocs.io/en/latest/index.html\n\n\nkiwiPy\n======\n\n.. image:: docs/source/_static/logo.svg\n   :height: 64px\n   :width: 64px\n   :alt: kiwiPy\n\n.. image:: https://codecov.io/gh/aiidateam/kiwipy/branch/develop/graph/badge.svg\n    :target: https://codecov.io/gh/aiidateam/kiwipy\n    :alt: Coveralls\n\n.. image:: https://github.com/aiidateam/kiwipy/workflows/continuous-integration/badge.svg\n    :target: https://github.com/aiidateam/kiwipy/actions?query=workflow%3Acontinuous-integration\n    :alt: Github Actions\n\n.. image:: https://img.shields.io/pypi/v/kiwipy.svg\n    :target: https://pypi.python.org/pypi/kiwipy/\n    :alt: Latest Version\n\n.. image:: https://img.shields.io/pypi/pyversions/kiwipy.svg\n    :target: https://pypi.python.org/pypi/kiwipy/\n\n.. image:: https://img.shields.io/pypi/l/kiwipy.svg\n    :target: https://pypi.python.org/pypi/kiwipy/\n\n.. image:: https://joss.theoj.org/papers/10.21105/joss.02351/status.svg\n   :target: https://doi.org/10.21105/joss.02351\n\n\n\n`kiwiPy`_ is a library that makes remote messaging using RabbitMQ (and possibly other message brokers) EASY.  It was\ndesigned to support high-throughput workflows in big-data and computational science settings and is currently used\nby `AiiDA`_ for computational materials research around the world.  That said, kiwiPy is entirely general and can\nbe used anywhere where high-throughput and robust messaging are needed.\n\nHere's what you get:\n\n* RPC\n* Broadcast (with filters)\n* Task queue messages\n\nLet's dive in, with some examples taken from the `rmq tutorial`_.  To see more detail head over to the `documentation`_.\n\nRPC\n---\n\nThe client:\n\n.. code-block:: python\n\n    import kiwipy\n\n    with kiwipy.connect('amqp://localhost') as comm:\n        # Send an RPC message\n        print(\" [x] Requesting fib(30)\")\n        response = comm.rpc_send('fib', 30).result()\n        print((\" [.] Got %r\" % response))\n\n`(rmq_rpc_client.py source) <https://raw.githubusercontent.com/aiidateam/kiwipy/develop/examples/rmq_rpc_client.py>`_\n\n\nThe server:\n\n.. code-block:: python\n\n    import threading\n    import kiwipy\n\n    def fib(comm, num):\n        if num == 0:\n            return 0\n        if num == 1:\n            return 1\n\n        return fib(comm, num - 1) + fib(comm, num - 2)\n\n    with kiwipy.connect('amqp://127.0.0.1') as comm:\n        # Register an RPC subscriber with the name 'fib'\n        comm.add_rpc_subscriber(fib, 'fib')\n        # Now wait indefinitely for fibonacci calls\n        threading.Event().wait()\n\n`(rmq_rpc_server.py source) <https://raw.githubusercontent.com/aiidateam/kiwipy/develop/examples/rmq_rpc_server.py>`_\n\n\nWorker\n------\n\nCreate a new task:\n\n.. code-block:: python\n\n    import sys\n    import kiwipy\n\n    message = ' '.join(sys.argv[1:]) or \"Hello World!\"\n\n    with rmq.connect('amqp://localhost') as comm:\n        comm.task_send(message)\n\n`(rmq_new_task.py source) <https://raw.githubusercontent.com/aiidateam/kiwipy/develop/examples/rmq_new_task.py>`_\n\n\nAnd the worker:\n\n.. code-block:: python\n\n    import time\n    import threading\n    import kiwipy\n\n    print(' [*] Waiting for messages. To exit press CTRL+C')\n\n\n    def callback(_comm, task):\n        print((\" [x] Received %r\" % task))\n        time.sleep(task.count(b'.'))\n        print(\" [x] Done\")\n\n\n    try:\n        with kiwipy.connect('amqp://localhost') as comm:\n            comm.add_task_subscriber(callback)\n            threading.Event().wait()\n    except KeyboardInterrupt:\n        pass\n\n`(rmq_worker.py source) <https://raw.githubusercontent.com/aiidateam/kiwipy/develop/examples/rmq_worker.py>`_\n\nCiting\n======\n\nIf you use kiwiPy directly or indirectly (e.g. by using `AiiDA`_) then please cite:\n\nUhrin, M., & Huber, S. P. (2020). kiwiPy : Robust , high-volume , messaging for big-data and computational science workflows, 5, 4\u20136. http://doi.org/10.21105/joss.02351\n\nThis helps us to keep making community software.\n\nVersioning\n==========\n\nThis software follows `Semantic Versioning`_\n\nContributing\n============\n\nWant a new feature? Found a bug? Want to contribute more documentation or a translation perhaps?\n\nHelp is always welcome, get started with the `contributing guide <https://github.com/aiidateam/kiwipy/wiki/Contributing>`__.\n\n.. _Semantic Versioning: http://semver.org/\n\n\n",
    "bugtrack_url": null,
    "license": "GPLv3 and MIT",
    "summary": "Robust, high-volume, message based communication made easy",
    "version": "0.7.0",
    "split_keywords": [
        "communication",
        "messaging",
        "rpc",
        "broadcast"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "660abe065694fb5054393983089abdb3",
                "sha256": "85b5d7f5248a5d249ce0be38dc4f836fc6c4235b934c9a53fca7b70ebcb4e447"
            },
            "downloads": -1,
            "filename": "kiwipy-0.7.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "660abe065694fb5054393983089abdb3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6.2",
            "size": 27758,
            "upload_time": "2020-11-04T10:41:47",
            "upload_time_iso_8601": "2020-11-04T10:41:47.140660Z",
            "url": "https://files.pythonhosted.org/packages/b5/98/7d149ab50802e444dc0955248a8d0353ce7bf9ae14adabed442e4667d334/kiwipy-0.7.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "57ce6405c7b7152a030d3537528ebbd2",
                "sha256": "dd77cdcebd8765feea870f3efb2fdf7b151fc1e196d057671b31fcc6832241d1"
            },
            "downloads": -1,
            "filename": "kiwipy-0.7.0.tar.gz",
            "has_sig": false,
            "md5_digest": "57ce6405c7b7152a030d3537528ebbd2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6.2",
            "size": 44322,
            "upload_time": "2020-11-04T10:41:49",
            "upload_time_iso_8601": "2020-11-04T10:41:49.102086Z",
            "url": "https://files.pythonhosted.org/packages/46/f1/da2ff24f6998c373c3c9b4dc348915d1fca993978becb6d451e6307d0bc2/kiwipy-0.7.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-11-04 10:41:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "aiidateam",
    "error": "Could not fetch GitHub repository",
    "lcname": "kiwipy"
}
        
Elapsed time: 0.14782s