Skip to main content

The client library for Relukko can be found in module

Project description

PyRelukko

PyPI - Version PyPI - Python Version Python Version from PEP 621 TOML Gitlab Pipeline Status PyPI - Downloads PyPI - License GitLab License PyPI - Format PyPI - Status PyPI - Implementation PyPI - Wheel GitLab Stars GitLab Forks


PyRelukko is the official Python client library for the Relukko resource-locking backend. It provides a simple, distributed locking mechanism for coordinating access to shared resources across multiple Python processes or services.

Relukko is intentionally lightweight: it is designed for collaborative environments. The system assumes clients behave cooperatively, and by design it does not enforce protection against misbehaving clients.

Documentation

Full API documentation can be found at:

👉 https://pyrelukko.readthedocs.io


Features

  • Simple, Pythonic API for acquiring and releasing locks.
  • Centralized lock management via the Relukko backend.
  • Lightweight and dependency-minimal.
  • Useful for distributed systems, CI pipelines, automated testing and shared-resource orchestration.

Important Design Note

Relukko and PyRelukko are built for trusted, collaborative clients.

⚠️ No client-side trust guarantees

A client that connects to the Relukko backend can forcibly release any lock, including those owned by another client. There is no protection against malicious manipulation of locks.

This is an intentional design decision to keep the system simple and lightweight.

If you require secure, adversarial-resistant locking, you should consider using a system built upon consensus algorithms (e.g., etcd, Consul, Zookeeper).


Ecosystem

The Relukko ecosystem consists of the following components:

1. Relukko Backend (Rust)

The backend is responsible for storing and arbitrating lock states.

Repository: https://gitlab.com/relukko/relukko

2. PyRelukko Client (Python)

This Python package communicates with the backend, providing user-friendly locking primitives.

Repository: https://gitlab.com/relukko/pyrelukko

👉 https://pyrelukko.readthedocs.io

3. Robotframework-Relukko (Python)

Robot Framework keyword library that enables acquiring and releasing locks directly from Robot Framework test suites. Depends on PyRelukko.

Repository: https://gitlab.com/relukko/robotframework-relukko


Installation

Install via pip:

pip install pyrelukko

Requires Python 3.11+.


Quick Start

Basic Example

from pyrelukko import RelukkoClient


relukko = RelukkoClient(
    base_url="http://localhost:3000",
    api_key="api-key",
)

lock = relukko.acquire_relukko("LockName", "Creator", 300)
lock_id = lock.get('id')

# Perform work while holding the lock

relukko.delete_relukko(lock_id)

When to Use PyRelukko

PyRelukko is ideal for:

  • Distributed test harnesses
  • CI/CD job coordination
  • Server orchestration scripts
  • Managing exclusive access to hardware devices or simulation environments
  • Any cooperative environment where multiple workers need a shared mutex

It is not designed for untrusted environments or where mutual exclusion must be strongly enforced.


Limitations

  • A malicious or buggy client can release locks it doesn’t own.
  • ❗ No cryptographic guarantees or client identity.
  • ❗ Requires a running Relukko backend server.
  • ❗ Not fault-tolerant like consensus-based systems.

These limitations are intentional, in exchange for simplicity and minimal overhead.


Running the Backend

The backend is written in Rust and provides a simple HTTP API. See the backend repository for instructions:

👉 https://gitlab.com/relukko/relukko


Contributing

Contributions to both the Python client and Rust backend are welcome! Feel free to open issues or merge requests in the relevant GitLab repository.


License

MIT License. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrelukko-0.11.0rc1.tar.gz (75.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyrelukko-0.11.0rc1-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file pyrelukko-0.11.0rc1.tar.gz.

File metadata

  • Download URL: pyrelukko-0.11.0rc1.tar.gz
  • Upload date:
  • Size: 75.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for pyrelukko-0.11.0rc1.tar.gz
Algorithm Hash digest
SHA256 b2bf226496f0b1e33eb2a431abb9aace06a0697c63ada53d95ac0f6c0ebd591f
MD5 7307ea67b33dd5a9403ce1cd7c6a2e2a
BLAKE2b-256 13e9645d3b62fd5115b4e2b83d7b30a11388b04670691891f5fb025b8d79ad69

See more details on using hashes here.

File details

Details for the file pyrelukko-0.11.0rc1-py3-none-any.whl.

File metadata

  • Download URL: pyrelukko-0.11.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for pyrelukko-0.11.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 9e02fd6804e47e47b98fadc7329571816b5de5d5ce3ede08b3ce3de0c006680b
MD5 88294cadffa41bbc7097c3da6ceea23c
BLAKE2b-256 9168c7b253b13b0aa72bc2e9734825fea9d97e0d848c3dc16aadeb0aef460c91

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page