| Name | aiocarrot JSON |
| Version |
1.0.2
JSON |
| download |
| home_page | None |
| Summary | Asynchronous framework for working with RabbitMQ |
| upload_time | 2024-10-21 17:42:11 |
| maintainer | None |
| docs_url | None |
| author | None |
| requires_python | >=3.10 |
| license | None |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# aiocarrot
**aiocarrot** is a fully asynchronous framework for working with the <a href="https://www.rabbitmq.com/">RabbitMQ</a> message broker
___
**Source Code: https://github.com/d3nbr0/aiocarrot**
___
The key features are:
* **Completely asynchronous** - aiocarrot has the <a href="https://pypi.org/project/aio-pika/">aiopika</a> library running under the hood
* **Fast to code** - the framework allows you to reduce the amount of code in your project, as well as speed up its development
* **Fields validation** - aiocarrot supports field validation using <a href="https://pypi.org/project/pydantic/">pydantic</a>
## Requirements
The following dependencies are required for **aiocarrot** to work:
* <a href="https://pypi.org/project/aio-pika/">aio-pika</a> for working with RabbitMQ
* <a href="https://pypi.org/project/pydantic/">pydantic</a> for fields validation
* <a href="https://pypi.org/project/ujson/">ujson</a> for sending and receiving messages
* <a href="https://pypi.org/project/loguru/">loguru</a> for logging :)
## Installation
Create and activate virtual environment and then install **aiocarrot**:
```commandline
pip install aiocarrot
```
## Example
Create a file `main.py` with:
```python
from aiocarrot import Carrot, Consumer
import asyncio
consumer = Consumer()
@consumer.message(name='multiply')
async def multiply(first_number: int, second_number: int) -> None:
print('Result is:', first_number * second_number)
async def main() -> None:
carrot = Carrot(url='amqp://guest:guest@127.0.0.1/', queue_name='sample')
carrot.setup_consumer(consumer)
await carrot.run()
if __name__ == '__main__':
asyncio.run(main())
```
Then run it with:
```commandline
python main.py
```
Now you have created a consumer with the ability to receive a **"multiply"** task
### Produce message
If you want to send a message, use this:
```python
from aiocarrot import Carrot
import asyncio
async def main() -> None:
carrot = Carrot(url='amqp://guest:guest@127.0.0.1:5672/', queue_name='sample')
await carrot.send('multiply', first_number=10, second_number=20)
if __name__ == '__main__':
asyncio.run(main())
```
**You can find more examples <a href="https://github.com/d3nbr0/aiocarrot/tree/main/examples">here</a>**
It's very simple to use. Enjoy!
Raw data
{
"_id": null,
"home_page": null,
"name": "aiocarrot",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "Denis Shurygin <main@denbro.ru>",
"keywords": null,
"author": null,
"author_email": "Denis Shurygin <main@denbro.ru>",
"download_url": "https://files.pythonhosted.org/packages/58/f6/285abd2faf91995017cac79c8cc66c6d5f807e330e8912e51257cf183cdd/aiocarrot-1.0.2.tar.gz",
"platform": null,
"description": "# aiocarrot\n\n**aiocarrot** is a fully asynchronous framework for working with the <a href=\"https://www.rabbitmq.com/\">RabbitMQ</a> message broker\n\n___\n\n**Source Code: https://github.com/d3nbr0/aiocarrot**\n\n___\n\nThe key features are:\n\n* **Completely asynchronous** - aiocarrot has the <a href=\"https://pypi.org/project/aio-pika/\">aiopika</a> library running under the hood\n* **Fast to code** - the framework allows you to reduce the amount of code in your project, as well as speed up its development\n* **Fields validation** - aiocarrot supports field validation using <a href=\"https://pypi.org/project/pydantic/\">pydantic</a>\n\n## Requirements\n\nThe following dependencies are required for **aiocarrot** to work:\n\n* <a href=\"https://pypi.org/project/aio-pika/\">aio-pika</a> for working with RabbitMQ\n* <a href=\"https://pypi.org/project/pydantic/\">pydantic</a> for fields validation\n* <a href=\"https://pypi.org/project/ujson/\">ujson</a> for sending and receiving messages\n* <a href=\"https://pypi.org/project/loguru/\">loguru</a> for logging :)\n\n## Installation\n\nCreate and activate virtual environment and then install **aiocarrot**:\n\n```commandline\npip install aiocarrot\n```\n\n## Example\n\nCreate a file `main.py` with:\n\n```python\nfrom aiocarrot import Carrot, Consumer\n\nimport asyncio\n\n\nconsumer = Consumer()\n\n\n@consumer.message(name='multiply')\nasync def multiply(first_number: int, second_number: int) -> None:\n print('Result is:', first_number * second_number)\n\n\nasync def main() -> None:\n carrot = Carrot(url='amqp://guest:guest@127.0.0.1/', queue_name='sample')\n carrot.setup_consumer(consumer)\n await carrot.run()\n\n\nif __name__ == '__main__':\n asyncio.run(main())\n```\n\nThen run it with:\n\n```commandline\npython main.py\n```\n\nNow you have created a consumer with the ability to receive a **\"multiply\"** task\n\n### Produce message\n\nIf you want to send a message, use this:\n\n```python\nfrom aiocarrot import Carrot\n\nimport asyncio\n\n\nasync def main() -> None:\n carrot = Carrot(url='amqp://guest:guest@127.0.0.1:5672/', queue_name='sample')\n \n await carrot.send('multiply', first_number=10, second_number=20)\n\n\nif __name__ == '__main__':\n asyncio.run(main())\n```\n\n**You can find more examples <a href=\"https://github.com/d3nbr0/aiocarrot/tree/main/examples\">here</a>**\n\nIt's very simple to use. Enjoy!\n",
"bugtrack_url": null,
"license": null,
"summary": "Asynchronous framework for working with RabbitMQ",
"version": "1.0.2",
"project_urls": {
"Repository": "https://github.com/d3nbr0/aiocarrot"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3fdc9fcb2bd74299ba1c7a449473b7aa0276f7141b4bb4c414ba5585124dc080",
"md5": "3769400302e1f3b24924c2f5ba80fc03",
"sha256": "d73ffebcc533077b366a2c91fd06224d2749bbce497393ef3f5b62e7d805021e"
},
"downloads": -1,
"filename": "aiocarrot-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3769400302e1f3b24924c2f5ba80fc03",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 7992,
"upload_time": "2024-10-21T17:42:09",
"upload_time_iso_8601": "2024-10-21T17:42:09.787878Z",
"url": "https://files.pythonhosted.org/packages/3f/dc/9fcb2bd74299ba1c7a449473b7aa0276f7141b4bb4c414ba5585124dc080/aiocarrot-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "58f6285abd2faf91995017cac79c8cc66c6d5f807e330e8912e51257cf183cdd",
"md5": "8db46d6b43d9e9c2edc882621ebdd7d6",
"sha256": "9a1ac17860fce86654d8c03561ef736c780a0f333205e227a27d034b14571132"
},
"downloads": -1,
"filename": "aiocarrot-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "8db46d6b43d9e9c2edc882621ebdd7d6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 7219,
"upload_time": "2024-10-21T17:42:11",
"upload_time_iso_8601": "2024-10-21T17:42:11.690948Z",
"url": "https://files.pythonhosted.org/packages/58/f6/285abd2faf91995017cac79c8cc66c6d5f807e330e8912e51257cf183cdd/aiocarrot-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-21 17:42:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "d3nbr0",
"github_project": "aiocarrot",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "aiocarrot"
}