This release is a pre-release and may not be stable for production use.
pg-dlock
PostgreSQL advisory-lock based distributed lock, sync + async.
from pg_dlock import Locker
with Locker("postgres://...") as locker:
with locker.lock("my-key"):
... # critical section
Async:
from pg_dlock import AsyncLocker
async with AsyncLocker("postgres://...") as locker:
async with locker.lock("my-key"):
...
API
Locker(conninfo, *, pool_min_size=0, pool_max_size=10)locker.lock(key, *, scope="session"|"transaction", shared=False) -> Locklock.acquire(blocking=True, timeout=-1) -> boolblocking=True, timeout=-1: block foreverblocking=False: non-blockingblocking=True, timeout>=0(seconds): wait up to N seconds (usesstatement_timeout)
lock.release()- Context manager support (
with lock:/async with lock:).
Scopes
session: each lock opens its own dedicated connection (autocommit). Released viapg_advisory_unlock.transaction: connection is checked out from an internal pool and a transaction is begun; lock is released by the commit/rollback on exit.
Keys
str/bytes: hashed withxxhash.xxh3_64into a signed int64.int: used directly (must fit in signed int64).tuple[int, int]: each element must fit in signed int32; packed into a single int64.
Metadata
Release files for pg-dlock 0.0.0a2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pg_dlock-0.0.0a2.tar.gz | 9.0 kB | Without provenance | Details for pg_dlock-0.0.0a2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pg_dlock-0.0.0a2-py3-none-any.whl | Python 3 | none | any | Details for pg_dlock-0.0.0a2-py3-none-any.whl |
Total release size: 18.0 kB
Release files / pg_dlock-0.0.0a2.tar.gz
| Download URL | pg_dlock-0.0.0a2.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
75094aec84c31cfb45cc6fcb575aba4a212ce04704735dc293917000c3075ce4
|
|
BLAKE2b-256 checksum How to use checksums |
1bdc095483e39525edfef6d25a32f1f7e732278db948db64dadbf45bc7ff8294
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / pg_dlock-0.0.0a2-py3-none-any.whl
| Download URL | pg_dlock-0.0.0a2-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa5e444e6bf9246fc6e1f2b709ff16bd44bc73d1443fca9fc4a92a0de722e19c
|
|
BLAKE2b-256 checksum How to use checksums |
b8bdcda43565bcbece0494c2a3c3bd094aa88dead987d51b0449c1885734f85d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for pg-dlock 0.0.0a2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.