--- id: locket version: "1.0.0" license: BSD-2-Clause license_treatment: permissive maintenance: abandoned --- # locket — File-based locks for Python on Linux and Windows License: permissive · Maintenance: abandoned · Popularity: top 1,000 on PyPI ## Install pip install locket uv add locket poetry add locket ## Description locket.py: File-based locks for Python on Linux and Windows =========================================================== Locket implements a file-based lock that can be used by multiple processes provided they use the same path. .. code-block:: python import locket # Wait for lock with locket.lock_file("path/to/lock/file"): perform_action() # Raise LockError if lock cannot be acquired immediately with locket.lock_file("path/to/lock/file", timeout=0): perform_action() # Raise LockError if lock cannot be acquired after thirty seconds with locket.lock_file("path/to/lock/file", timeout=30): perform_action() # Without context managers: lock = locket.lock_file("path/to/lock/file") try: lock.acquire() perform_action() finally: lock.release() Locks largely behave as (non-reentrant) ``Lock`` instances from the ``threading`` module in the standard library. Specifically, their behaviour is: * Locks are uniquely identified by the file being locked, both in the same process and across different processes. * Locks are either in a locked or unlocked state. * When the lock is unlocked,... ## AI interpretation — verify before relying Locket provides file-based locks for inter-process synchronization on Linux and Windows, allowing multiple processes to coordinate access to shared resources using a common lock file path. Verdict: Locket is a lightweight, dependency-free file-locking utility suitable for simple inter-process coordination scenarios. Its permissive license and broad Python version support (2.7 through 3.10) make it accessible, but the abandoned maintenance status—no releases since April 2022—means it will not receive bug fixes or security updates. Use only if your locking needs are stable and unlikely to require future maintenance. [View on SkillFed](https://skillfed.io/packages/locket) · [View on PyPI](https://pypi.org/project/locket/)