# natspy-lock
[![PyPI - Version](https://img.shields.io/pypi/v/natspy-lock.svg)](https://pypi.org/project/natspy-lock)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/natspy-lock.svg)](https://pypi.org/project/natspy-lock)
-----
`natspy-lock` is a distributed lock library using nats.
**Table of Contents**
- [Installation](#installation)
- [Example](#example)
- [License](#license)
## Installation
```console
pip install natspy-lock
```
## Example
```python
import nats
from natspy_lock import NatsLock
async def main():
nc = await nats.connect("nats://127.0.0.1:4222")
await NatsLock.init(nc.jetstream(), "test_lock", 60)
async with NatsLock.get_lock("test_lock", 1):
# do something
pass
await nc.drain()
```
## License
`natspy-lock` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
Raw data
{
"_id": null,
"home_page": null,
"name": "natspy-lock",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "Distributed lock,nats.py,python lock",
"author": null,
"author_email": "Seungwoo Hong <qksn1541@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/69/0b/314048ae2bf6fbcec2e3c857ea4b01322d393501a2dac1524207a4b0a14d/natspy_lock-0.2.0.tar.gz",
"platform": null,
"description": "# natspy-lock\n\n[![PyPI - Version](https://img.shields.io/pypi/v/natspy-lock.svg)](https://pypi.org/project/natspy-lock)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/natspy-lock.svg)](https://pypi.org/project/natspy-lock)\n\n-----\n\n`natspy-lock` is a distributed lock library using nats.\n\n**Table of Contents**\n\n- [Installation](#installation)\n- [Example](#example)\n- [License](#license)\n\n\n## Installation\n\n```console\npip install natspy-lock\n```\n\n## Example\n\n```python\nimport nats\nfrom natspy_lock import NatsLock\n\nasync def main():\n nc = await nats.connect(\"nats://127.0.0.1:4222\")\n await NatsLock.init(nc.jetstream(), \"test_lock\", 60)\n async with NatsLock.get_lock(\"test_lock\", 1):\n # do something\n pass\n await nc.drain()\n```\n\n## License\n\n`natspy-lock` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\n",
"bugtrack_url": null,
"license": null,
"summary": "Distributed lock library using nats.py",
"version": "0.2.0",
"project_urls": {
"Documentation": "https://github.com/HHongSeungWoo/natspy-lock#readme",
"Issues": "https://github.com/HHongSeungWoo/natspy-lock/issues",
"Source": "https://github.com/HHongSeungWoo/natspy-lock"
},
"split_keywords": [
"distributed lock",
"nats.py",
"python lock"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "785c7b67289e6da228cd0ae7d8547365f3e92168047a900a1c912e95ac5387c6",
"md5": "7ac40a581b102712b0c99907a298b5d5",
"sha256": "0ae065595e4a6945990fca6454e00ac6a73370aa51629c8313f21a65114b6bbf"
},
"downloads": -1,
"filename": "natspy_lock-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7ac40a581b102712b0c99907a298b5d5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 3833,
"upload_time": "2023-12-09T05:16:57",
"upload_time_iso_8601": "2023-12-09T05:16:57.996018Z",
"url": "https://files.pythonhosted.org/packages/78/5c/7b67289e6da228cd0ae7d8547365f3e92168047a900a1c912e95ac5387c6/natspy_lock-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "690b314048ae2bf6fbcec2e3c857ea4b01322d393501a2dac1524207a4b0a14d",
"md5": "862277f5bb86ea8cab8cdb2f2f0c86f3",
"sha256": "b270bee8722865a0bb07fae149cd6b257daefa3bf5f0d69bcf9fb1d1b8343e4d"
},
"downloads": -1,
"filename": "natspy_lock-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "862277f5bb86ea8cab8cdb2f2f0c86f3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 6721,
"upload_time": "2023-12-09T05:16:59",
"upload_time_iso_8601": "2023-12-09T05:16:59.885306Z",
"url": "https://files.pythonhosted.org/packages/69/0b/314048ae2bf6fbcec2e3c857ea4b01322d393501a2dac1524207a4b0a14d/natspy_lock-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-09 05:16:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "HHongSeungWoo",
"github_project": "natspy-lock#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "natspy-lock"
}