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:
- Make sure you have
buildandtwineinstalled:pip install --upgrade build twine
- Build the package:
python3 -m build
- Upload to PyPI:
python3 -m twine upload dist/*
- 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. Ifblockingis 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) orFalse(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)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| lockserver_client-0.1.3.tar.gz | 2.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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.