Skip to content

Version 1.0.0 & aioredis 2.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@HassanAbouelela HassanAbouelela released this 19 Jul 14:31
· 16 commits to main since this release
3c476f7

This version brings support for aioredis 2.0, which is a very large rewrite and breaking change for most projects. This library has changed a bit when it comes to interaction with aioredis, but the API remains mostly the same. Refer to the migration guide below for help on updating your project.

Removed:

  • Connection Pool pattern. aioredis v2 has simiplied a lot of the logic revolving around connections, and it has become very difficult to manage it on a low level. You now only need to use whatever methods you want directly, without worrying about managing the connection pool.
  • RedisSession.pool
  • RedisSession.close & RedisSession.closed (closing sessions is mostly no longer a thing)
  • RedisSessionClosed exception (same reason as above)
  • Namespace locking (as per deprecation timeline) which includes: namespace_lock, namespace_lock_no_warn and NamespaceLock

Changed:

  • RedisSession now takes a mandatory URL parameter. See aioredis.Redis.from_url
  • Operations should now be performed on RedisObject.redis_session.client, which now validates namespace as well
  • RedisTask now takes a RedisTaskQueue instead of just a RedisQueue.

Added

  • RedisSessionNotConnected exception
  • RedisSession.connected (can act as a general replacement for closed, since a session will never be closed once created)
  • Marked support for python 3.10

Migrating

To migrate from 0.2 to 1.0.0, you need to do the following:

  1. Add the URL parameter when initializing the session. Refer to aioredis.Redis.from_url
  2. Remove all usages of namespace locking if they still exist
  3. Implement the changes listed in the above sections. The list is comprehensive and can be used as a checklist.
  4. If you use aioredis directly, follow the migration guide here. Unfortunately, the guide is incomplete. If you are using a static analysis tool, that should help you identify incorrect calls after the update. Here is an (incomplete) list of undocumented API changes which you might find useful:
    • brpoplpush and rpoplpush no longer take sourcekey and destkey, but src and dst
    • hmset_dict has been removed. You can use hset (or hmset, but that's deprecated) with the mapping kwarg instead
    • Exceptions have been rewritten, but are lacking in documentation.
    • Make sure to specify return type encoding on your redis session if you don’t want bytes returned. This only applies to using the client directly, this library’s types have not changed.

If you encounter other undocumented changes, please report them here and upstream. Changes will be added to this changelog.

Full Changelog: v0.2.0...v1.0.0rc1