| Port variant | v14 |
| Summary | Pika Python AMQP Client Library (3.14) |
| Package version | 1.5.0 |
| Homepage | https://pika.github.io/pika/ |
| Keywords | python |
| Maintainer | Python Automaton |
| License | Not yet specified |
| Other variants | v15 |
| Ravenports | Buildsheet | History |
| Ravensource | Port Directory | History |
| Last modified | 18 NOV 2026, 00:01:03 UTC |
| Port created | 05 MAY 2024, 16:57:05 UTC |
| single | PikaRabbitMQ (AMQP 0-9-1) client library for Python [image] [image] [image] [image] [image] [image] [image] Introduction · Documentation · Example · Examples · Adapters · Contributing ## Introduction Pika is a pure-Python implementation of the AMQP 0-9-1 protocol including RabbitMQ's extensions. - Supports Python 3.7+ (CPython and PyPy; versions are listed on [PyPI]). Pika 1.1.0 was the last release that supported Python 2.7. - Since threads aren't appropriate to every situation, it doesn't require threads. Pika core takes care not to forbid them, either. The same goes for greenlets, callbacks, continuations, and generators. Most connection adapters are single-threaded; use `Connection` when you need to publish or consume from multiple threads. - People may be using direct sockets, plain old `select()`, or any of the wide variety of ways of getting network events to and from a Python application. Pika tries to stay compatible with all of these, and to make adapting it to a new environment as simple as possible. ## Documentation Pika's documentation can be found [here]. ## Example Sending a message with `pika.Connection`, which is thread-safe and runs its own IOLoop on a background thread: ```python import pika connection = pika.Connection(pika.ConnectionParameters()) channel = connection.channel() # RabbitMQ 4.3 and later refuse a queue that is neither durable nor exclusive. channel.queue_declare('test', durable=True) channel.basic_publish(exchange='', routing_key='test', body=b'Test message.') connection.close() ``` And consuming, where each delivery is dispatched on a per-channel worker thread, so slow processing does not stall heartbeats and `basic_ack` needs no `add_callback_threadsafe`: ```python import threading import pika connection = pika.Connection(pika.ConnectionParameters()) channel = connection.channel() channel.queue_declare('test', durable=True) def on_message(ch, method_frame, properties, body): print(method_frame, properties, body) ch.basic_ack(method_frame.delivery_tag) channel.basic_consume('test', on_message) try: # The IOLoop already runs in the background; block until interrupted. threading.Event().wait() except KeyboardInterrupt: connection.close() ``` ## Adapters Pika provides the following adapters: - `pika.Connection` - thread-safe, runs SelectConnection's IOLoop in a background thread. All channel methods are safe to call from any thread simultaneously. - `pika.SelectConnection` - asynchronous adapter without third-party |
| Build (only) |
python314:dev:std python-pip:single:v14 autoselect-python:single:std |
| Build and Runtime | python314:primary:std |
| main | mirror://PYPIWHL/d7/f5/9af08e02515a20341791263501c60c4ed099f3e429b77451da04a5ef1f99 |
| radicale:std | CalDAV and CardDAV Server |