This release brings support for a new version of aiormq
, which is used as
a low-level driver for working with AMQP.
The release contains a huge number of changes in the internal structure of the library, mainly related to type inheritance and abstract types, as well as typehints checking via mypy.
The biggest change to the user API is the violation of the inheritance order, due to the introduction of abstract types, so this release is a major one.
- There are a lot of changes in the structure of the library, due to the widespread use of typing.
aio_pika.abc
module now contains all types and abstract class prototypes.- Modern
aiormq~=6.1.1
used. - Complete type checks coverage via mypy.
- The interface of
aio_pika
's classes has undergone minimal changes, but you should double-check your code before migrating, at least because almost all types are now inaio_pika.abc
. Moduleaio_pika.types
still exists, but will produce aDeprecationWarning
. - Default value for argument
weak
is changed toFalse
inCallbackCollection.add(func, weak=False)
.
-
pamqp.specification
module didn't exist inpamqp==3.0.1
so you have to change it:pamqp.commands
for AMPQ-RPC–relates classespamqp.base
forFrame
classpamqp.body
forContentBody
classpamqp.commands
forBasic
,Channel
,Confirm
,Exchange
,Queue
,Tx
classes.pamqp.common
forFieldArray
,FieldTable
,FieldValue
classespamqp.constants
for constants likeREPLY_SUCCESS
.pamqp.header
forContentHeader
class.pamqp.heartbeat
forHeartbeat
class.
-
Type definitions related to imports from
aio_pika
might throw warnings like'SomeType' is not declared in __all__
. This is a normal situation, since now it is necessary to import types fromaio_pika.abc
. In this release, these are just warnings, but in the next major release, this will stop working, so you should take care of changes in your code.Just use
aio_pika.abc
in your imports.The list of deprecated imports:
from aio_pika.message import ReturnCallback
from aio_pika.patterns.rpc import RPCMessageType
- renamed toRPCMessageTypes
import aio_pika.types
- module deprecated useaio_pika.abc
insteadfrom aio_pika.connection import ConnectionType
- explicit
Channel.is_user_closed
property - user-friendly exception when channel has been closed
- reopen channels which are closed from the broker side
- Fix flapping test test_robust_duplicate_queue #424
- Fixed callback on_close for rpc #424
- fix: master deserialize types #366
- fix: add missing type hint on exchange publish method #370
- Return self instead of select result in
__aenter__
#373 - fix: call remove_close_callback #374
- Fix breaking change in callback definition #344
- Reworked tests and finally applied PR #311
- Improve documentation examples and snippets #339
- Restore RobustChannel.default_exchange on reconnect #340
- Improve the docs a bit #335
- Add generics to Pool and PoolItemContextManager #321
- Fix Docs for
DeliveryError
#322
- message.reject called inside ProcessContext.exit fails when channel is closed #302
- Add docs and github links to setup.py #304
- Type annotation fixes
- Add documentation
- Test fixes
- Add reopen method for channel #263
- Add get methods for exchange and queue #282
- fix type annotation and documentation for Connection.add_close_callback #290
- log channel close status
- add OSError to
CONNECTION_EXCEPTIONS
- [fix] heartbeat_last to heartbeat_last_received #274
- Fix memory leak #285
- Fix type hint #287
- Pass loop when connecting to aiormq #294
- RobustConnection cleanup fixes #273
- aiormq updates:
- Update tests for python 3.8
Pool.close()
method and allow to usePool
as a context manager #269- Fix stuck of
RobustConnection
when exclusive queues still locked on server-side #267 - Add
global_
parameter toChannel.set_qos
method #266 - Fix
Connection.drain()
isNone
Fix connection drain
- passing
client_properties
- Allow str as an exchange type #260
- Added typing on process method #252
- Documentation fixes
- Missed timeout parameter on
connect()
#245
- Unified
CallbackCollection
s for channels and connections - Make RobustConnection more robust
JsonRPC
andJsonMaster
adapters- Improve patterns documentation
- Extended ExchangeType #237. Added
x-modulus-hash
exchange type.
RobustConnection
logic changes (see #234). Thanks to @decaz for analysis and fixes.
- add more type annotations
- consistent setting headers for message #233
- Fixes: set header value on HeaderProxy #232
- Fixed #218. How to properly close RobustConnection?
- Fixed #216. Exception in Queue.consume callback isn't propagated properly.
- Allow to specify
requeue=
andreject_on_redelivered=
in Master pattern #212
- Fixed #209 int values for headers
- update aiormq version
- use
AMQPError
instead ofAMQPException
.AMQPException
is now alias forAMQPError
- Fix routing key handling (#206 @decaz)
- Fix URL building (#207 @decaz)
- Test suite for
connect
function
- Fix tests for
Pool
- no duplicate call message when exception
- add robust classes to apidoc
- use None instead of Elipsis for initial state (@chibby0ne)
Pool
: enable arguments for pool constructor (@chibby0ne)- Create py.typed (#176 @zarybnicky)
- Fix encode timestamp error on copy (#198 @tzoiker)
- Bump
aiormq
- Fix HeaderProxy bug (#195 @tzoiker)
- remove non-initialized channels when reconnect
- robust connection close only when unclosed
heartbeat_last
property
- Simple test suite for testing robust connection via tcp proxy
- robust connection initialization hotfix
- Connector is now
aiormq
and notpika
- Remove vendored
pika
- Compatibility changes:
- [HIGH] Exceptions hierarchy completely changed:
UnroutableError
removed. UseDeliveryError
instead.ConnectionRefusedError
is now standardConnectionError
- Each error code has separate exception type.
- [LOW]
Connection.close
method requires exception instead ofcode
reason
pair orNone
- [MEDIUM]
IncomingMessage.ack
IncomingMessage.nack
IncomingMessage.reject
returns coroutines. Old usage compatible but event loop might throw warnings. - [HIGH]
Message.timestamp
property is nowdatetime.datetime
- [LOW] Tracking of
publisher confirms
removed, using similar feature fromaiormq
instead. - [LOW] non async context manager
IncomingMessage.process()
is deprecated. Useasync with message.process():
instead.
- [HIGH] Exceptions hierarchy completely changed:
- Fix race condition on callback timeout #180
- Add abstract pool #174
- Fixed Deprecation Warnings in Python 3.7 #153
- Migrate from travis to drone.io
- Use pylava instead of pylama
- save passive flag on reconnect #170
- fixed inconsistent argument type for connection.connect #136
- fixed conditions for creating SSL connection. #135
- Fix UnboundLocalError exception #163
- RobustConnection fixes #162
- Fix code examples in the README.rst
- Close connection in examples
- Add content_type for all patterns
- Add special exceptions for Worker
- More extendable Master
- Fix #112
- Fix #155
- Add default params for RPC.cereate()
- Fix InvalidStateError when connection lost
- Fix: RPC stuck when response deserialization error
- Drop python 3.4 support
- prevent
set_results
on cancelled future #133 - Added asynchronous context manager support for channels #130
- BUGFIX: ChannelClosed exception was never retrieved
- BUGFIX: handle coroutine double wrapping for Python 3.4
- added example for URL which contains ssl required options.
ssl_options
for coonect and connect_robust- default ports for
amqp
andamqps
- python 3.4 fix
- Add
message_kwargs
for worker pattern
- Added
timeout
parameter forExchange.declare
- QueueEmpty exception public added to the module
__all__
- Ability to reconnect on Channel.Close
- Ability to reconnect on Channel.Cancel
- Rollback to pika==0.10 because new one had issues.
- Feature: abillity to use ExternalCredentials with blank login.
- Bugfix: _on_getempty should delete _on_getok_callback #110. (thank's to @dhontecillas)
- Fixes for pyflakes
- Rework transactions
- Use pika's asyncio adapter
- Rework robust connector
- Ability to disable robustness for single queue in
rubust_connect
mode. - Ability to pass exchage by name.
- Added
python_requires=">3.4.*, <4",
instead ofif sys.version_info
in thesetup.py
- Change
TimeoutError
to theasyncio.TimeoutError
- Allow to bind queue by exchange name
- Added
extras_require = {':python_version': 'typing >= 3.5.3',
to thesetup.py
aio_pika.patterns
submoduleaio_pika.patterns.RPC
- RPC patternaio_pika.patterns.Master
- Master/Worker pattern
passive
argument for excahnge
Channel.is_closed
propertyChannel.close
just returnNone
when channel already closedConnection
might be used inasync with
expressionQueue
might be used inasync with
and returnsQueueIterator
- Changing examples
Queue.iterator()
methodQueueIterator.close()
returnsasyncio.Future
instead ofasyncio.Task
- Ability to use
QueueIterator
inasync for
expression connect_robust
is acoroutine
instead of function which returns a coroutine (PyCharm type checking display warning instead)- add tests
- Improve documentation. Add examples for connection and channel
Conneciton.close
returnsasyncio.Task
instead coroutine.connect_robust
now is function instead ofpartial
.