--- id: redlock version: "1.2.0" license: MIT license_treatment: permissive maintenance: abandoned --- # redlock — Distributed locks with Redis License: permissive · Maintenance: abandoned · Downloads: 160.8K/mo ## What it is and what it does RedLock is a Python implementation of the RedLock distributed locking algorithm, designed to coordinate access to shared resources across multiple independent Redis nodes. Unlike single-master Redis lock libraries, it addresses the race condition that occurs when a Redis master crashes before replicating a lock acquisition to its slave—by requiring a client to acquire the lock on a majority of independent Redis instances, it ensures safety even when individual nodes fail. The package provides a threading.Lock-compatible API with both explicit acquire/release methods and context manager support, making it straightforward to protect critical sections in distributed systems. It also includes a RedLockFactory for efficiently reusing Redis client connections across multiple locks. However, the package has not been maintained since 2015 and targets Python 2 and early Python 3 versions, raising concerns about compatibility with current Python environments. Use it for: - Coordinate exclusive access to a shared resource across multiple application instances running on different machines. - Prevent duplicate job execution in a distributed task queue or scheduler when multiple workers might pick up the same task. - Protect critical sections in microservices that need to ensure only one service instance performs a time-sensitive operation at a time. - Implement distributed mutual exclusion for database migrations or schema updates across a cluster without requiring a central lock server. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Implements the RedLock algorithm to provide distributed locks across multiple independent Redis nodes, preventing single-point-of-failure issues that arise with single-master Redis lock implementations. No. While the package implements a sound algorithm and has no known vulnerabilities, it is abandoned (last release 2015-12-21) and targets Python 2 and Python 3.2–3.4. Compatibility with modern Python versions is unverified, and the lack of maintenance means bugs or security issues discovered in the future will not be addressed. For new projects, consider actively maintained alternatives or a more recent RedLock implementation. ## Install pip install redlock uv add redlock poetry add redlock ## Installing redlock Before you install: Low friction to install. However, the package is abandoned—last release was 2015-12-21 and last commit 2020-05-30. It targets Python 2 and early Python 3 versions (up to 3.4), so compatibility with modern Python environments is uncertain. License in practice: MIT license is permissive and imposes no restrictions on use, modification, or redistribution in proprietary or open-source projects. Quickstart: from redlock import RedLock with RedLock("my_lock"): # Critical section protected by distributed lock pass Requires one or more Redis servers to be running and accessible; by default connects to 127.0.0.1:6379. Multiple independent Redis masters (not replicated) are needed for the algorithm to provide safety guarantees. Verify before relying: - Whether the package works reliably with modern Python versions (3.8+) despite targeting only up to 3.4 - Current state of the GitHub repository and whether it accepts pull requests or has been superseded - Whether redis-py dependency is implicitly required and what version constraints apply ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 160.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags distributed locks redis, redlock algorithm python, multi-node redis locking, redis distributed synchronization, high-availability redis locks, anti-race-condition redis, redis master failover locks, distributed-locking, redis, abandoned [View on SkillFed](https://skillfed.io/packages/redlock) · [View on PyPI](https://pypi.org/project/redlock/)