{"id":17858501,"url":"https://github.com/d3nbr0/aiocarrot","last_synced_at":"2025-09-30T14:33:29.326Z","repository":{"id":258846549,"uuid":"875833525","full_name":"d3nbr0/aiocarrot","owner":"d3nbr0","description":"Asynchronous framework for working with RabbitMQ","archived":false,"fork":false,"pushed_at":"2024-12-13T13:03:20.000Z","size":25,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-13T02:21:26.830Z","etag":null,"topics":["aio-pika","aiormq","amqp","amqp-connection","async-python","asyncio","pydantic","python-3","python3-10","python3-11","python3-12","python3-13","rabbitmq","typehints"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/aiocarrot","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/d3nbr0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-20T23:49:24.000Z","updated_at":"2024-12-13T12:53:04.000Z","dependencies_parsed_at":"2024-10-27T06:15:57.616Z","dependency_job_id":null,"html_url":"https://github.com/d3nbr0/aiocarrot","commit_stats":null,"previous_names":["d3nbr0/aiocarrot"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3nbr0%2Faiocarrot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3nbr0%2Faiocarrot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3nbr0%2Faiocarrot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3nbr0%2Faiocarrot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d3nbr0","download_url":"https://codeload.github.com/d3nbr0/aiocarrot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234744633,"owners_count":18879955,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aio-pika","aiormq","amqp","amqp-connection","async-python","asyncio","pydantic","python-3","python3-10","python3-11","python3-12","python3-13","rabbitmq","typehints"],"created_at":"2024-10-28T05:07:46.089Z","updated_at":"2025-09-30T14:33:29.318Z","avatar_url":"https://github.com/d3nbr0.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aiocarrot\n\n**aiocarrot** is a fully asynchronous framework for working with the \u003ca href=\"https://www.rabbitmq.com/\"\u003eRabbitMQ\u003c/a\u003e message broker\n\n\u003ca href=\"https://github.com/d3nbr0/aiocarrot/actions?query=branch%3Amain+event%3Apush\"\u003e\n    \u003cimg src=\"https://github.com/d3nbr0/aiocarrot/workflows/tests/badge.svg\" alt=\"Tests\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://pypi.org/project/aiocarrot\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/aiocarrot?color=%2334D058\u0026label=pypi%20package\" alt=\"Version\"\u003e\n\u003c/a\u003e\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 \u003ca href=\"https://pypi.org/project/aio-pika/\"\u003eaiopika\u003c/a\u003e 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 \u003ca href=\"https://pypi.org/project/pydantic/\"\u003epydantic\u003c/a\u003e\n* **Scheduler** - describe the task launch period in the cron format\n\n## Requirements\n\nThe following dependencies are required for **aiocarrot** to work:\n\n* \u003ca href=\"https://pypi.org/project/aio-pika/\"\u003eaio-pika\u003c/a\u003e for working with RabbitMQ\n* \u003ca href=\"https://pypi.org/project/pydantic/\"\u003epydantic\u003c/a\u003e for fields validation\n* \u003ca href=\"https://pypi.org/project/ujson/\"\u003eujson\u003c/a\u003e for sending and receiving messages\n* \u003ca href=\"https://pypi.org/project/loguru/\"\u003eloguru\u003c/a\u003e 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) -\u003e None:\n    print('Result is:', first_number * second_number)\n\n\nasync def main() -\u003e 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() -\u003e 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### Scheduler\n\nYou can use the scheduler to run your tasks automatically.\u003cbr\u003e\nYou can schedule a task using the cron format. For example, to run a task once every 15 minutes: `*/15 * * * *`\u003cbr\u003e\n\n```python\n@consumer.message(name='example.scheduler', schedule='*/15 * * * *')\nasync def scheduler_message(value: Optional[int] = None) -\u003e None:\n    print('Your value is:', value or 0)\n```\n\n**NOTE**: The scheduler does not support working with arguments that do not have default values.\nIf you want to schedule a message and it has arguments, make sure they all have a default value.\n\n**You can find more examples \u003ca href=\"https://github.com/d3nbr0/aiocarrot/tree/main/examples\"\u003ehere\u003c/a\u003e**\n\nIt's very simple to use. Enjoy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd3nbr0%2Faiocarrot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd3nbr0%2Faiocarrot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd3nbr0%2Faiocarrot/lists"}