aioredlock
Asyncio implemetation of Redis distributed locks
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 aioredlockuv
uv add aioredlockpoetry
poetry add aioredlockInstalling 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
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
coredisAn async Redis client with full type hints,…
permissive · top 5,000 on PyPI
redlockImplements the RedLock algorithm to provide…
permissive · top 15,000 on PyPI
redlock-pyImplements Redis-based distributed locks using…
permissive · top 15,000 on PyPI
kazooKazoo provides a higher-level Python client API…
permissive · top 5,000 on PyPI
python-redis-lockProvides a Redis-backed distributed lock with a…
permissive · top 5,000 on PyPI
potteryPottery provides Python dict, set, list, deque,…
unclear · top 15,000 on PyPI
celery_oncePrevents duplicate execution and queuing of…
permissive · top 15,000 on PyPI
aioredisAn asyncio-based Redis client library providing…
permissive · top 5,000 on PyPI
portalockerPortalocker provides cross-platform file…
permissive · top 1,000 on PyPI
aiorwlockProvides read-write locks for asyncio programs,…
permissive · top 5,000 on PyPI