Lock script to allow only one instance
Project description
python-scriptlock
==========================
[![Build Status](https://travis-ci.org/alkivi-sas/python-scriptlock.svg?branch=master)](https://travis-ci.org/alkivi-sas/python-scriptlock)
[![Requirements Status](https://requires.io/github/alkivi-sas/python-scriptlock/requirements.svg?branch=master)](https://requires.io/github/alkivi-sas/python-scriptlock/requirements/?branch=master)
Lock tool for scripts.
## Package
Example
```python
import time
import atexit
from scriptlock import Lock
lock = Lock()
atexit.register(lock.cleanup) # Needed to clean the lock correctly
time.sleep(100)
```
Launch another one and see what happend
## Workaround
The use of atexit is necessary to correctly clean the lock.
We tried to use the __del__ module but it caused issues with the
logger.
## Tests
Testing is set up using [pytest](http://pytest.org) and coverage is handled
with the pytest-cov plugin.
Run your tests with ```py.test``` in the root directory.
Coverage is ran by default and is set in the ```pytest.ini``` file.
To see an html output of coverage open ```htmlcov/index.html``` after running the tests.
TODO
## Travis CI
There is a ```.travis.yml``` file that is set up to run your tests for python 2.7
and python 3.2, should you choose to use it.
TODO
==========================
[![Build Status](https://travis-ci.org/alkivi-sas/python-scriptlock.svg?branch=master)](https://travis-ci.org/alkivi-sas/python-scriptlock)
[![Requirements Status](https://requires.io/github/alkivi-sas/python-scriptlock/requirements.svg?branch=master)](https://requires.io/github/alkivi-sas/python-scriptlock/requirements/?branch=master)
Lock tool for scripts.
## Package
Example
```python
import time
import atexit
from scriptlock import Lock
lock = Lock()
atexit.register(lock.cleanup) # Needed to clean the lock correctly
time.sleep(100)
```
Launch another one and see what happend
## Workaround
The use of atexit is necessary to correctly clean the lock.
We tried to use the __del__ module but it caused issues with the
logger.
## Tests
Testing is set up using [pytest](http://pytest.org) and coverage is handled
with the pytest-cov plugin.
Run your tests with ```py.test``` in the root directory.
Coverage is ran by default and is set in the ```pytest.ini``` file.
To see an html output of coverage open ```htmlcov/index.html``` after running the tests.
TODO
## Travis CI
There is a ```.travis.yml``` file that is set up to run your tests for python 2.7
and python 3.2, should you choose to use it.
TODO
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
scriptlock-1.0.3.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for scriptlock-1.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc3ad36b5d00d14f5106f91e0ba4840da8d32621bf592a626c048a595f0a3aa2 |
|
MD5 | 3b284a3b09729cb697c64792b2a9e6bf |
|
BLAKE2b-256 | f5c2c5ad4b922c306e4e50b078d06ad08005103d0e7fbce4db3155aef6658975 |