patio-rabbitmq


Namepatio-rabbitmq JSON
Version 0.1.1 PyPI version JSON
download
home_page
SummaryRabbitMQ broker implementation for PATIO
upload_time2023-06-09 08:18:24
maintainer
docs_urlNone
authorDmitry Orlov
requires_python>=3.8,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI - License](https://img.shields.io/pypi/l/patio-rabbitmq)](https://pypi.org/project/patio-rabbitmq) [![Wheel](https://img.shields.io/pypi/wheel/patio-rabbitmq)](https://pypi.org/project/patio-rabbitmq) [![Mypy](http://www.mypy-lang.org/static/mypy_badge.svg)]() [![PyPI](https://img.shields.io/pypi/v/patio-rabbitmq)](https://pypi.org/project/patio-rabbitmq) [![PyPI](https://img.shields.io/pypi/pyversions/patio-rabbitmq)](https://pypi.org/project/patio-rabbitmq) [![Coverage Status](https://coveralls.io/repos/github/patio-python/patio-rabbitmq/badge.svg?branch=master)](https://coveralls.io/github/patio-python/patio-rabbitmq?branch=master) ![tox](https://github.com/patio-python/patio-rabbitmq/workflows/tests/badge.svg?branch=master)

PATIO Rabbitmq
==============

PATIO is an acronym for **P**ython **A**synchronous **T**ask for Async**IO**.

This package provides RabbitMQ broker implementation.

Example
-------

### Task executor

```python
import asyncio
import operator
from functools import reduce

from patio import Registry, ThreadPoolExecutor

from patio_rabbitmq import RabbitMQBroker


rpc = Registry(project="patio-rabbitmq", auto_naming=False)


@rpc("mul")
def mul(*args):
    return reduce(operator.mul, args)


async def main():
    async with ThreadPoolExecutor(rpc, max_workers=16) as executor:
        async with RabbitMQBroker(
            executor, amqp_url="amqp://guest:guest@localhost/",
        ) as broker:
            await broker.join()


if __name__ == "__main__":
    asyncio.run(main())
```

### Task producer

```python
import asyncio

from patio import NullExecutor, Registry

from patio_rabbitmq import RabbitMQBroker


async def main():
    async with NullExecutor(Registry(project="patio-rabbitmq")) as executor:
        async with RabbitMQBroker(
            executor, amqp_url="amqp://guest:guest@localhost/",
        ) as broker:
            print(
                await asyncio.gather(
                    *[
                        broker.call("mul", i, i, timeout=1) for i in range(10)
                    ]
                ),
            )


if __name__ == "__main__":
    asyncio.run(main())

```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "patio-rabbitmq",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Dmitry Orlov",
    "author_email": "me@mosquito.su",
    "download_url": "https://files.pythonhosted.org/packages/af/09/2152cb4bc2d9f2181d0f745211ad2b56e07e599da82e59bb0efc43c140eb/patio_rabbitmq-0.1.1.tar.gz",
    "platform": null,
    "description": "[![PyPI - License](https://img.shields.io/pypi/l/patio-rabbitmq)](https://pypi.org/project/patio-rabbitmq) [![Wheel](https://img.shields.io/pypi/wheel/patio-rabbitmq)](https://pypi.org/project/patio-rabbitmq) [![Mypy](http://www.mypy-lang.org/static/mypy_badge.svg)]() [![PyPI](https://img.shields.io/pypi/v/patio-rabbitmq)](https://pypi.org/project/patio-rabbitmq) [![PyPI](https://img.shields.io/pypi/pyversions/patio-rabbitmq)](https://pypi.org/project/patio-rabbitmq) [![Coverage Status](https://coveralls.io/repos/github/patio-python/patio-rabbitmq/badge.svg?branch=master)](https://coveralls.io/github/patio-python/patio-rabbitmq?branch=master) ![tox](https://github.com/patio-python/patio-rabbitmq/workflows/tests/badge.svg?branch=master)\n\nPATIO Rabbitmq\n==============\n\nPATIO is an acronym for **P**ython **A**synchronous **T**ask for Async**IO**.\n\nThis package provides RabbitMQ broker implementation.\n\nExample\n-------\n\n### Task executor\n\n```python\nimport asyncio\nimport operator\nfrom functools import reduce\n\nfrom patio import Registry, ThreadPoolExecutor\n\nfrom patio_rabbitmq import RabbitMQBroker\n\n\nrpc = Registry(project=\"patio-rabbitmq\", auto_naming=False)\n\n\n@rpc(\"mul\")\ndef mul(*args):\n    return reduce(operator.mul, args)\n\n\nasync def main():\n    async with ThreadPoolExecutor(rpc, max_workers=16) as executor:\n        async with RabbitMQBroker(\n            executor, amqp_url=\"amqp://guest:guest@localhost/\",\n        ) as broker:\n            await broker.join()\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n### Task producer\n\n```python\nimport asyncio\n\nfrom patio import NullExecutor, Registry\n\nfrom patio_rabbitmq import RabbitMQBroker\n\n\nasync def main():\n    async with NullExecutor(Registry(project=\"patio-rabbitmq\")) as executor:\n        async with RabbitMQBroker(\n            executor, amqp_url=\"amqp://guest:guest@localhost/\",\n        ) as broker:\n            print(\n                await asyncio.gather(\n                    *[\n                        broker.call(\"mul\", i, i, timeout=1) for i in range(10)\n                    ]\n                ),\n            )\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "RabbitMQ broker implementation for PATIO",
    "version": "0.1.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "49076c77b0492556eb6f63b3f72adee5279d69d43f8226b64262952dbc3d7c10",
                "md5": "7729ec2c8c97bea47c4271a8599f6f76",
                "sha256": "0e9172704adb921fe3167d6fe3fb46f00af59637e38d66c95deca033a7b2fa34"
            },
            "downloads": -1,
            "filename": "patio_rabbitmq-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7729ec2c8c97bea47c4271a8599f6f76",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 3628,
            "upload_time": "2023-06-09T08:18:23",
            "upload_time_iso_8601": "2023-06-09T08:18:23.270550Z",
            "url": "https://files.pythonhosted.org/packages/49/07/6c77b0492556eb6f63b3f72adee5279d69d43f8226b64262952dbc3d7c10/patio_rabbitmq-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "af092152cb4bc2d9f2181d0f745211ad2b56e07e599da82e59bb0efc43c140eb",
                "md5": "642626cecb060ce82e540e8129e067a4",
                "sha256": "61d1c13f3875f0be226923c41ef12f6b5a8725c0294aba7319e4cb1015e75859"
            },
            "downloads": -1,
            "filename": "patio_rabbitmq-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "642626cecb060ce82e540e8129e067a4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 2841,
            "upload_time": "2023-06-09T08:18:24",
            "upload_time_iso_8601": "2023-06-09T08:18:24.861234Z",
            "url": "https://files.pythonhosted.org/packages/af/09/2152cb4bc2d9f2181d0f745211ad2b56e07e599da82e59bb0efc43c140eb/patio_rabbitmq-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-09 08:18:24",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "patio-rabbitmq"
}
        
Elapsed time: 0.17865s