This release is a pre-release and may not be stable for production use.
RabbitMQ AMQP 1.0 Python version 2.x
RabbitMQ AMQP 1.0 Python client version 2.x for RabbitMQ 4.x.
Client is tested and validated against RabbitMQ 4.3.0
This client version built from scratch.
The primary reason for this rewrite is to remove the dependency on the qpid-proton C library present in version 1.0, providing a fully native Python client, see here.
This client is inspired by the Java and .NET AMQP 1.0 clients, aiming to deliver the same behavior and user experience across ecosystems.
The client is different from 1.0 and not compatible, so read the documentation before updating the client.
Install
The client is distributed via PIP:
pip install rabbitmq-amqp-python-client==2.0.0ax
Build from source
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
This repository's own sandbox could not reach PyPI, so its
.venvwas created withpython3 -m venv --system-site-packages .venvto pick up an already installed ruff/mypy/pytest, and the examples are run withPYTHONPATH=.(the project root) instead of an editable install. That is an environment quirk, not a project requirement — with the editable install above,import rabbitmq_amqp_python_clientjust works from anywhere.
Quick start
from rabbitmq_amqp_python_client import Connection, ConnectionParameters, Context, Message
connection = Connection(ConnectionParameters()) # localhost:5672, guest/guest
try:
connection.management().queue("my-queue").declare()
def handle(context: Context, message: Message) -> None:
print("received", message.body_as_string())
context.accept()
consumer = connection.consumer_builder().queue("my-queue").message_handler(handle).build()
publisher = connection.publisher_builder().queue("my-queue").build()
result = publisher.publish(Message("hello"))
print("published:", result.outcome.state.value) # -> accepted
publisher.close()
consumer.close()
connection.management().queue("my-queue").delete()
finally:
connection.close()
Examples
docs/examples/README.md catalogues thirteen runnable
scripts, in reading order — from basic_connection.py through publishing and
consuming to auto-reconnection, presettled consumers, direct reply-to,
rejection reasons, single-active-consumer notifications, stream filtering and
TLS/certificate-based authentication.
Each one talks to a local broker:
PYTHONPATH=. .venv/bin/python docs/examples/basic_connection.py
Threading
A single Connection can be shared by all threads in a process: it guards its
state and socket writes with internal locks. Create one Publisher and one
Consumer per thread rather than sharing them. They are safe to share, but
they serialise calls, so sharing gains no throughput. Consumer handlers run on
the client's own delivery threads, so protect any state they share with your
code. See docs/examples/multithreaded_example.py.
Development
make install # create .venv and install the package with its dev extras
make format # ruff format, then ruff check --fix
make lint # ruff check and ruff format --check
make typecheck # mypy rabbitmq_amqp_python_client, in strict mode
make test-unit # the unit suite; no broker needed
make test-integration # the integration suite; needs a broker on localhost:5672
make test # both suites
The example scripts are type-checked too:
MYPYPATH=. .venv/bin/python -m mypy docs/examples/*.py
Project layout
rabbitmq_amqp_python_client/ holds the client: wire/ is the protocol
layer (type codec, frames, performatives, messages, SASL) and knows nothing
above itself, and connection.py, session.py, link.py, management.py,
publisher.py, consumer.py and reconnection.py build the public API on top
of it. tests/unit covers each of those against an in-process fake broker and
needs no network; tests/integration runs the same surface against a real
broker and is marked integration. docs/examples/ holds the runnable scripts
the specifications ask for.
Metadata
Release files for rabbitmq-amqp-python-client 2.0.0rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rabbitmq_amqp_python_client-2.0.0rc1.tar.gz | 318.5 kB | Without provenance | Details for rabbitmq_amqp_python_client-2.0.0rc1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rabbitmq_amqp_python_client-2.0.0rc1-py3-none-any.whl | Python 3 | none | any | Details for rabbitmq_amqp_python_client-2.0.0rc1-py3-none-any.whl |
Total release size: 430.9 kB
Release files / rabbitmq_amqp_python_client-2.0.0rc1.tar.gz
| Download URL | rabbitmq_amqp_python_client-2.0.0rc1.tar.gz |
|---|---|
| Size | 318.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f56bd68e8a3d31b63e5a315a3431233ed43ed8778e1ec341ee43fbfd0aea2d0e
|
|
BLAKE2b-256 checksum How to use checksums |
4266ac42e4177d4b14757fa0aebf238ebe375d5560554b735047d5fc7dd3e0d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / rabbitmq_amqp_python_client-2.0.0rc1-py3-none-any.whl
| Download URL | rabbitmq_amqp_python_client-2.0.0rc1-py3-none-any.whl |
|---|---|
| Size | 112.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c77ec41ee564402e8916d191f085fac4e63c0141c68dd266532904e11695429
|
|
BLAKE2b-256 checksum How to use checksums |
1dffc8c632f74d6d061a7b5fe91d64986e626d365b4b8c5a5fa8b0f70ddcf295
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for rabbitmq-amqp-python-client 2.0.0rc1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.