--- id: fasteners version: "0.20" license: Apache-2.0 license_treatment: permissive maintenance: aging --- # fasteners — A python package that provides useful locks License: permissive · Maintenance: aging · Downloads: 15.5M/mo ## What it is and what it does Fasteners extends Python's standard threading locks to cover inter-process synchronization and reader-writer lock patterns. It provides InterProcessLock for exclusive file-based locking across processes (using fcntl on Unix and _locking on Windows), InterProcessReaderWriterLock for multi-reader/single-writer patterns across processes, and ReaderWriterLock for the same pattern within a single process. All locks expose a context-manager interface compatible with threading.Lock, making them drop-in replacements for simple use cases. The package has been stable since its first release in 2015 and supports current Python versions (3.10 through 3.13, plus PyPy). It has no external runtime dependencies, making installation and deployment straightforward. The implementation trades some features (reentrancy, lock upgrading) for cross-platform compatibility, guaranteeing only the intersection of Unix fcntl and Windows file-locking semantics. Use it for: - Coordinate exclusive file access between multiple Python processes without a separate lock server. - Implement reader-writer patterns where many processes read concurrently but writes must be exclusive. - Protect shared resources in multi-threaded applications using the same API as standard threading.Lock. - Ensure safe concurrent access to files or resources in cross-platform applications (Linux, macOS, Windows). - Add process-level synchronization to existing code that already uses threading.Lock without major refactoring. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides cross-platform locks for synchronizing access between threads and processes, with both exclusive and reader-writer lock variants matching the threading.Lock API. Yes. Fasteners is a stable, dependency-free solution for a common problem (cross-process locking) with no known vulnerabilities. The aging maintenance status is not a concern for a mature, narrowly-scoped library. Install it if you need inter-process locks or reader-writer patterns; the low friction and permissive license make it a safe choice. ## Install pip install fasteners uv add fasteners poetry add fasteners ## Installing fasteners Before you install: Low friction—pure Python wheel with no runtime dependencies. Maintenance is aging (last release 368 days ago, last commit 2025-09-09), but the repository is active and not archived; suitable for stable, mature use cases where frequent updates are not expected. License in practice: Apache-2.0 (permissive) allows commercial and private use with minimal restrictions; safe for most projects. Quickstart: pip install fasteners import fasteners lock = fasteners.InterProcessLock('path/to/lock.file') with lock: pass # exclusive access Verify before relying: - Whether ReaderWriterLock works correctly with eventlet or other non-standard threading implementations without custom thread identification functions. - Performance characteristics under high contention or with many concurrent readers/writers. ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 15.5M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags process locking, inter-process lock, reader writer lock, thread synchronization, cross-platform locks, file-based locking, concurrent access control, concurrency, synchronization, ipc [View on SkillFed](https://skillfed.io/packages/fasteners) · [View on PyPI](https://pypi.org/project/fasteners/)