pika
Pika Python AMQP Client Library
What it is and what it does
Pika is a pure-Python implementation of the AMQP 0-9-1 protocol with RabbitMQ extensions, allowing Python applications to publish and consume messages from RabbitMQ brokers. It supports Python 3.7 and later on CPython and PyPy, with no external runtime dependencies.
The library provides multiple connection adapters to suit different application patterns: BlockingConnection for synchronous code, SelectConnection for asynchronous I/O without external frameworks, and specialized adapters for AsyncIO, Gevent, Tornado, and Twisted. It handles connection recovery, multi-host failover, and thread-safe callback mechanisms for delegating work across threads while maintaining the single-threaded constraint of individual connection instances.
Use it for:
- Publish messages to RabbitMQ queues from Python services using BlockingConnection for simple synchronous workflows.
- Consume and process messages from RabbitMQ with automatic acknowledgment handling and error recovery.
- Build asynchronous message-driven applications using AsyncIO or Tornado adapters for high-concurrency scenarios.
- Implement fault-tolerant RabbitMQ clients with multi-host connection parameters and automatic retry logic.
- Delegate message processing to background threads while maintaining AMQP heartbeat and I/O servicing in the main thread.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Pika is a pure-Python AMQP 0-9-1 client library for RabbitMQ that enables you to publish and consume messages over AMQP connections.
Yes. Pika is a mature, actively maintained library with no security vulnerabilities, zero runtime dependencies, and broad Python version support. It is the standard choice for RabbitMQ integration in Python and suitable for both simple and complex messaging patterns. Install it if you need to communicate with RabbitMQ.
Install
pika on PyPI
pip
pip install pikauv
uv add pikapoetry
poetry add pikaInstalling pika
Before you install
Installation is straightforward with no runtime dependencies and a pure-Python wheel. The project is actively maintained with a recent release and has been in production use since 2010.
License in practice
BSD-3-Clause is a permissive license that allows commercial use, modification, and distribution with minimal restrictions—suitable for most projects.
Quickstart
import pika
connection = pika.BlockingConnection()
channel = connection.channel()
channel.basic_publish(exchange='test', routing_key='test', body=b'Test message.')
connection.close()
Requires a running RabbitMQ server accessible at the connection parameters.
Verify before relying
- Performance characteristics and throughput limits under load conditions.
- Thread-safety guarantees and recommended patterns for multi-threaded applications.
- Compatibility details with specific RabbitMQ server versions beyond AMQP 0-9-1 protocol support.
- Default connection host and port when not explicitly specified.
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 8 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 13,782,804/month — #1,263 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pika-1.4.4-py3-none-any.whl
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
aio-pikaaio-pika is an asyncio-based wrapper around…
permissive · top 5,000 on PyPI
pamqppamqp encodes and decodes AMQP 0-9-1 protocol…
permissive · top 5,000 on PyPI
AMQPStormA thread-safe Python 3 client library for…
permissive · top 15,000 on PyPI
amqpPure-Python AMQP 0.9.1 client library for…
permissive · top 1,000 on PyPI
aiormqaiormq is a pure Python AMQP 0.9.1 client…
permissive · top 5,000 on PyPI
pyrabbit2Pyrabbit2 provides a Python interface to the…
permissive · top 15,000 on PyPI
pika-stubsProvides type stubs for the pika RabbitMQ…
permissive · top 15,000 on PyPI
opentelemetry-instrumentation-pikaAdds distributed tracing to pika (RabbitMQ…
permissive · top 5,000 on PyPI
types-pikaProvides type stubs for the Pika RabbitMQ…
permissive · top 15,000 on PyPI
kombuKombu is a messaging library that provides a…
permissive · top 1,000 on PyPI