--- id: pika version: "1.4.4" license: BSD-3-Clause license_treatment: permissive maintenance: active --- # pika — Pika Python AMQP Client Library License: permissive · Maintenance: active · Downloads: 13.8M/mo ## 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 above — 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 pip install pika uv add pika poetry add pika ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 13.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags rabbitmq client python, amqp 0-9-1 protocol, message queue publisher consumer, rabbitmq python library, amqp client library, blocking connection adapter, asynchronous message broker, message-queue, rabbitmq, amqp [View on SkillFed](https://skillfed.io/packages/pika) · [View on PyPI](https://pypi.org/project/pika/)