flufl.lock
NFS-safe file locking with timeouts for POSIX and Windows
Decision gist · record as of 2026-08-14
Yes. This is a mature, actively maintained library with no known vulnerabilities, low install friction, and a permissive license. Install it if you need cross-platform, NFS-safe file locking with timeout support. The main consideration is tuning the lock lifetime correctly for your use case; if you're unsure whether you need NFS safety specifically, a simpler locking mechanism may suffice.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later; lock lifetime must be chosen carefully to balance between process hangs and data corruption risk.
- Low friction installation with only two lightweight runtime dependencies (atpublic, psutil).
- Actively maintained with a recent release; marked Production/Stable and Mature.
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 is permissive; you can use this in commercial and proprietary projects with minimal restrictions beyond attribution and liability disclaimers.
last release 2026-04-27 (109 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 3,168,832 downloads/mo, #2,718 on PyPI
Alternatives
Verify before relying
from flufl.lock import Lock
lock = Lock('/tmp/mylock')
with lock:
# critical section
pass- Whether clock synchronization requirements are critical in practice for typical use cases outside distributed NFS environments.
- Performance characteristics under high contention or with very short lock lifetimes.
What it is and what it does
flufl.lock is a file-based locking library that solves the race-condition problem inherent in NFS file systems by using an atomic link-based algorithm inspired by the O_EXCL flag behavior. Instead of relying on exclusive file creation (which is broken on NFS), it creates a unique temporary file and uses the link(2) system call to atomically establish the lock—a technique that works correctly across network file systems and local filesystems alike.
The library is designed for distributed and multi-process environments where you need to coordinate access to shared resources. It supports lock breaking with configurable timeouts, allowing other processes to forcibly acquire a lock if the holder exceeds its declared lifetime. This prevents permanent deadlocks but requires careful tuning: set the lifetime too long and processes will hang waiting; too short and you risk trampling on active locks and corrupting data. It runs on POSIX systems (Linux, macOS) and Windows, making it suitable for cross-platform applications that must coordinate file access.
Use it for
- Serialize access to shared configuration or data files in a distributed system where multiple hosts mount the same NFS volume.
- Prevent concurrent writes to a shared database or log file in a multi-process web application or job queue.
- Implement a distributed task lock so only one worker process executes a critical operation across a cluster.
- Protect against race conditions in CI/CD pipelines or build systems that run on shared network storage.
- Coordinate resource access in containerized or Kubernetes environments where pods may share persistent volumes.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is a mature, actively maintained library with no known vulnerabilities, low install friction, and a permissive license. Install it if you need cross-platform, NFS-safe file locking with timeout support. The main consideration is tuning the lock lifetime correctly for your use case; if you're unsure whether you need NFS safety specifically, a simpler locking mechanism may suffice.
Install
flufl-lock on PyPI
Before you install
Low friction installation with only two lightweight runtime dependencies (atpublic, psutil). Actively maintained with a recent release; marked Production/Stable and Mature.
Requires Python 3.10 or later; lock lifetime must be chosen carefully to balance between process hangs and data corruption risk.
License in practice
Apache-2.0 is permissive; you can use this in commercial and proprietary projects with minimal restrictions beyond attribution and liability disclaimers.
Quickstart
from flufl.lock import Lock
lock = Lock('/tmp/mylock')
with lock:
# critical section
pass
Verify before relying
- Whether clock synchronization requirements are critical in practice for typical use cases outside distributed NFS environments.
- Performance characteristics under high contention or with very short lock lifetimes.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesatpublicpsutil |
| Maintenance | Actively maintained 109 days since the last release |
| First released | |
| Downloads | 3,168,832 / month, #2,718 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableDevelopment Status :: 6 - MatureIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: PythonProgramming Language :: Python :: 3Topic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules |
Evidence: flufl_lock-9.1.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “NFS-safe file locking”
- flufl.lockProvides NFS-safe file locking with timeout support across POSIX and…
- lockfileProvides a platform-independent file locking API that works…
- filelockProvides a platform-independent file locking mechanism to coordinate…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also zc.lockfile · portalocker · lockfile · filelock · locket · redlock · fasteners · flufl.bounce · oslo.concurrency · aiorwlock