File-based lock preventing concurrent runs of the same process
Project description
lockfile
File-based lock (via fcntl.flock) preventing concurrent runs of the same process —
atomic across forked processes, unlike thread-level locks and semaphores.
Installation
pip install entirius-py-lockfile
Usage
from lockfile import LockFile
lock = LockFile("/var/run/my-job.lock")
lock.acquire() # raises if already held (non-blocking by default)
try:
... # critical section
finally:
lock.release()
Pass wait_for_acquire=True to block until the lock is available instead of raising.
Development
make install # sync dependencies (uv)
make check # lint + format check (ruff)
make test # test suite (pytest)
Development and agent instructions: AGENTS.md.
License
Mozilla Public License 2.0 — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file entirius_py_lockfile-2.0.0.tar.gz.
File metadata
- Download URL: entirius_py_lockfile-2.0.0.tar.gz
- Upload date:
- Size: 21.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38b475f0ee1477eeee418b2f3044d5a167e383db39f880ce8402d83df2b77976
|
|
| MD5 |
2e16f70227925a9fd7c416aa05d4c0d9
|
|
| BLAKE2b-256 |
6b8b2a1595aad5ac15f0924ccb75845d54d99ec4c3f4ec428aff46b40b74ff29
|
File details
Details for the file entirius_py_lockfile-2.0.0-py3-none-any.whl.
File metadata
- Download URL: entirius_py_lockfile-2.0.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
325a72d5bb2d324c874af420bb071747b25f0ca9d75301d8e27e15274fef52a4
|
|
| MD5 |
5c3f9c4681e8e2019e9edf266822f397
|
|
| BLAKE2b-256 |
aa7536d5f1e28811df95e7dc2365c6cc1d712ea7c4685dcb131c2e52c50543fd
|