flockfile
Just a simple python lock file class using file locks.
Installation
pip install flockfile
Usage
from flockfile import FlockFile, FileNotLocked
# init the class using a file name
# optionally, the directory can be set to something other than /tmp
lock = FlockFile("myscriptname", lock_dir="/tmp")
# lock the file
lock.lock()
# if this is unsuccessful, exception FileNotLocked will be raised.
# the following class method can be used to check lock status
assert lock.check_lock()
# unlock and delete file
lock.unlock()
FlockFile can also be used as a context manager. The lock is acquired on entry
(raising FileNotLocked if it cannot be obtained) and released on exit:
from flockfile import FlockFile
with FlockFile("myscriptname", lock_dir="/tmp"):
# the lock is held here
...
# the lock is released and the file deleted here
Questions or Issues?
Please report as a Gitlab issue: https://gitlab.com/rveach/flockfile/issues
A note on the use of AI
This library was initally created by hand and uploaded to PyPI in 2019. A lot has changed, so I've used AI to add a context manager and modernize the toolset. All commits using AI have been tagged as such.
Metadata
Release files for flockfile 0.2.5
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 |
|---|---|---|---|---|
| flockfile-0.2.5.tar.gz | 35.3 kB | With provenance | Details for flockfile-0.2.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flockfile-0.2.5-py3-none-any.whl | Python 3 | none | any | Details for flockfile-0.2.5-py3-none-any.whl |
Total release size: 39.6 kB
Release files / flockfile-0.2.5.tar.gz
| Download URL | flockfile-0.2.5.tar.gz |
|---|---|
| Size | 35.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc4bf58020aa8c6da3dc0ceb8bd7937d99b0382f38b571a23edfcae0a5d10325
|
|
BLAKE2b-256 checksum How to use checksums |
03d691e8ca451ff9569c841602815a819a6965dec2cafb1dc4fd9109213c3464
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitLab CI/CD, verified by PyPI on Nov 6, 2026.
Transparency logRelease files / flockfile-0.2.5-py3-none-any.whl
| Download URL | flockfile-0.2.5-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
70b55a1d996a85ff36dfcd52d605081b6c89a511476a7a28fd304d844a61fb37
|
|
BLAKE2b-256 checksum How to use checksums |
b57d1fee27b92af389700b31ea507eeb7f46172e9aadd8024706855f594937ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitLab CI/CD, verified by PyPI on Nov 6, 2026.
Transparency logSecurity for flockfile 0.2.5
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for flockfile-0.2.5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitLab CI/CD, verified by PyPI on Nov 6, 2026.
Transparency logA 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.