.. _documentation: https://docs.aio-pika.com/
.. _adopted official RabbitMQ tutorial: https://docs.aio-pika.com/rabbitmq-tutorial/index.html
aio-pika
========
.. image:: https://coveralls.io/repos/github/mosquito/aio-pika/badge.svg?branch=master
:target: https://coveralls.io/github/mosquito/aio-pika
:alt: Coveralls
.. image:: https://github.com/mosquito/aio-pika/workflows/tests/badge.svg
:target: https://github.com/mosquito/aio-pika/actions?query=workflow%3Atests
:alt: Github Actions
.. image:: https://img.shields.io/pypi/v/aio-pika.svg
:target: https://pypi.python.org/pypi/aio-pika/
:alt: Latest Version
.. image:: https://img.shields.io/pypi/wheel/aio-pika.svg
:target: https://pypi.python.org/pypi/aio-pika/
.. image:: https://img.shields.io/pypi/pyversions/aio-pika.svg
:target: https://pypi.python.org/pypi/aio-pika/
.. image:: https://img.shields.io/pypi/l/aio-pika.svg
:target: https://pypi.python.org/pypi/aio-pika/
A wrapper around `aiormq`_ for asyncio and humans.
Check out the examples and the tutorial in the `documentation`_.
If you are a newcomer to RabbitMQ, please start with the `adopted official RabbitMQ tutorial`_.
.. _aiormq: http://github.com/mosquito/aiormq/
.. note::
Since version ``5.0.0`` this library doesn't use ``pika`` as AMQP connector.
Versions below ``5.0.0`` contains or requires ``pika``'s source code.
.. note::
The version 7.0.0 has breaking API changes, see CHANGELOG.md
for migration hints.
Features
--------
* Completely asynchronous API.
* Object oriented API.
* Transparent auto-reconnects with complete state recovery with `connect_robust`
(e.g. declared queues or exchanges, consuming state and bindings).
* Python 3.7+ compatible.
* For python 3.5 users, aio-pika is available via `aio-pika<7`.
* Transparent `publisher confirms`_ support.
* `Transactions`_ support.
* Complete type-hints coverage.
.. _Transactions: https://www.rabbitmq.com/semantics.html
.. _publisher confirms: https://www.rabbitmq.com/confirms.html
Installation
------------
.. code-block:: shell
pip install aio-pika
Usage example
-------------
Simple consumer:
.. code-block:: python
import asyncio
import aio_pika
import aio_pika.abc
async def main(loop):
# Connecting with the given parameters is also possible.
# aio_pika.connect_robust(host="host", login="login", password="password")
# You can only choose one option to create a connection, url or kw-based params.
connection = await aio_pika.connect_robust(
"amqp://guest:guest@127.0.0.1/", loop=loop
)
async with connection:
queue_name = "test_queue"
# Creating channel
channel: aio_pika.abc.AbstractChannel = await connection.channel()
# Declaring queue
queue: aio_pika.abc.AbstractQueue = await channel.declare_queue(
queue_name,
auto_delete=True
)
async with queue.iterator() as queue_iter:
# Cancel consuming after __aexit__
async for message in queue_iter:
async with message.process():
print(message.body)
if queue.name in message.body.decode():
break
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))
loop.close()
Simple publisher:
.. code-block:: python
import asyncio
import aio_pika
import aio_pika.abc
async def main(loop):
# Explicit type annotation
connection: aio_pika.RobustConnection = await aio_pika.connect_robust(
"amqp://guest:guest@127.0.0.1/", loop=loop
)
routing_key = "test_queue"
channel: aio_pika.abc.AbstractChannel = await connection.channel()
await channel.default_exchange.publish(
aio_pika.Message(
body='Hello {}'.format(routing_key).encode()
),
routing_key=routing_key
)
await connection.close()
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))
loop.close()
Get single message example:
.. code-block:: python
import asyncio
from aio_pika import connect_robust, Message
async def main(loop):
connection = await connect_robust(
"amqp://guest:guest@127.0.0.1/",
loop=loop
)
queue_name = "test_queue"
routing_key = "test_queue"
# Creating channel
channel = await connection.channel()
# Declaring exchange
exchange = await channel.declare_exchange('direct', auto_delete=True)
# Declaring queue
queue = await channel.declare_queue(queue_name, auto_delete=True)
# Binding queue
await queue.bind(exchange, routing_key)
await exchange.publish(
Message(
bytes('Hello', 'utf-8'),
content_type='text/plain',
headers={'foo': 'bar'}
),
routing_key
)
# Receiving message
incoming_message = await queue.get(timeout=5)
# Confirm message
await incoming_message.ack()
await queue.unbind(exchange, routing_key)
await queue.delete()
await connection.close()
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))
There are more examples and the RabbitMQ tutorial in the `documentation`_.
See also
==========
`aiormq`_
---------
`aiormq` is a pure python AMQP client library. It is under the hood of **aio-pika** and might to be used when you really loving works with the protocol low level.
Following examples demonstrates the user API.
Simple consumer:
.. code-block:: python
import asyncio
import aiormq
async def on_message(message):
"""
on_message doesn't necessarily have to be defined as async.
Here it is to show that it's possible.
"""
print(f" [x] Received message {message!r}")
print(f"Message body is: {message.body!r}")
print("Before sleep!")
await asyncio.sleep(5) # Represents async I/O operations
print("After sleep!")
async def main():
# Perform connection
connection = await aiormq.connect("amqp://guest:guest@localhost/")
# Creating a channel
channel = await connection.channel()
# Declaring queue
declare_ok = await channel.queue_declare('helo')
consume_ok = await channel.basic_consume(
declare_ok.queue, on_message, no_ack=True
)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.run_forever()
Simple publisher:
.. code-block:: python
import asyncio
from typing import Optional
import aiormq
from aiormq.abc import DeliveredMessage
MESSAGE: Optional[DeliveredMessage] = None
async def main():
global MESSAGE
body = b'Hello World!'
# Perform connection
connection = await aiormq.connect("amqp://guest:guest@localhost//")
# Creating a channel
channel = await connection.channel()
declare_ok = await channel.queue_declare("hello", auto_delete=True)
# Sending the message
await channel.basic_publish(body, routing_key='hello')
print(f" [x] Sent {body}")
MESSAGE = await channel.basic_get(declare_ok.queue)
print(f" [x] Received message from {declare_ok.queue!r}")
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
assert MESSAGE is not None
assert MESSAGE.routing_key == "hello"
assert MESSAGE.body == b'Hello World!'
The `patio`_ and the `patio-rabbitmq`_
--------------------------------------
**PATIO** is an acronym for Python Asynchronous Tasks for AsyncIO - an easily extensible library, for distributed task execution, like celery, only targeting asyncio as the main design approach.
**patio-rabbitmq** provides you with the ability to use *RPC over RabbitMQ* services with extremely simple implementation:
.. code-block:: python
from patio import Registry, ThreadPoolExecutor
from patio_rabbitmq import RabbitMQBroker
rpc = Registry(project="patio-rabbitmq", auto_naming=False)
@rpc("sum")
def sum(*args):
return sum(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()
And the caller side might be written like this:
.. code-block:: 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)
]
))
`FastStream`_
---------------
**FastStream** is a powerful and easy-to-use Python library for building asynchronous services that interact with event streams..
If you need no deep dive into **RabbitMQ** details, you can use more high-level **FastStream** interfaces:
.. code-block:: python
from faststream import FastStream
from faststream.rabbit import RabbitBroker
broker = RabbitBroker("amqp://guest:guest@localhost:5672/")
app = FastStream(broker)
@broker.subscriber("user")
async def user_created(user_id: int):
assert isinstance(user_id, int)
return f"user-{user_id}: created"
@app.after_startup
async def pub_smth():
assert (
await broker.publish(1, "user", rpc=True)
) == "user-1: created"
Also, **FastStream** validates messages by **pydantic**, generates your project **AsyncAPI** spec, supports In-Memory testing, RPC calls, and more.
In fact, it is a high-level wrapper on top of **aio-pika**, so you can use both of these libraries' advantages at the same time.
`python-socketio`_
------------------
`Socket.IO`_ is a transport protocol that enables real-time bidirectional event-based communication between clients (typically, though not always, web browsers) and a server. This package provides Python implementations of both, each with standard and asyncio variants.
Also this package is suitable for building messaging services over **RabbitMQ** via **aio-pika** adapter:
.. code-block:: python
import socketio
from aiohttp import web
sio = socketio.AsyncServer(client_manager=socketio.AsyncAioPikaManager())
app = web.Application()
sio.attach(app)
@sio.event
async def chat_message(sid, data):
print("message ", data)
if __name__ == '__main__':
web.run_app(app)
And a client is able to call `chat_message` the following way:
.. code-block:: python
import asyncio
import socketio
sio = socketio.AsyncClient()
async def main():
await sio.connect('http://localhost:8080')
await sio.emit('chat_message', {'response': 'my response'})
if __name__ == '__main__':
asyncio.run(main())
The `taskiq`_ and the `taskiq-aio-pika`_
----------------------------------------
**Taskiq** is an asynchronous distributed task queue for python. The project takes inspiration from big projects such as Celery and Dramatiq. But taskiq can send and run both the sync and async functions.
The library provides you with **aio-pika** broker for running tasks too.
.. code-block:: python
from taskiq_aio_pika import AioPikaBroker
broker = AioPikaBroker()
@broker.task
async def test() -> None:
print("nothing")
async def main():
await broker.startup()
await test.kiq()
`Rasa`_
-------
With over 25 million downloads, Rasa Open Source is the most popular open source framework for building chat and voice-based AI assistants.
With **Rasa**, you can build contextual assistants on:
* Facebook Messenger
* Slack
* Google Hangouts
* Webex Teams
* Microsoft Bot Framework
* Rocket.Chat
* Mattermost
* Telegram
* Twilio
Your own custom conversational channels or voice assistants as:
* Alexa Skills
* Google Home Actions
**Rasa** helps you build contextual assistants capable of having layered conversations with lots of back-and-forth. In order for a human to have a meaningful exchange with a contextual assistant, the assistant needs to be able to use context to build on things that were previously discussed – **Rasa** enables you to build assistants that can do this in a scalable way.
And it also uses **aio-pika** to interact with **RabbitMQ** deep inside!
Versioning
==========
This software follows `Semantic Versioning`_
For contributors
----------------
Setting up development environment
__________________________________
Clone the project:
.. code-block:: shell
git clone https://github.com/mosquito/aio-pika.git
cd aio-pika
Create a new virtualenv for `aio-pika`_:
.. code-block:: shell
python3 -m venv env
source env/bin/activate
Install all requirements for `aio-pika`_:
.. code-block:: shell
pip install -e '.[develop]'
Running Tests
_____________
**NOTE: In order to run the tests locally you need to run a RabbitMQ instance with default user/password (guest/guest) and port (5672).**
The Makefile provides a command to run an appropriate RabbitMQ Docker image:
.. code-block:: bash
make rabbitmq
To test just run:
.. code-block:: bash
make test
Editing Documentation
_____________________
To iterate quickly on the documentation live in your browser, try:
.. code-block:: bash
nox -s docs -- serve
Creating Pull Requests
______________________
Please feel free to create pull requests, but you should describe your use cases and add some examples.
Changes should follow a few simple rules:
* When your changes break the public API, you must increase the major version.
* When your changes are safe for public API (e.g. added an argument with default value)
* You have to add test cases (see `tests/` folder)
* You must add docstrings
* Feel free to add yourself to `"thank's to" section`_
.. _"thank's to" section: https://github.com/mosquito/aio-pika/blob/master/docs/source/index.rst#thanks-for-contributing
.. _Semantic Versioning: http://semver.org/
.. _aio-pika: https://github.com/mosquito/aio-pika/
.. _faststream: https://github.com/airtai/faststream
.. _patio: https://github.com/patio-python/patio
.. _patio-rabbitmq: https://github.com/patio-python/patio-rabbitmq
.. _Socket.IO: https://socket.io/
.. _python-socketio: https://python-socketio.readthedocs.io/en/latest/intro.html
.. _taskiq: https://github.com/taskiq-python/taskiq
.. _taskiq-aio-pika: https://github.com/taskiq-python/taskiq-aio-pika
.. _Rasa: https://rasa.com/docs/rasa/
Raw data
{
"_id": null,
"home_page": "https://github.com/mosquito/aio-pika",
"name": "aio-pika",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "rabbitmq, asyncio, amqp, amqp 0.9.1, aiormq",
"author": "Dmitry Orlov",
"author_email": "me@mosquito.su",
"download_url": "https://files.pythonhosted.org/packages/3f/48/135433f37334f7d774dd73e67fde122ea69c03331fd8e02d043c99122567/aio_pika-9.5.4.tar.gz",
"platform": null,
"description": ".. _documentation: https://docs.aio-pika.com/\n.. _adopted official RabbitMQ tutorial: https://docs.aio-pika.com/rabbitmq-tutorial/index.html\n\n\naio-pika\n========\n\n.. image:: https://coveralls.io/repos/github/mosquito/aio-pika/badge.svg?branch=master\n :target: https://coveralls.io/github/mosquito/aio-pika\n :alt: Coveralls\n\n.. image:: https://github.com/mosquito/aio-pika/workflows/tests/badge.svg\n :target: https://github.com/mosquito/aio-pika/actions?query=workflow%3Atests\n :alt: Github Actions\n\n.. image:: https://img.shields.io/pypi/v/aio-pika.svg\n :target: https://pypi.python.org/pypi/aio-pika/\n :alt: Latest Version\n\n.. image:: https://img.shields.io/pypi/wheel/aio-pika.svg\n :target: https://pypi.python.org/pypi/aio-pika/\n\n.. image:: https://img.shields.io/pypi/pyversions/aio-pika.svg\n :target: https://pypi.python.org/pypi/aio-pika/\n\n.. image:: https://img.shields.io/pypi/l/aio-pika.svg\n :target: https://pypi.python.org/pypi/aio-pika/\n\n\nA wrapper around `aiormq`_ for asyncio and humans.\n\nCheck out the examples and the tutorial in the `documentation`_.\n\nIf you are a newcomer to RabbitMQ, please start with the `adopted official RabbitMQ tutorial`_.\n\n.. _aiormq: http://github.com/mosquito/aiormq/\n\n.. note::\n Since version ``5.0.0`` this library doesn't use ``pika`` as AMQP connector.\n Versions below ``5.0.0`` contains or requires ``pika``'s source code.\n\n.. note::\n The version 7.0.0 has breaking API changes, see CHANGELOG.md\n for migration hints.\n\n\nFeatures\n--------\n\n* Completely asynchronous API.\n* Object oriented API.\n* Transparent auto-reconnects with complete state recovery with `connect_robust`\n (e.g. declared queues or exchanges, consuming state and bindings).\n* Python 3.7+ compatible.\n* For python 3.5 users, aio-pika is available via `aio-pika<7`.\n* Transparent `publisher confirms`_ support.\n* `Transactions`_ support.\n* Complete type-hints coverage.\n\n\n.. _Transactions: https://www.rabbitmq.com/semantics.html\n.. _publisher confirms: https://www.rabbitmq.com/confirms.html\n\n\nInstallation\n------------\n\n.. code-block:: shell\n\n pip install aio-pika\n\n\nUsage example\n-------------\n\nSimple consumer:\n\n.. code-block:: python\n\n import asyncio\n import aio_pika\n import aio_pika.abc\n\n\n async def main(loop):\n # Connecting with the given parameters is also possible.\n # aio_pika.connect_robust(host=\"host\", login=\"login\", password=\"password\")\n # You can only choose one option to create a connection, url or kw-based params.\n connection = await aio_pika.connect_robust(\n \"amqp://guest:guest@127.0.0.1/\", loop=loop\n )\n\n async with connection:\n queue_name = \"test_queue\"\n\n # Creating channel\n channel: aio_pika.abc.AbstractChannel = await connection.channel()\n\n # Declaring queue\n queue: aio_pika.abc.AbstractQueue = await channel.declare_queue(\n queue_name,\n auto_delete=True\n )\n\n async with queue.iterator() as queue_iter:\n # Cancel consuming after __aexit__\n async for message in queue_iter:\n async with message.process():\n print(message.body)\n\n if queue.name in message.body.decode():\n break\n\n\n if __name__ == \"__main__\":\n loop = asyncio.get_event_loop()\n loop.run_until_complete(main(loop))\n loop.close()\n\nSimple publisher:\n\n.. code-block:: python\n\n import asyncio\n import aio_pika\n import aio_pika.abc\n\n\n async def main(loop):\n # Explicit type annotation\n connection: aio_pika.RobustConnection = await aio_pika.connect_robust(\n \"amqp://guest:guest@127.0.0.1/\", loop=loop\n )\n\n routing_key = \"test_queue\"\n\n channel: aio_pika.abc.AbstractChannel = await connection.channel()\n\n await channel.default_exchange.publish(\n aio_pika.Message(\n body='Hello {}'.format(routing_key).encode()\n ),\n routing_key=routing_key\n )\n\n await connection.close()\n\n\n if __name__ == \"__main__\":\n loop = asyncio.get_event_loop()\n loop.run_until_complete(main(loop))\n loop.close()\n\n\nGet single message example:\n\n.. code-block:: python\n\n import asyncio\n from aio_pika import connect_robust, Message\n\n\n async def main(loop):\n connection = await connect_robust(\n \"amqp://guest:guest@127.0.0.1/\",\n loop=loop\n )\n\n queue_name = \"test_queue\"\n routing_key = \"test_queue\"\n\n # Creating channel\n channel = await connection.channel()\n\n # Declaring exchange\n exchange = await channel.declare_exchange('direct', auto_delete=True)\n\n # Declaring queue\n queue = await channel.declare_queue(queue_name, auto_delete=True)\n\n # Binding queue\n await queue.bind(exchange, routing_key)\n\n await exchange.publish(\n Message(\n bytes('Hello', 'utf-8'),\n content_type='text/plain',\n headers={'foo': 'bar'}\n ),\n routing_key\n )\n\n # Receiving message\n incoming_message = await queue.get(timeout=5)\n\n # Confirm message\n await incoming_message.ack()\n\n await queue.unbind(exchange, routing_key)\n await queue.delete()\n await connection.close()\n\n\n if __name__ == \"__main__\":\n loop = asyncio.get_event_loop()\n loop.run_until_complete(main(loop))\n\n\nThere are more examples and the RabbitMQ tutorial in the `documentation`_.\n\nSee also\n==========\n\n`aiormq`_\n---------\n\n`aiormq` is a pure python AMQP client library. It is under the hood of **aio-pika** and might to be used when you really loving works with the protocol low level.\nFollowing examples demonstrates the user API.\n\nSimple consumer:\n\n.. code-block:: python\n\n import asyncio\n import aiormq\n\n async def on_message(message):\n \"\"\"\n on_message doesn't necessarily have to be defined as async.\n Here it is to show that it's possible.\n \"\"\"\n print(f\" [x] Received message {message!r}\")\n print(f\"Message body is: {message.body!r}\")\n print(\"Before sleep!\")\n await asyncio.sleep(5) # Represents async I/O operations\n print(\"After sleep!\")\n\n async def main():\n # Perform connection\n connection = await aiormq.connect(\"amqp://guest:guest@localhost/\")\n\n # Creating a channel\n channel = await connection.channel()\n\n # Declaring queue\n declare_ok = await channel.queue_declare('helo')\n consume_ok = await channel.basic_consume(\n declare_ok.queue, on_message, no_ack=True\n )\n\n loop = asyncio.get_event_loop()\n loop.run_until_complete(main())\n loop.run_forever()\n\nSimple publisher:\n\n.. code-block:: python\n\n import asyncio\n from typing import Optional\n\n import aiormq\n from aiormq.abc import DeliveredMessage\n\n MESSAGE: Optional[DeliveredMessage] = None\n\n async def main():\n global MESSAGE\n body = b'Hello World!'\n\n # Perform connection\n connection = await aiormq.connect(\"amqp://guest:guest@localhost//\")\n\n # Creating a channel\n channel = await connection.channel()\n declare_ok = await channel.queue_declare(\"hello\", auto_delete=True)\n\n # Sending the message\n await channel.basic_publish(body, routing_key='hello')\n print(f\" [x] Sent {body}\")\n\n MESSAGE = await channel.basic_get(declare_ok.queue)\n print(f\" [x] Received message from {declare_ok.queue!r}\")\n\n loop = asyncio.get_event_loop()\n loop.run_until_complete(main())\n\n assert MESSAGE is not None\n assert MESSAGE.routing_key == \"hello\"\n assert MESSAGE.body == b'Hello World!'\n\nThe `patio`_ and the `patio-rabbitmq`_\n--------------------------------------\n\n**PATIO** is an acronym for Python Asynchronous Tasks for AsyncIO - an easily extensible library, for distributed task execution, like celery, only targeting asyncio as the main design approach.\n\n**patio-rabbitmq** provides you with the ability to use *RPC over RabbitMQ* services with extremely simple implementation:\n\n.. code-block:: python\n\n from patio import Registry, ThreadPoolExecutor\n from patio_rabbitmq import RabbitMQBroker\n\n rpc = Registry(project=\"patio-rabbitmq\", auto_naming=False)\n\n @rpc(\"sum\")\n def sum(*args):\n return sum(args)\n\n async 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\nAnd the caller side might be written like this:\n\n.. code-block:: python\n\n import asyncio\n from patio import NullExecutor, Registry\n from patio_rabbitmq import RabbitMQBroker\n\n async 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(await asyncio.gather(\n *[\n broker.call(\"mul\", i, i, timeout=1) for i in range(10)\n ]\n ))\n\n\n`FastStream`_\n---------------\n\n**FastStream** is a powerful and easy-to-use Python library for building asynchronous services that interact with event streams..\n\nIf you need no deep dive into **RabbitMQ** details, you can use more high-level **FastStream** interfaces:\n\n.. code-block:: python\n\n from faststream import FastStream\n from faststream.rabbit import RabbitBroker\n\n broker = RabbitBroker(\"amqp://guest:guest@localhost:5672/\")\n app = FastStream(broker)\n\n @broker.subscriber(\"user\")\n async def user_created(user_id: int):\n assert isinstance(user_id, int)\n return f\"user-{user_id}: created\"\n\n @app.after_startup\n async def pub_smth():\n assert (\n await broker.publish(1, \"user\", rpc=True)\n ) == \"user-1: created\"\n\nAlso, **FastStream** validates messages by **pydantic**, generates your project **AsyncAPI** spec, supports In-Memory testing, RPC calls, and more.\n\nIn fact, it is a high-level wrapper on top of **aio-pika**, so you can use both of these libraries' advantages at the same time.\n\n`python-socketio`_\n------------------\n\n`Socket.IO`_ is a transport protocol that enables real-time bidirectional event-based communication between clients (typically, though not always, web browsers) and a server. This package provides Python implementations of both, each with standard and asyncio variants.\n\nAlso this package is suitable for building messaging services over **RabbitMQ** via **aio-pika** adapter:\n\n.. code-block:: python\n\n import socketio\n from aiohttp import web\n\n sio = socketio.AsyncServer(client_manager=socketio.AsyncAioPikaManager())\n app = web.Application()\n sio.attach(app)\n\n @sio.event\n async def chat_message(sid, data):\n print(\"message \", data)\n\n if __name__ == '__main__':\n web.run_app(app)\n\nAnd a client is able to call `chat_message` the following way:\n\n.. code-block:: python\n\n import asyncio\n import socketio\n\n sio = socketio.AsyncClient()\n\n async def main():\n await sio.connect('http://localhost:8080')\n await sio.emit('chat_message', {'response': 'my response'})\n\n if __name__ == '__main__':\n asyncio.run(main())\n\nThe `taskiq`_ and the `taskiq-aio-pika`_\n----------------------------------------\n\n**Taskiq** is an asynchronous distributed task queue for python. The project takes inspiration from big projects such as Celery and Dramatiq. But taskiq can send and run both the sync and async functions.\n\nThe library provides you with **aio-pika** broker for running tasks too.\n\n.. code-block:: python\n\n from taskiq_aio_pika import AioPikaBroker\n\n broker = AioPikaBroker()\n\n @broker.task\n async def test() -> None:\n print(\"nothing\")\n\n async def main():\n await broker.startup()\n await test.kiq()\n\n`Rasa`_\n-------\n\nWith over 25 million downloads, Rasa Open Source is the most popular open source framework for building chat and voice-based AI assistants.\n\nWith **Rasa**, you can build contextual assistants on:\n\n* Facebook Messenger\n* Slack\n* Google Hangouts\n* Webex Teams\n* Microsoft Bot Framework\n* Rocket.Chat\n* Mattermost\n* Telegram\n* Twilio\n\nYour own custom conversational channels or voice assistants as:\n\n* Alexa Skills\n* Google Home Actions\n\n**Rasa** helps you build contextual assistants capable of having layered conversations with lots of back-and-forth. In order for a human to have a meaningful exchange with a contextual assistant, the assistant needs to be able to use context to build on things that were previously discussed \u2013 **Rasa** enables you to build assistants that can do this in a scalable way.\n\nAnd it also uses **aio-pika** to interact with **RabbitMQ** deep inside!\n\nVersioning\n==========\n\nThis software follows `Semantic Versioning`_\n\n\nFor contributors\n----------------\n\nSetting up development environment\n__________________________________\n\nClone the project:\n\n.. code-block:: shell\n\n git clone https://github.com/mosquito/aio-pika.git\n cd aio-pika\n\nCreate a new virtualenv for `aio-pika`_:\n\n.. code-block:: shell\n\n python3 -m venv env\n source env/bin/activate\n\nInstall all requirements for `aio-pika`_:\n\n.. code-block:: shell\n\n pip install -e '.[develop]'\n\n\nRunning Tests\n_____________\n\n**NOTE: In order to run the tests locally you need to run a RabbitMQ instance with default user/password (guest/guest) and port (5672).**\n\nThe Makefile provides a command to run an appropriate RabbitMQ Docker image:\n\n.. code-block:: bash\n\n make rabbitmq\n\nTo test just run:\n\n.. code-block:: bash\n\n make test\n\n\nEditing Documentation\n_____________________\n\nTo iterate quickly on the documentation live in your browser, try:\n\n.. code-block:: bash\n\n nox -s docs -- serve\n\nCreating Pull Requests\n______________________\n\nPlease feel free to create pull requests, but you should describe your use cases and add some examples.\n\nChanges should follow a few simple rules:\n\n* When your changes break the public API, you must increase the major version.\n* When your changes are safe for public API (e.g. added an argument with default value)\n* You have to add test cases (see `tests/` folder)\n* You must add docstrings\n* Feel free to add yourself to `\"thank's to\" section`_\n\n\n.. _\"thank's to\" section: https://github.com/mosquito/aio-pika/blob/master/docs/source/index.rst#thanks-for-contributing\n.. _Semantic Versioning: http://semver.org/\n.. _aio-pika: https://github.com/mosquito/aio-pika/\n.. _faststream: https://github.com/airtai/faststream\n.. _patio: https://github.com/patio-python/patio\n.. _patio-rabbitmq: https://github.com/patio-python/patio-rabbitmq\n.. _Socket.IO: https://socket.io/\n.. _python-socketio: https://python-socketio.readthedocs.io/en/latest/intro.html\n.. _taskiq: https://github.com/taskiq-python/taskiq\n.. _taskiq-aio-pika: https://github.com/taskiq-python/taskiq-aio-pika\n.. _Rasa: https://rasa.com/docs/rasa/\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Wrapper around the aiormq for asyncio and humans",
"version": "9.5.4",
"project_urls": {
"Documentation": "https://docs.aio-pika.com/",
"Homepage": "https://github.com/mosquito/aio-pika",
"Source": "https://github.com/mosquito/aio-pika",
"Tracker": "https://github.com/mosquito/aio-pika/issues"
},
"split_keywords": [
"rabbitmq",
" asyncio",
" amqp",
" amqp 0.9.1",
" aiormq"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6d18caa2313da756d40c19f794a73e1f895225bcbecf5abfccbec08c0a44e5b7",
"md5": "dd8e59a2fe914789d5779d43ef9d9138",
"sha256": "a308f904cd4f97e2705662fe23cde37c6c7eddde0e1ea17467028fac6c474e15"
},
"downloads": -1,
"filename": "aio_pika-9.5.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dd8e59a2fe914789d5779d43ef9d9138",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 54196,
"upload_time": "2024-12-16T20:12:15",
"upload_time_iso_8601": "2024-12-16T20:12:15.028850Z",
"url": "https://files.pythonhosted.org/packages/6d/18/caa2313da756d40c19f794a73e1f895225bcbecf5abfccbec08c0a44e5b7/aio_pika-9.5.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3f48135433f37334f7d774dd73e67fde122ea69c03331fd8e02d043c99122567",
"md5": "2b528060e6d3401ac7c356d362661c6c",
"sha256": "5a1bad96a75fa5ac3aa5b2bbd3eca971ea9abda70693e4334e6e629639f8a8fc"
},
"downloads": -1,
"filename": "aio_pika-9.5.4.tar.gz",
"has_sig": false,
"md5_digest": "2b528060e6d3401ac7c356d362661c6c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 48394,
"upload_time": "2024-12-16T20:12:17",
"upload_time_iso_8601": "2024-12-16T20:12:17.427875Z",
"url": "https://files.pythonhosted.org/packages/3f/48/135433f37334f7d774dd73e67fde122ea69c03331fd8e02d043c99122567/aio_pika-9.5.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-16 20:12:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mosquito",
"github_project": "aio-pika",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "aio-pika"
}