filelock
A platform independent file lock.
Decision gist · record as of 2026-08-14
Yes. filelock is a stable, actively maintained library with zero dependencies, a permissive MIT license, and no known vulnerabilities. It solves a real synchronization problem in a portable way and is appropriate for any Python project that needs cross-process file coordination.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Actively maintained with a recent release; no runtime dependencies and a pure-Python wheel distribution make installation straightforward.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects.
last release 2026-08-13 (1 days) · last repo commit 2026-08-13 · 975 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 717,124,668 downloads/mo, #43 on PyPI
Alternatives
Verify before relying
from filelock import FileLock
with FileLock('myfile.lock'):
# Critical section protected by lock
pass- Specific locking strategies (e.g., advisory vs. mandatory, soft vs. hard locks) and their platform-specific behavior.
- Performance characteristics under high contention or with many concurrent lock holders.
- Timeout and deadlock-handling semantics when locks cannot be acquired.
What it is and what it does
filelock is a lightweight library that provides a cross-platform file locking primitive for Python. It allows multiple processes or threads to safely coordinate access to shared files by acquiring and releasing locks, preventing race conditions and data corruption when concurrent code needs to read or write the same file.
The library abstracts away platform differences—using OS-native locking on Windows and Unix-like systems—so you can write portable synchronization code without worrying about the underlying implementation. It is commonly used in applications that manage caches, logs, temporary directories, or other shared resources where multiple processes might contend for access.
Use it for
- Protecting shared cache files from concurrent writes by multiple processes.
- Coordinating log file access when multiple application instances write simultaneously.
- Ensuring atomic updates to configuration or state files in multi-process applications.
- Preventing race conditions in temporary directory cleanup or resource allocation.
- Synchronizing access to user-level data directories across independent scripts or services.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
filelock is a stable, actively maintained library with zero dependencies, a permissive MIT license, and no known vulnerabilities. It solves a real synchronization problem in a portable way and is appropriate for any Python project that needs cross-process file coordination.
Install
filelock on PyPI
Before you install
Actively maintained with a recent release; no runtime dependencies and a pure-Python wheel distribution make installation straightforward.
Requires Python 3.10 or later.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects.
Quickstart
from filelock import FileLock
with FileLock('myfile.lock'):
# Critical section protected by lock
pass
Verify before relying
- Specific locking strategies (e.g., advisory vs. mandatory, soft vs. hard locks) and their platform-specific behavior.
- Performance characteristics under high contention or with many concurrent lock holders.
- Timeout and deadlock-handling semantics when locks cannot be acquired.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 1 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 717,124,668 / month, #43 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/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Topic :: InternetTopic :: Software Development :: LibrariesTopic :: System |
Evidence: filelock-3.32.3-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 › “concurrent file access”
- filelockProvides a platform-independent file locking mechanism to coordinate…
- zc.lockfileProvides portable inter-process locks implemented using lock files…
- aiopathAsync-compatible reimplementation of Python's pathlib with awaitable…
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 lockfile · pyodide-lock · wakepy · locket · fasteners · fastrlock · portalocker · django-concurrency · flufl.lock · zc.lockfile