Skip to main content

localpub 🥃

A decentralized, brokerless pub/sub for multi-process communication on a single machine.

A local pub for your processes to hang out. 🍻

CI License: MIT Ruff

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 asyncio APIs 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.

Metadata

Release files for localpub 0.1.1

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

Source distribution (sdist)

Source distribution for localpub 0.1.1
File Size Uploaded
localpub-0.1.1.tar.gz 21.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for localpub 0.1.1
File Interpreter ABI Platform
localpub-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 36.1 kB

Release files / localpub-0.1.1.tar.gz

Download URL localpub-0.1.1.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bec9ffdba28f31894cd3143b29265577632dd18a9e231ed1be793dd3d51c5006
BLAKE2b-256 checksum
How to use checksums
e7cbf060568eec461f7cab876d69cbf4c22d2c519c9bf0832e99339a64fc66c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / localpub-0.1.1-py3-none-any.whl

Download URL localpub-0.1.1-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7596f9b585bcfa06e7221f24cc4efc7ce80826eee49032da14e17cd7e2486c9e
BLAKE2b-256 checksum
How to use checksums
d014a6c55f3b377ebf17b5e2b5a11fba16853a0eefc7d7fe5560b10b933d7ac9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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