Python Publish-Subscribe Package
Project description
News
December 2025: pypubsub 4.0.7 released! (update to latest packaging system, testing, docs).
… (has it really been this long since I cleaned this up?!)…
January 2019: pypubsub 4.0.3 released! (for those – and only those – who use Python >= 3).
March 2019: pypubsub 3.4.2 released (for those – and only those – who use Python 2.7.x).
Overview
Provides a publish-subscribe API to facilitate event-based or message-based architecture in a single-process application. It is pure Python and works on Python 3.7+ (tested through 3.14). It is centered on the notion of a topic; senders publish messages of a given topic, and listeners subscribe to messages of a given topic, all inside the same process. The package also supports a variety of advanced features that facilitate debugging and maintaining topics and messages in larger desktop- or server-based applications.
Install most recent stable with “pip install pypubsub”.
Useful links:
Project on PyPI: https://pypi.python.org/pypi/PyPubSub
The documentation for latest stable release is at http://pypubsub.readthedocs.io.
The documentation for latest code is at http://pypubsub.readthedocs.io/en/latest.
Contributing and testing
Install uv, then run the test matrix with tox (uses tox-uv under the hood):
uv tool install tox --with tox-uv tox # or: tox -e py312
Package build verification is available via tox -e pkg (runs python -m build and twine check).
Python 3.7 note: uv does not auto-provide CPython 3.7. tox -e py37 will skip locally if 3.7 isn’t available; it is exercised in GitHub CI.
Local development install
Create a virtual environment and install in editable mode:
uv venv .venv && source .venv/bin/activate uv pip install -e .
Then you can open a Python shell (python) and import pubsub, or run examples such as:
python examples/advanced/advanced_main.py python examples/basic_kwargs/console_main.py
To run a small example suite, use the helper script (assumes your venv is active):
bash examples/runall.sh # uses 'python' from your venv
wxPython on Ubuntu 22+
If you want to run the wx examples, install wxPython and SDL2 runtime in your venv on Ubuntu 22.x+:
pip install --upgrade pip setuptools wheel pip install --only-binary=:all: -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 wxPython==4.2.4 sudo apt-get install libsdl2-2.0-0 # runtime for the wheel
If the wheel is not found for your distro/Python combo, you’ll need GTK3/SDL build deps to compile from source instead.
Docs
Install deps into a local venv and build:
pip install -r docs/requirements.txt make docs # builds docs/_build/html make clean-docs # removes docs/_build
Helpers:
make venv sets up a local venv at .venv (uses system python).
make clean-venv removes that venv.
make add-wxpy-ubuntu installs wxPython 4.2.4 wheel + SDL2 runtime on Ubuntu (requires sudo). Useful for running wx examples in that venv.
Release helpers can be run via Makefile wrappers, e.g. make init-tag TAG=v4.0.7 or make bump-local BUMP=patch.
Release helpers can be run via the Makefile wrappers, e.g. make init-tag TAG=v4.0.7 or make bump-local BUMP=patch.
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
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 pypubsub-4.0.7.tar.gz.
File metadata
- Download URL: pypubsub-4.0.7.tar.gz
- Upload date:
- Size: 179.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec8b5cb147624958320e992602380cc5d0e4b36b1c59844d05e425a3003c09dc
|
|
| MD5 |
4025cd1b0dd06812ecb85132e8919449
|
|
| BLAKE2b-256 |
c9ae873ab0911ba6ae395f05a788cd509af4ade15585740e1f0bc7673775f469
|
File details
Details for the file pypubsub-4.0.7-py3-none-any.whl.
File metadata
- Download URL: pypubsub-4.0.7-py3-none-any.whl
- Upload date:
- Size: 72.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89c3e274e634fea19de881bb45152815d9c1aaa0120215f85200ba56843372f4
|
|
| MD5 |
2bcf1ffe13de7c5484a11d146d0a2692
|
|
| BLAKE2b-256 |
47bf17587e7cdefbf66cb3f0bced126c11a6d4c0b9b78a3eb90bbd0a49963d58
|