specific file should not be touched by other scripts, or instances of the same script.
Created for [Europe 1° Warmer](https://www.onedegreewarmer.eu/).
This is module does _not_ implement OS level file locking. For that, see e.g. the built-in [lockfile](https://pythonhosted.org/lockfile/lockfile.html) module, [zc.lockfile](https://pypi.org/project/zc.lockfile/), or other similar projects.
## Installation
```sh
pip install tmplockfile
```
## Usage
```python3
from tmplockfile import LockFile, ResourceLocked
with LockFile("data.csv") as lockfile:
# Do things involving data.csv here
#
# A lock-file is temporarily placed in the same directory,
# in a way that avoids the most obvious race conditions.
# The variable `lockfile` contains the name of the lock-file,
# e.g. `data.csv~lock`.
except ResourceLocked:
print("Another script is currently working on data.csv. Try again later!")
```
## Changelog
- 0.0.3
- Don't crash when no lockfile could be created
Metadata
Release files for tmplockfile 0.0.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 | |
|---|---|---|---|---|
| tmplockfile-0.0.3.tar.gz | 2.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tmplockfile-0.0.3-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 6.4 kB
Release files / tmplockfile-0.0.3.tar.gz
| Download URL | tmplockfile-0.0.3.tar.gz |
|---|---|
| Size | 2.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a9b639ba8f258b975111e7d9f15b0adee3fd72ac4a8b426ef1d225f0182e4e1
|
|
BLAKE2b-256 checksum How to use checksums |
5727e0f74ee56003fc2a8a065bdd51b89562d0494863d7ff752d710086e00763
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
|
Release files / tmplockfile-0.0.3-py2-none-any.whl
| Download URL | tmplockfile-0.0.3-py2-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
12b1d9c00f45734da8c48dd61c3c2f0f7c52bd94c2a973548eb8114ca86739d6
|
|
BLAKE2b-256 checksum How to use checksums |
18bf730b97c35311cea34674a522f42dce8924c0f7c3721bcdd99c32ff0bbc5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
|
Security for tmplockfile 0.0.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.