microagent


Namemicroagent JSON
Version 1.7.3 PyPI version JSON
download
home_page
SummaryTool for agent ecosystem
upload_time2024-03-12 15:33:11
maintainer
docs_urlNone
author
requires_python>=3.10
licenseMIT License Copyright (c) 2019 Dmitry Vlasov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords async pubsub queue agent periodic cron
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            MicroAgent
==========

.. image:: https://img.shields.io/pypi/v/microagent.svg
   :target: https://pypi.python.org/pypi/microagent

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

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

.. image:: https://img.shields.io/pypi/status/microagent.svg
  :target: https://pypi.python.org/pypi/microagent

.. image:: https://img.shields.io/pypi/dd/microagent.svg
  :target: https://pypi.python.org/pypi/microagent

.. image:: https://codecov.io/gh/scailer/microagent/branch/master/graph/badge.svg
  :target: https://codecov.io/gh/scailer/microagent

.. image:: https://travis-ci.com/scailer/microagent.svg?branch=master
  :target: https://travis-ci.con/scailer/microagent

.. image:: https://readthedocs.org/projects/microagent/badge/?version=latest&style=flat
  :target: https://microagent.readthedocs.io/


The goal of this project is to facilitate the creation of **microservices**
interacting via a **signal bus** and/or **queue broker**.

The philosophy of this project is to present a microservice as a software agent
that directly interacts only with queues and the event bus, and not with other microservices.

Tool is intended for developing:

* distributed apps with **event-driven** architecture
* distributed apps with **data-driven** architecture
* multi-processors apps 


Tool provide features:

* running a **periodical tasks** (interval or as CRON)
* specification of signals (events), their sending and receiving via the bus (redis_)
* description of queues, sending and receiving messages via the queue broker (aioamqp_, kafka_, redis_)
* limited **RPC** via signal bus
* launching sub-services (in the same process)
* launching a group of microagents (each in a separate process)
* mocks for bus and broker


See MicroAgent documentation_.


.. code-block:: python

    class Agent(MicroAgent):

        @on('pre_start')
        async def setup(self):
            pass  # init connections to DB, REDIS, SMTP and other services

        @periodic(period=5)
        async def refresh_cache(self):
            pass  # do something periodicly

        @cron('0 */4 * * *')
        async def send_report(self):
            pass  # do something by schedule

        # subscribe to signals (events)
        @receiver(signals.user_updated, signals.user_deleted)
        async def send_notification(self, **kwargs):
            # send signal (event) to bus
            await self.bus.check_something.send(sender='agent', **kwargs)

        # message consumer from queue
        @consumer(queues.mailer)
        async def send_emails(self, **kwargs):
            # send message to queue
            await self.broker.statistic_collector.send(kwargs)


    async def main():
        bus = RedisSignalBus('redis://localhost/7')
        broker = RedisBroker('redis://localhost/7')

        # usage bus and broker separate from agent
        await bus.started.send('user_agent')
        await broker.mailer(data)

        agent = Agent(bus=bus, broker=broker)
        await agent.start()

Installing
----------

With redis_ backend provide signal bus and list-based queues::

    pip install 'microagent[redis]'

With aioamqp_ backend provide queues over AMQP (RabbitMQ)::

    pip install 'microagent[amqp]'

With kafka_ backend provide queues over Kafka (experemental)::

    pip install 'microagent[kafka]'


