A decentralized, brokerless pub/sub for multi-process communication on a single machine
Project description
localpub 🥃
A decentralized, brokerless pub/sub for multi-process communication on a single machine.
A local pub for your processes to hang out. 🍻
Features
- Multiple backends: Choose the right transport for your workload:
- Unix Domain Socket Mesh — peer-to-peer, no single point of failure
- Unix Domain Socket Broker — competitive binding, first process becomes broker
- mmap Ring Buffer — ultra-low-latency shared memory
- Async-first: Modern
asyncioAPIs with convenient sync wrappers - Pluggable serialization: Pass any Python object; swap in JSON, msgpack, or your own
- Zero external dependencies: Pure stdlib for the core package
- Fully typed: PEP 561 compatible with strict type coverage
Quick Start
import asyncio
from localpub import UnixMeshBus
async def main():
bus = UnixMeshBus("/tmp/mypub")
await bus.open()
await bus.subscribe("greetings", lambda env: print(f"Received: {env.payload}"))
await bus.publish("greetings", {"msg": "hello from process A"})
await asyncio.sleep(1)
await bus.close()
asyncio.run(main())
Synchronous API
from localpub import UnixMeshBus, SyncBus
bus = SyncBus(UnixMeshBus("/tmp/mypub"))
with bus:
bus.subscribe("greetings", lambda env: print(f"Received: {env.payload}"))
bus.publish("greetings", "hello")
Pick a backend
| Backend | Latency | Throughput | Brokerless | Use case |
|---|---|---|---|---|
UnixMeshBus |
Low | Medium | Yes | Resilient, no single point of failure |
UnixBrokerBus |
Low | High | No (elected) | General purpose, simple topology |
MmapRingBus |
Ultra-low | Very High | Yes | High-throughput same-machine IPC |
Installation
pip install localpub
Development
# Install dependencies
make install
# Run tests
make test
# Lint & format
make lint
make format
# Type check
make typecheck
# Run all checks (lint + typecheck + test)
make check
# Build wheel and sdist
make build
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
localpub-0.1.0.tar.gz
(21.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
localpub-0.1.0-py3-none-any.whl
(15.0 kB
view details)
File details
Details for the file localpub-0.1.0.tar.gz.
File metadata
- Download URL: localpub-0.1.0.tar.gz
- Upload date:
- Size: 21.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da900bc558737423e19e9f2aaf59d8ba9c6cf30bf13a45f4f604a3437aeb19f6
|
|
| MD5 |
ae9a92b8846208b813b7de9bd9e4fa7d
|
|
| BLAKE2b-256 |
88e861f1927ff69038b3f50eba062052f8fe0af300fce331fd6324456acba4a9
|
File details
Details for the file localpub-0.1.0-py3-none-any.whl.
File metadata
- Download URL: localpub-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1884954ef85542d8ab0df6c8cdd6cadeebc6dc7b542b0d33e80600ae5c177dd
|
|
| MD5 |
01f422e13073f8b326bb9e054b9f0867
|
|
| BLAKE2b-256 |
e5c5833bf52862fe7d673034fa092ca923ebfe865284ac576afa006d9014138d
|