Skip to main content

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)

Source distribution for quicklock 0.1.7
File Size Uploaded
quicklock-0.1.7.tar.gz 2.0 kB Details

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

Release history Release notifications | RSS feed

This release

0.1.7 This release

1 release file

0.1.6

1 release file

0.1.5

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page