.. _redis: https://pypi.org/project/redis/
.. _aioamqp: https://pypi.org/project/aioamqp/
.. _kafka: https://pypi.org/project/aiokafka/
.. _documentation: https://microagent.readthedocs.io/

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "microagent",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "async,pubsub,queue,agent,periodic,cron",
    "author": "",
    "author_email": "Dmitriy Vlasov <scailer@yandex.ru>",
    "download_url": "https://files.pythonhosted.org/packages/ad/08/207c154d0ea77a0204803af9102b2c51158ff6694b14630702066a4b43ff/microagent-1.7.3.tar.gz",
    "platform": null,
    "description": "MicroAgent\n==========\n\n.. image:: https://img.shields.io/pypi/v/microagent.svg\n   :target: https://pypi.python.org/pypi/microagent\n\n.. image:: https://img.shields.io/pypi/pyversions/microagent.svg\n  :target: https://pypi.python.org/pypi/microagent\n\n.. image:: https://img.shields.io/pypi/l/microagent.svg\n  :target: https://pypi.python.org/pypi/microagent\n\n.. image:: https://img.shields.io/pypi/status/microagent.svg\n  :target: https://pypi.python.org/pypi/microagent\n\n.. image:: https://img.shields.io/pypi/dd/microagent.svg\n  :target: https://pypi.python.org/pypi/microagent\n\n.. image:: https://codecov.io/gh/scailer/microagent/branch/master/graph/badge.svg\n  :target: https://codecov.io/gh/scailer/microagent\n\n.. image:: https://travis-ci.com/scailer/microagent.svg?branch=master\n  :target: https://travis-ci.con/scailer/microagent\n\n.. image:: https://readthedocs.org/projects/microagent/badge/?version=latest&style=flat\n  :target: https://microagent.readthedocs.io/\n\n\nThe goal of this project is to facilitate the creation of **microservices**\ninteracting via a **signal bus** and/or **queue broker**.\n\nThe philosophy of this project is to present a microservice as a software agent\nthat directly interacts only with queues and the event bus, and not with other microservices.\n\nTool is intended for developing:\n\n* distributed apps with **event-driven** architecture\n* distributed apps with **data-driven** architecture\n* multi-processors apps \n\n\nTool provide features:\n\n* running a **periodical tasks** (interval or as CRON)\n* specification of signals (events), their sending and receiving via the bus (redis_)\n* description of queues, sending and receiving messages via the queue broker (aioamqp_, kafka_, redis_)\n* limited **RPC** via signal bus\n* launching sub-services (in the same process)\n* launching a group of microagents (each in a separate process)\n* mocks for bus and broker\n\n\nSee MicroAgent documentation_.\n\n\n.. code-block:: python\n\n    class Agent(MicroAgent):\n\n        @on('pre_start')\n        async def setup(self):\n            pass  # init connections to DB, REDIS, SMTP and other services\n\n        @periodic(period=5)\n        async def refresh_cache(self):\n            pass  # do something periodicly\n\n        @cron('0 */4 * * *')\n        async def send_report(self):\n            pass  # do something by schedule\n\n        # subscribe to signals (events)\n        @receiver(signals.user_updated, signals.user_deleted)\n        async def send_notification(self, **kwargs):\n            # send signal (event) to bus\n            await self.bus.check_something.send(sender='agent', **kwargs)\n\n        # message consumer from queue\n        @consumer(queues.mailer)\n        async def send_emails(self, **kwargs):\n            # send message to queue\n            await self.broker.statistic_collector.send(kwargs)\n\n\n    async def main():\n        bus = RedisSignalBus('redis://localhost/7')\n        broker = RedisBroker('redis://localhost/7')\n\n        # usage bus and broker separate from agent\n        await bus.started.send('user_agent')\n        await broker.mailer(data)\n\n        agent = Agent(bus=bus, broker=broker)\n        await agent.start()\n\nInstalling\n----------\n\nWith redis_ backend provide signal bus and list-based queues::\n\n    pip install 'microagent[redis]'\n\nWith aioamqp_ backend provide queues over AMQP (RabbitMQ)::\n\n    pip install 'microagent[amqp]'\n\nWith kafka_ backend provide queues over Kafka (experemental)::\n\n    pip install 'microagent[kafka]'\n\n\n.. _redis: https://pypi.org/project/redis/\n.. _aioamqp: https://pypi.org/project/aioamqp/\n.. _kafka: https://pypi.org/project/aiokafka/\n.. _documentation: https://microagent.readthedocs.io/\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2019 Dmitry Vlasov  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Tool for agent ecosystem",
    "version": "1.7.3",
    "project_urls": {
        "Changelog": "https://github.com/scailer/microagent/blob/master/CHANGELOG.rst",
        "Documentation": "https://microagent.readthedocs.io/en/stable/",
        "Homepage": "https://github.com/scailer/microagent",
        "Repository": "https://github.com/scailer/microagent.git"
    },
    "split_keywords": [
        "async",
        "pubsub",
        "queue",
        "agent",
        "periodic",
        "cron"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "31a6cafe2a93f52549ed262a01ddd2396e5d211e90220e2ee8147620114129a3",
                "md5": "8283541119c1bb30fc5c055a4e896db8",
                "sha256": "42c73823ae2e6be0b9c2ae71fc764acc78fcb6b2ce0ef0eb03d7affc57ec4678"
            },
            "downloads": -1,
            "filename": "microagent-1.7.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8283541119c1bb30fc5c055a4e896db8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 33506,
            "upload_time": "2024-03-12T15:33:08",
            "upload_time_iso_8601": "2024-03-12T15:33:08.783696Z",
            "url": "https://files.pythonhosted.org/packages/31/a6/cafe2a93f52549ed262a01ddd2396e5d211e90220e2ee8147620114129a3/microagent-1.7.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ad08207c154d0ea77a0204803af9102b2c51158ff6694b14630702066a4b43ff",
                "md5": "6fcee548c4799adca3db11db96c0f5c6",
                "sha256": "deee0c979478c5abeefea9f514bc6f14ca51f89a725b8f31233fcb31ef37e298"
            },
            "downloads": -1,
            "filename": "microagent-1.7.3.tar.gz",
            "has_sig": false,
            "md5_digest": "6fcee548c4799adca3db11db96c0f5c6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 54208,
            "upload_time": "2024-03-12T15:33:11",
            "upload_time_iso_8601": "2024-03-12T15:33:11.115486Z",
            "url": "https://files.pythonhosted.org/packages/ad/08/207c154d0ea77a0204803af9102b2c51158ff6694b14630702066a4b43ff/microagent-1.7.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-12 15:33:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "scailer",
    "github_project": "microagent",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "lcname": "microagent"
}
        
Elapsed time: 0.19715s