python-dynamodb-lock
Python library that emulates the java-based dynamo-db-client from awslabs
What it is and what it does
Python DynamoDB Lock is a distributed locking library built on DynamoDB that emulates the Java-based AmazonDynamoDBLockClient. It allows multiple processes or services to coordinate access to shared resources by acquiring named locks with configurable retry behavior, maintaining them through periodic heartbeats, and automatically releasing them after a configurable lease duration.
The library supports both coarse-grained and fine-grained locking, stores arbitrary application data alongside locks, and uses monotonically increasing clocks to handle clock skew. It notifies applications via callback if a lock is stolen or nearing expiry. However, the documentation explicitly notes that locks do not participate in distributed transactions—if a heartbeat is delayed beyond the lease duration, another client may acquire the lock while the original holder is still processing, leading to potential data inconsistency if not handled at the application level.
Use it for:
- Coordinate database writes across multiple application instances to ensure only one process modifies a given resource at a time.
- Implement leader election among distributed services using DynamoDB as the coordination backend.
- Prevent concurrent execution of expensive batch jobs or scheduled tasks across a fleet of servers.
- Serialize access to shared state stored in DynamoDB when multiple Lambda functions or microservices need to update it safely.
- Build a distributed job queue where only one worker processes a given job at a time.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides distributed locking on top of DynamoDB with configurable retry semantics, heartbeat-based lease management, and lock-theft detection.
Yes, with conditions. The package solves a real problem—distributed locking on DynamoDB—and has no known vulnerabilities. However, dormant maintenance (no updates since 2018-10-28) and classifiers limited to Python 3.6 and 3.7 raise questions about compatibility with modern Python versions. Verify it works with your target Python and boto3 versions before relying on it in production. The documented limitations around distributed transactions require careful application-level handling.
Install
python-dynamodb-lock on PyPI
pip
pip install python-dynamodb-lockuv
uv add python-dynamodb-lockpoetry
poetry add python-dynamodb-lockInstalling python-dynamodb-lock
Before you install
Low install friction with only boto3 and botocore as runtime dependencies. Maintenance is dormant—last release was 2018-10-28 with no updates since, though the repository remains active.
License in practice
Licensed under Apache Software License 2.0 (permissive), allowing use in most commercial and open-source projects with minimal restrictions.
Quickstart
pip install python-dynamodb-lock
from python_dynamodb_lock import DynamoDBLock
import boto3
dynamodb = boto3.resource('dynamodb')
lock = DynamoDBLock(dynamodb, 'lock-table-name')
lock.acquire('my-lock-name')
Requires an existing DynamoDB table and AWS credentials configured for boto3.
Verify before relying
- Whether the package works reliably with Python versions beyond 3.7, given classifiers list only 3.6 and 3.7.
- Current compatibility with recent boto3 and botocore versions and whether breaking changes have occurred since 2018.
- Whether the lock-theft callback and heartbeat mechanism perform reliably under high-latency or GC-pause conditions.
Package facts
| License | Apache Software License 2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — boto3, botocore |
| Maintenance | dormant — 2,847 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 519,463/month — #6,216 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_dynamodb_lock-0.9.1-py2.py3-none-any.whl
Keywords: python_dynamodb_lock
Tags
More Distributed Computing packages
gRPC Python is an HTTP/2-based RPC framework…
permissive · top 100 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
cloudpickleCloudpickle extends Python's standard pickle…
permissive · top 1,000 on PyPI
smart-openProvides a unified, open()-compatible Python…
permissive · top 1,000 on PyPI
portalockerPortalocker provides cross-platform file…
permissive · top 1,000 on PyPI
rayRay is a distributed computing framework that…
permissive · top 1,000 on PyPI
PyMySQLLockProvides distributed locking primitives backed…
permissive · top 15,000 on PyPI
redlock-pyImplements Redis-based distributed locks using…
permissive · top 15,000 on PyPI
redlockImplements the RedLock algorithm to provide…
permissive · top 15,000 on PyPI
locketLocket provides file-based locks for…
permissive · top 1,000 on PyPI
aiorwlockProvides read-write locks for asyncio programs,…
permissive · top 5,000 on PyPI
python-redis-lockProvides a Redis-backed distributed lock with a…
permissive · top 5,000 on PyPI
kazooKazoo provides a higher-level Python client API…
permissive · top 5,000 on PyPI
dyntasticDyntastic is a DynamoDB object-relational…
permissive · top 15,000 on PyPI
python-etcdA Python client library for etcd, a distributed…
permissive · top 15,000 on PyPI
etcd3Python client library for etcd v3 that provides…
permissive · top 15,000 on PyPI