skillfed

aioredlock

Asyncio implemetation of Redis distributed locks

aioredlock v0.7.3 103.4K downloads/30d#12,810 on PyPI317
Permissive license MIT DORMANT released

What it is and what it does

Aioredlock is an asyncio-compatible implementation of the Redlock distributed locking algorithm for Redis. It allows async Python applications to safely coordinate access to shared resources across multiple Redis instances, ensuring that only one client holds a lock at a time even in the presence of network partitions or clock skew.

The package provides a lock manager that can acquire, extend, and release locks with configurable timeouts and retry behavior. It supports multiple Redis connection types (tuples, dicts, URIs, and Sentinel), and locks can be used directly or as async context managers. The implementation requires at least half of the configured Redis instances to agree on lock state for operations to succeed, following the Redlock consensus model.

Use it for:

  • Coordinate task execution across multiple async workers to prevent duplicate processing of the same job.
  • Protect shared resource updates in a distributed system where multiple services need exclusive access.
  • Implement leader election or distributed consensus primitives in microservices architectures.
  • Prevent concurrent writes to a shared data store when using multiple async application instances.
  • Gate access to rate-limited external APIs or services from multiple concurrent async clients.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Implements the Redlock distributed lock algorithm for asyncio, enabling safe resource coordination across multiple Redis instances in async Python applications.

Yes, but with caution. The package is stable and production-ready (MIT license, no known vulnerabilities, low install friction), but it has been dormant since February 2022. Install it if you need Redlock for asyncio and can accept that no active maintenance is happening; verify that aioredis itself is still viable for your target Python and Redis versions before committing.

Install

aioredlock on PyPI

pip

pip install aioredlock

uv

uv add aioredlock

poetry

poetry add aioredlock

Installing aioredlock

Before you install

Low friction install with just two runtime dependencies (aioredis and attrs). Package is dormant—last release was 2022-02-08, over 1648 days ago—so expect no active maintenance or updates.

License in practice

MIT license (permissive) means you can use, modify, and distribute this package freely with minimal restrictions, though you must include the license notice.

Quickstart

pip install aioredlock

from aioredlock import Aioredlock, LockError

lock_manager = Aioredlock([('localhost', 6379)])
lock = await lock_manager.lock('resource_name', lock_timeout=10)
await lock_manager.unlock(lock)
await lock_manager.destroy()

Requires a running Redis instance; aioredis must be able to connect to at least one Redis server for lock operations to succeed.

Verify before relying

  • Whether aioredis dependency is compatible with modern Python 3.9+ async patterns and current Redis versions.
  • Whether the package works reliably with Redis Cluster or only standalone/Sentinel deployments.
  • Current state of aioredis itself—if it is also dormant or deprecated, aioredlock's viability is further limited.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 2 — aioredis, attrs
Maintenance dormant — 1,648 days since the last release
Last repo commit
First released
Downloads 103,363/month — #12,810 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: aioredlock-0.7.3-py3-none-any.whl

Keywords: redis, redlock, distributed, locks, asyncio

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Tags

redis distributed locks asyncioredlock algorithm python asyncmulti-redis lock managerasyncio redis lockingdistributed lock redisasync resource coordination
redisdistributed-locksasyncio

More Python Modules packages