python-fasteners
Port variant v11
Summary Python package that provides useful locks (3.11)
Package version 0.19
Homepage https://github.com/harlowja/fasteners
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v12
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 11 FEB 2024, 22:37:34 UTC
Port created 11 FEB 2024, 22:37:34 UTC
Subpackage Descriptions
single Fasteners ========= [Documentation status] [Downloads] [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 |
Configuration Switches (platform-specific settings discarded)
PY311 ON Build using Python 3.11 PY312 OFF Build using Python 3.12
Package Dependencies by Type
Build (only) python-pip:single:v11
autoselect-python:single:standard
Build and Runtime python311:single:standard
Download groups
main mirror://PYPIWHL/61/bf/fd60001b3abc5222d8eaa4a204cd8c0ae78e75adc688f33ce4bf25b7fafa
Distribution File Information
758819cb5d94cdedf4e836988b74de396ceacb8e2794d21f82d131fd9ee77237 18679 fasteners-0.19-py3-none-any.whl
Ports that require python-fasteners:v11
No other ports depend on this one.