ezlock
Super simple file-based locking:
# first.py
from ezlock import Lock
import time
with Lock():
print("I got the lock and I'm keeping it for 20s")
time.sleep(20)
and
# second.py
...
with Lock():
print("Trying to get a lock too")
running
>>> python3 first.py &
I got the lock and I'm keeping it for 20s
>>> echo "before 20s"
before 20s
>>> python3 second.py
locking.LockError: Attempted to acquire on already locked lock!
Lock files have an owner. A lock can check if it owns a file with lock.mine. Locks will only release a lock that's not theirs if it's forced i.e. lock.release(force=True).
You can wait for a lock to be released with Lock.wait()
Metadata
Release files for ezlock 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ezlock-0.1.3.tar.gz | 3.1 kB | Without provenance | Details for ezlock-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ezlock-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for ezlock-0.1.3-py3-none-any.whl |
Total release size: 8.8 kB
Release files / ezlock-0.1.3.tar.gz
| Download URL | ezlock-0.1.3.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e5cc004a47ce580f3b931a803dce5278dbb025f3f9fe5f816d65e29e32b6edbc
|
|
BLAKE2b-256 checksum How to use checksums |
c0fc64634815fce2f6d7342f02565cf31cbb6494a3d5c7fa600c547b9cc9c99b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.11 CPython/3.7.3 Windows/10
|
Release files / ezlock-0.1.3-py3-none-any.whl
| Download URL | ezlock-0.1.3-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a6692ed22c0d086b2b248102a76345dc16e2873299cb103b1980e550ab5fca15
|
|
BLAKE2b-256 checksum How to use checksums |
a61c73bca07af468e6c00790e6de831988a6099c99410cc51d26353289de3f27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.11 CPython/3.7.3 Windows/10
|
Security for ezlock 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.