Skip to main content

asyncpg-lock

Run long-running work exclusively using PostgreSQL advisory locks.

Usage

import asyncio
import asyncpg
import asyncpg_lock


async def worker_func() -> None:
    # something very long-running
    while True:
        await asyncio.sleep(100500)


async def main():
    guard = asyncpg_lock.AdvisoryLockGuard(
        connect=lambda: asyncpg.connect("postgresql://localhost/db")
    )
    # worker_func will not be executed concurrently
    key = 100500
    tasks = [
        asyncio.create_task(guard.run(key, worker_func)),
        asyncio.create_task(guard.run(key, worker_func)),
        asyncio.create_task(guard.run(key, worker_func)),
        asyncio.create_task(guard.run(key, worker_func))
    ]
    await asyncio.gather(*tasks)


asyncio.run(main())

Metadata

Release files for asyncpg-lock 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asyncpg-lock 0.0.4
File Size Uploaded Provenance Actions
asyncpg_lock-0.0.4.tar.gz 39.0 kB Without provenance Details for asyncpg_lock-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for asyncpg-lock 0.0.4
File Interpreter ABI Platform Actions
asyncpg_lock-0.0.4-py3-none-any.whl Python 3 none any Details for asyncpg_lock-0.0.4-py3-none-any.whl

Total release size: 43.5 kB

Release files / asyncpg_lock-0.0.4.tar.gz

Download URL asyncpg_lock-0.0.4.tar.gz
Size 39.0 kB
Tags Source
SHA-256 checksum
How to use checksums
67e8a22aa94251c56475c8416cf72ff06edcc3a68961344a692d615cedea6d36
BLAKE2b-256 checksum
How to use checksums
195fb37e382f9c441dde505f4954bb2989bcbde7b7bfcee55d6dba26d3755540
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / asyncpg_lock-0.0.4-py3-none-any.whl

Download URL asyncpg_lock-0.0.4-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b81c9f9fc1b9182f504458439c44dd88daadf54dbc598468d6dd1372d8fa6d2
BLAKE2b-256 checksum
How to use checksums
f5b3c45f88a6b66ddbda1775aaf30c2fc06f01697c14cb90155162b6bf2abaa8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for asyncpg-lock 0.0.4

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page