Skip to main content

Publishing to PyPI

This package is ready for PyPI. The setup.py uses your README.md as the long description, so your PyPI page will show this documentation.

To publish:

  1. Make sure you have build and twine installed:
    pip install --upgrade build twine
    
  2. Build the package:
    python3 -m build
    
  3. Upload to PyPI:
    python3 -m twine upload dist/*
    
  4. Check your package at https://pypi.org/project/lockserver-client/

If you update the README, rebuild and re-upload to update the PyPI description.

lockserver-client (Python)

A Python client SDK for lockserver, a distributed lock server for coordinating access to shared resources.

Install

pip install requests

Usage

from lockserver_client import LockserverClient

client = LockserverClient(
    addr='127.0.0.1:8080',  # or from env LOCKSERVER_ADDR
    owner='worker1',        # or from env LOCKSERVER_OWNER
    secret='your-strong-secret' # or from env LOCKSERVER_SECRET
)

# Blocking acquire
client.acquire('my-resource')
# ... critical section ...
client.release('my-resource')

# Non-blocking acquire
if client.acquire('my-resource', blocking=False):
    # ... critical section ...
    client.release('my-resource')

Example: Multiple workers writing to S3

from lockserver_client import LockserverClient

def upload_to_s3(bucket, file):
    print(f"Uploading {file} to {bucket}...")

client = LockserverClient(owner='worker-123', secret='your-strong-secret')

if client.acquire('s3-upload-lock'):
    try:
        upload_to_s3('my-bucket', 'file.txt')
    finally:
        client.release('s3-upload-lock')

API

LockserverClient(addr=None, owner=None, secret=None)

  • addr: lockserver address (default: 127.0.0.1:8080)
  • owner: unique owner id (default: default_owner)
  • secret: shared secret (default: changeme)

acquire(resource, blocking=True, expire=None)

  • Acquires a lock on resource. If blocking is False, returns immediately if lock is held.
  • expire (optional): lock expiration in seconds. After this time, the lock is auto-released by the server.
  • Returns True (lock acquired) or False (non-blocking, lock not acquired).

release(resource)

  • Releases the lock on resource.

License

MIT

Metadata

Release files for lockserver-client 0.1.3

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

Source distribution (sdist)

Source distribution for lockserver-client 0.1.3
File Size Uploaded Provenance
lockserver_client-0.1.3.tar.gz 2.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for lockserver-client 0.1.3
File Interpreter ABI Platform
lockserver_client-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 5.7 kB

Release files / lockserver_client-0.1.3.tar.gz

Download URL lockserver_client-0.1.3.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fe3e991673f4a406cba7d79a259db2e0a87f3b18e4a47f83a9e73e3016fda4b3
BLAKE2b-256 checksum
How to use checksums
257f1c5fd4ae70fa4fb4a89882c56dfd91968b0c8d216ae0611d591ecc675a15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.6

Release files / lockserver_client-0.1.3-py3-none-any.whl

Download URL lockserver_client-0.1.3-py3-none-any.whl
Size 2.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b949b18916d22491b32cb0643d2b82c1be6a78309e18e570ed78af6f0200636f
BLAKE2b-256 checksum
How to use checksums
9974c6c4c6b1c132c158b63b170e70a497f135dbc2f4bd79e55115a6bad4ab1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.6

Security for lockserver-client 0.1.3

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.

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