A pure Python pub/sub broker
Project description
PM-PARK
PM-PARK (Python Messaging Pub/Sub App Broker) is a pure Python pub/sub broker.
Features
- TCP pub/sub broker
- Exact and pattern subscriptions through
fnmatch str,bytes,int, andfloatmessage payloads- Built-in Python logging
- Exact and pattern subscriptions through
- CLI commands for server and client operations
- Pure Python implementation
Requirements
- Python
>=3.12
CLI
Python API
Broker service
import time
from pm_park.server import BrokerService
try:
with BrokerService(host="127.0.0.1", port=6379) as service:
host, port = service.address
print(f"Serving on {host}:{port}")
while service.is_running:
time.sleep(1.0)
except KeyboardInterrupt:
pass
Client publish / subscribe
A running broker service is required to execute this example.
from pm_park.client import PMParkClient
messages: list[dict[str, object]] = []
def on_message(message: dict[str, object]) -> None:
messages.append(message)
with PMParkClient(host="127.0.0.1", port=6379) as sub:
sub.subscribe("news.sports", handler=on_message)
sub.psubscribe("news.*", handler=on_message)
sub.start()
with PMParkClient(host="127.0.0.1", port=6379) as pub:
pub.publish("news.sports", b"score")
pub.publish("news.sports", 42)
pub.publish("news.sports", 3.14)
sub.stop()
Development Setup
This section is for developing this repository.
uv is used as the primary project management tool.
Test
- Detailed guide: tests/README.md
uv run scripts/run_tests.py --unit
uv run scripts/run_tests.py --integration
Build
uv run scripts/build_wheel.py
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 Distributions
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
File details
Details for the file pm_park-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pm_park-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3f18dfca9c3a5c2dce21f407efd79ef828a7a20d959fec39304f5abf760fab0
|
|
| MD5 |
043ec9e29853061e7b1e7030a7fa5009
|
|
| BLAKE2b-256 |
7a59515f35a2c1ca89bb3c53ef8801dcfc7af055ff4a6e8f0a4cfbf079f7aaed
|
Provenance
The following attestation bundles were made for pm_park-0.1.0-py3-none-any.whl:
Publisher:
release.yml on a741852963a2000/pm-park
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pm_park-0.1.0-py3-none-any.whl -
Subject digest:
d3f18dfca9c3a5c2dce21f407efd79ef828a7a20d959fec39304f5abf760fab0 - Sigstore transparency entry: 1261619993
- Sigstore integration time:
-
Permalink:
a741852963a2000/pm-park@907a8223e79fb48d671220c0f2b085fd79a0a4c8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/a741852963a2000
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@907a8223e79fb48d671220c0f2b085fd79a0a4c8 -
Trigger Event:
push
-
Statement type: