--- id: django-pglocks version: "2.1.0" license: MIT license_treatment: permissive maintenance: active --- # django-pglocks — DEPRECATED — consolidated into django-pgware. Context managers for PostgreSQL advisory locks in Django. License: permissive · Maintenance: active · Downloads: 130.3K/mo ## What it is and what it does django-pglocks wraps PostgreSQL advisory locks as Django context managers, allowing you to protect critical sections of code from concurrent access using database-level locking. It was originally designed to serialize operations across multiple application instances without explicit distributed locking infrastructure. As of version 2.1.0, this package is deprecated and serves only as a compatibility shim. Its functionality has been consolidated into django-pgware, which provides the same advisory_lock and async_advisory_lock exports under a different import path. The package will not receive further updates; it exists only to ease migration for existing users. Use it for: - Migrate legacy code from django-pglocks to django-pgware by installing 2.1.0 as an intermediate step and addressing deprecation warnings. - Protect critical database operations from concurrent execution across multiple Django application instances using PostgreSQL locks. - Serialize access to shared resources (e.g., file uploads, report generation) without deploying a separate distributed lock service. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides PostgreSQL advisory locks for Django applications through context managers; deprecated and replaced by django-pgware. No. This package is deprecated and explicitly directs users to django-pgware. Install django-pgware directly instead. If you have existing code using django-pglocks, version 2.1.0 can serve as a temporary bridge to ease migration, but it should not be the final destination—update your imports to use django-pgware's django_pg_utils module. ## Install pip install django-pglocks uv add django-pglocks poetry add django-pglocks ## Installing django-pglocks Before you install: Low friction to install, but the package is explicitly deprecated and no longer maintained. Version 2.1.0 is a final compatibility shim that re-exports from django-pgware with deprecation warnings; new projects should use django-pgware directly. License in practice: MIT license permits commercial and private use with minimal restrictions, making it suitable for most projects—though this is moot given the package's deprecated status. Quickstart: pip install django-pglocks from django_pglocks import advisory_lock with advisory_lock('my_lock_name'): # Critical section protected by PostgreSQL advisory lock pass Requires Django and PostgreSQL; Python 3.10 or later. Verify before relying: - Whether existing code using django-pglocks will continue to work without modification after the deprecation period ends. - Performance characteristics of advisory locks under high concurrency in the underlying django-pgware implementation. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 130.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags postgresql advisory locks django, postgres lock context manager, django database locking, postgresql concurrent access control, django pgware migration, deprecated, postgresql-locks, migration-shim [View on SkillFed](https://skillfed.io/packages/django-pglocks) · [View on PyPI](https://pypi.org/project/django-pglocks/)