Metadata-Version: 2.1
Name: dynalock
Version: 0.3.0
Summary: Distributed locking with DynamoDB
Home-page: https://github.com/skywalker427/dynalock
Author: Hamzah Bawah
Author-email: bhamza123@gmail.com
License: MIT license
Keywords: dynalock
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Python: >=3.6
Description-Content-Type: text/x-rst
License-File: LICENSE
License-File: AUTHORS.rst
Requires-Dist: boto3>=1.34.74
Requires-Dist: botocore>=1.34.74

.. figure:: ./DynaLockLogo.png
    :alt: DynaLock 
    :align: center


.. image:: https://img.shields.io/pypi/v/dynalock.svg
        :target: https://pypi.python.org/pypi/dynalock


.. image:: https://readthedocs.org/projects/dynalock/badge/?version=latest
        :target: https://dynalock.readthedocs.io/en/latest/?version=latest
        :alt: Documentation Status




Distributed locking implementation in python with DynamoDB

Getting Started
----------------
To install DynaLock, simply use pip:

.. code-block:: bash

    $ pip install dynalock


DynaLock utilizes Python's context manager making it easier and safer to manage locks. 
When used in a `with` statement, DynaLock automatically acquires the lock at the beginning of the block and releases it upon exiting, regardless of whether the block exits normally or with an exception. 
This eliminates the need for explicit release calls, reducing the boilerplate code and minimizing the risk of errors.

**Example Usage:**

.. code-block:: python

    from dynalock import DynaLock

    # Initialize a distributed lock
    distributed_lock = DynaLock(
        table_name='my_lock_table',
        region_name='us-west-2',
        lock_id='api_lock',
    )

    # Use the lock with a context manager
    with distributed_lock.lock():
        # Protected code goes here
        # The lock is automatically managed
        print("This code is protected by the lock")
        print("Critical section executed")
    
    # The lock is automatically released after exiting the block
    print("This code is not protected by the lock")



* Free software: MIT license
* Full Documentation: https://dynalock.readthedocs.io.






=======
History
=======

0.1.0 (2024-03-30)
------------------

* First release on PyPI.
