ANN: pamqp 4.0 released

12 views
Skip to first unread message

Gavin M. Roy

unread,
Apr 2, 2026, 1:52:09 PM (3 days ago) Apr 2
to rabbitm...@googlegroups.com
I am pleased to announce pamqp 4.0 has been released.  pamqp is a low-level AMQP 0.9.1 Python library that is used by multiple RabbitMQ client libraries.

Breaking Changes
  • Python 3.11+ required (previously 3.7+)
  • Removed explicit __annotations__ class variable from all command classes and base classes. Python manages __annotations__ automatically; the explicit declarations conflict with object.__annotations__. Code that introspected MyCommand.__annotations__ directly may need updating.
Bug Fixes
  • Fix Basic.Reject(requeue=False) being coerced to True — The codegen emitted self.requeue = requeue or True which made it impossible to reject without requeuing. Now uses a proper ternary to preserve explicit False. (#45 related, also previously fixed in 3.0.1 but regressed)
  • Fix Exchange.Declare(internal=True) raising ValueError — The internal flag was incorrectly treated as a deprecated field. It is a legitimate AMQP flag used for internal exchanges and RabbitMQ tracing.
  • Fix encoding of negative byte-range integers in field tables (#45) — table_integer routed values in -128..127 to octet() which uses unsigned byte format (struct 'B'), causing struct.error for negative values like -1. Now uses signed byte format (struct '>b'). This affected x-priority, x-delivery-limit, and any other table argument using small negative integers.
  • Fix codegen domain regex for exchange/queue names — The codegen now extends the AMQP spec regex to include characters RabbitMQ allows in practice (@, #, ,, /, +, space), and fixes a bug where the trailing-comma replacement corrupted regex patterns containing commas.
Improvements
  • Full type checking with mypy and basedpyright — Both type checkers now pass cleanly and are enforced in pre-commit hooks and CI.
  • typing.ClassVar annotations on all class-level attributes across base classes, command classes, body, header, and heartbeat modules. Codegen updated to emit these correctly.
  • Explicit submodule imports in __init__.py to satisfy basedpyright's reportUnsupportedDunderAll check.
  • Boolean default assignment fix in codegen — Boolean fields with defaults now use ternary expressions (x if x is not None else default) instead of x or default, which correctly preserves False values.
Documentation can be found at https://gmr.github.io/pamqp/

Regards,

Gavin
Reply all
Reply to author
Forward
0 new messages