# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= python-fasteners VERSION= 0.20 KEYWORDS= python VARIANTS= v13 v14 SDESC[v13]= Python package that provides useful locks (3.13) SDESC[v14]= Python package that provides useful locks (3.14) HOMEPAGE= https://github.com/harlowja/fasteners CONTACT= Python_Automaton[python@ironwolf.systems] DOWNLOAD_GROUPS= main SITES[main]= PYPIWHL/51/ac/e5d886f892666d2d1e5cb8c1a41146e1d79ae8896477b1153a21711d3b44 DISTFILE[1]= fasteners-0.20-py3-none-any.whl:main DIST_SUBDIR= python-src DF_INDEX= 1 SPKGS[v13]= single SPKGS[v14]= single OPTIONS_AVAILABLE= PY313 PY314 OPTIONS_STANDARD= none VOPTS[v13]= PY313=ON PY314=OFF VOPTS[v14]= PY313=OFF PY314=ON DISTNAME= fasteners-0.20.dist-info GENERATED= yes [PY313].USES_ON= python:v13,wheel [PY314].USES_ON= python:v14,wheel [FILE:2324:descriptions/desc.single] Fasteners ========= [Documentation status] [Latest version] Cross-platform locks for threads and processes. 🔩 Install ---------- ` pip install fasteners ` 🔩 Usage -------- Lock for processes has the same API as the [threading.Lock] for threads: ```python import fasteners import threading lock = threading.Lock() # for threads lock = fasteners.InterProcessLock('path/to/lock.file') # for processes with lock: ... # exclusive access # or alternatively lock.acquire() ... # exclusive access lock.release() ``` Reader Writer lock has a similar API, which is the same for threads or processes: ```python import fasteners rw_lock = fasteners.ReaderWriterLock() # for threads rw_lock = fasteners.InterProcessReaderWriterLock('path/to/lock.file') # for processes with rw_lock.write_lock(): ... # write access with rw_lock.read_lock(): ... # read access # or alternatively rw_lock.acquire_read_lock() ... # read access rw_lock.release_read_lock() rw_lock.acquire_write_lock() ... # write access rw_lock.release_write_lock() ``` 🔩 Overview ----------- Python standard library provides a lock for threads (both a reentrant one, and a non-reentrant one, see below). Fasteners extends this, and provides a lock for processes, as well as Reader Writer locks for both threads and processes. Definitions of terms used in this overview can be found in the [glossary]. The specifics of the locks are as follows: ### Process locks The `fasteners.InterProcessLock` uses [fcntl] on Unix-like systems and msvc [_locking] on Windows. As a result, if used cross-platform it guarantees an intersection of their features: | lock | reentrant | mandatory | |------|-----------|-----------| | fcntl | ✘ | ✘ | | _locking | ✔ | ✔ | | fasteners.InterProcessLock | ✘ | ✘ | The `fasteners.InterProcessReaderWriterLock` also uses fcntl on Unix-like systems and [LockFileEx] on Windows. Their features are as follows: | lock | reentrant | mandatory | upgradable | preference | |------|-----------|-----------|------------|------------| | fcntl | ✘ | ✘ | ✔ | reader | | LockFileEx | ✔ | ✔ | ✘ | reader | [FILE:121:distinfo] 9422c40d1e350e4259f509fb2e608d6bc43c0136f79a00db1b49046029d0b3b7 18702 python-src/fasteners-0.20-py3-none-any.whl