A simple Python resource lock to ensure only one process at a time is operating with a particular resource.
Singleton Usage
Singleton creates a file containing process information to ensure that the process that created the lock is still alive. The default location is in the .lock directory in the current working directory. If this directory does not exist, singleton will create it automatically.
Simple usage:
from quicklock import singleton
singleton('my-process') # This will ensure that only one of these is running at once
# The lock is released when the process that created the lock
# exits (successfully or quits unexpectedly)
# Intensive processing here
Specifying the lock directory:
from quicklock import singleton
singleton('my-process', dirname='/var/lock') # Now all lock files will be written to
# /var/lock instead
# Intensive processing here
Contributing
Please feel free to create issues and submit pull requests. I want to keep this library as a simple collection of useful locking-related utilities.
License
The license is MIT, see the attached LICENSE file for more information.
Metadata
Release files for quicklock 0.1.7
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 |
|---|---|---|---|---|
| quicklock-0.1.7.tar.gz | 2.0 kB | Without provenance | Details for quicklock-0.1.7.tar.gz |
Release files / quicklock-0.1.7.tar.gz
| Download URL | quicklock-0.1.7.tar.gz |
|---|---|
| Size | 2.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f404efc3115be8f92ab0b5f34b4efda5d5d14c03a567ebe910957826ac4a0897
|
|
BLAKE2b-256 checksum How to use checksums |
79a63094ac123a12cc2dd4873701497de62911b3c2bb0d85c4b3ae74ae687530
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for quicklock 0.1.7
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.