Metadata-Version: 2.5
Name: lupaxa-relay
Version: 0.1.1
Summary: Exchange messages between independent programs without extra infrastructure.
Project-URL: Homepage, https://github.com/lupaxa-developers-toolbox/relay
Project-URL: Documentation, https://relay.thelupaxaproject.org/
Project-URL: Repository, https://github.com/lupaxa-developers-toolbox/relay
Project-URL: Issues, https://github.com/lupaxa-developers-toolbox/relay/issues
Author: The Lupaxa Project
License: MIT License
        
        Copyright (c) The Lupaxa Project
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENCE
Keywords: cli,messaging,pubsub,queue,relay
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development
Classifier: Topic :: System :: Networking
Requires-Python: >=3.11
Requires-Dist: aiosqlite>=0.20
Requires-Dist: platformdirs>=4
Requires-Dist: pydantic>=2
Requires-Dist: pyyaml>=6
Requires-Dist: rich>=13
Requires-Dist: typer>=0.12
Provides-Extra: dev
Requires-Dist: bump-my-version>=1.2.0; extra == 'dev'
Requires-Dist: hatch>=1.12.0; extra == 'dev'
Requires-Dist: mypy>=1.12.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6.0; extra == 'dev'
Requires-Dist: textual>=1.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material==9.7.7; extra == 'docs'
Requires-Dist: mkdocs==1.6.1; extra == 'docs'
Provides-Extra: test
Requires-Dist: pytest-asyncio>=0.24; extra == 'test'
Requires-Dist: pytest-cov>=5.0; extra == 'test'
Requires-Dist: pytest>=8.0; extra == 'test'
Provides-Extra: tui
Requires-Dist: textual>=1.0; extra == 'tui'
Description-Content-Type: text/markdown

<p align="center">
  <a href="https://github.com/lupaxa-developers-toolbox">
    <img src="https://raw.githubusercontent.com/the-lupaxa-project/brand-assets/master/logos/organisations/developers-toolbox/readme-logo.png" alt="Developers Toolbox" />
  </a>
</p>

<h1 align="center">Relay</h1>

Relay is a local message broker. A program publishes an event, and Relay
stores it before acknowledging the publish. Other programs can subscribe
to a topic pattern and receive those events. A queue leases each job to
one worker until that worker acknowledges it, retries it, or dead-letters
it. Programs do not need Redis, RabbitMQ, or another external service.

> **Note:** A durable subscription keeps its place across restarts and
> waits for an acknowledgement before the next event. A queue keeps a
> pending job, and an unexpired lease, across a broker restart. A binding
> copies a published event onto a queue in that same commit. `relay history`
> can filter with a topic pattern, and `--message` includes deliveries and
> acknowledgements. `relay tui` shows queues, events, subscriptions, and
> dead letters when the `tui` extra is installed. Destructive commands
> accept `--dry-run`.

The PyPI name is `lupaxa-relay`. The import path is `lupaxa.relay`. The
console script is `relay`. `lupaxa` is a namespace package — there is no
`lupaxa/__init__.py`.

## Install

```bash
pip install lupaxa-relay
```

Python 3.11 or newer is required.

## Run

```bash
relay serve
relay publish build.completed --json '{"version":"1.2.0"}'
relay subscribe "build.*"
relay subscribe "build.*" --durable auditor
relay enqueue image.resize --json '{"image":"a.jpg"}'
relay worker consume image.resize
relay status
relay queue list
relay history --topic "build.*"
relay history --message <id>
relay doctor
relay queue purge image.resize --dry-run
relay daemon start
relay tui
relay --help
relay --version
```

`relay serve` listens on a Unix socket. `relay publish` prints the message
id and sequence after the event is stored. Stop the broker with Ctrl-C.
Events already stored are still there the next time it starts.

## Samples

The repository has three ready-to-run directories under `samples/`.
Start the broker from the sample directory. This is the smallest:

```bash
cd samples/hello
relay --config relay.yml serve
```

From another terminal, in that same directory:

```bash
python publish.py
relay --config relay.yml history --topic build.completed
```

`samples/queue` enqueues a job and acknowledges it. `samples/subscribe`
keeps a durable subscription and copies the event onto a queue.

## Documentation

The guide lives in `mkdocs/` and publishes to
<https://relay.thelupaxaproject.org/>.
It has install steps, events and queues, a command reference, and a
walkthrough of each sample with commands you can paste.

```bash
pip install -r requirements.txt
mkdocs serve
```

<a href="https://github.com/the-lupaxa-project">
    <img src="https://raw.githubusercontent.com/the-lupaxa-project/brand-assets/master/logos/components/footer-for-child-orgs.svg" alt="The Lupaxa Project Footer" width="100%" />
</a>
