skillfed

locket

File-based locks for Python on Linux and Windows

locket Permissive license BSD-2-Clause Abandoned 26 v1.0.0 released

Install

locket on PyPI

pip

pip install locket

uv

uv add locket

poetry

poetry add locket

Package facts

License BSD-2-Clause (permissive)
Python support supports the current Python release (>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 1,576 days since the last release
Last repo commit
First released
Popularity one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13)
Known vulnerabilities none known (OSV.dev, checked 2026-08-13)

Evidence: locket-1.0.0-py2.py3-none-any.whl

Keywords: lock, filelock, lockfile, process

Intended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: Microsoft :: WindowsOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

About locket

from the package's own PyPI description — quoted content, verbatim

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,...

Read as markdown · JSON record · Source repository · Homepage

AI interpretation — verify before relying

AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page

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.

Installation is straightforward with no runtime dependencies. However, the package is marked abandoned with its last commit in February 2023 and no release for over two years, raising concerns about maintenance and responsiveness to issues.

BSD-2-Clause is a permissive open-source license that allows commercial and private use with minimal restrictions, requiring only preservation of copyright and license notices.

Usage

pip install locket

import locket

with locket.lock_file("/path/to/lock"):
    # critical section
    pass

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.

Needs verification

  • Whether the package has known issues or edge cases that emerged after the last release in 2022
  • Whether fork behavior (documented as undefined) causes problems in real-world concurrent scenarios
  • Whether there are more actively maintained alternatives with similar functionality
file-based locks pythoninter-process lockingfilelock cross-processprocess synchronizationdistributed lock filemultiprocess coordination

Similar packages