pyd3js-dispatch
Python port of d3-dispatch.
Tracked version: see upstream_lock.json.
What is a dispatch?
A dispatch is a small, namespaced event-listener registry. You create it with a fixed set of event
types (e.g. "start", "end"), attach callbacks via .on("type.namespace", fn), and later trigger
all callbacks of a type via .call("type", that, *args) / .apply("type", that, args).
This pattern is used throughout D3 to provide internal events (drag/zoom/brush/transition, etc.) without requiring a DOM or a heavyweight event system.
What you get
- Upstream export parity (for the pinned
d3-dispatch@3.0.1): the compatibility matrix below covers every upstream export; nothing is marked[missing]. - 100% Python test coverage for
pyd3js_dispatch(run the coverage command below).
Install
From PyPI:
pip install pyd3js-dispatch
This repo is a uv workspace monorepo. For local development:
uv sync --group dev
Usage
import pyd3js_dispatch as dd
d = dd.dispatch("start", "end")
log: list[tuple[str, int]] = []
d.on("start.foo", lambda this, x: log.append(("foo", x)))
d.call("start", None, 1)
print(log)
d.on("start.foo", None)
d.call("start", None, 2)
print(log)
[('foo', 1)]
[('foo', 1)]
Compatibility matrix (pinned upstream)
dispatch— [unit]
Development
Coverage:
uv run pytest packages/pyd3js-dispatch/tests --cov=pyd3js_dispatch --cov-report=term-missing
Metadata
Release files for pyd3js-dispatch 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyd3js_dispatch-0.1.1.tar.gz | 9.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyd3js_dispatch-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.5 kB
Release files / pyd3js_dispatch-0.1.1.tar.gz
| Download URL | pyd3js_dispatch-0.1.1.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68a4571b6117ef9fce424462ecc44df72b0ee9ba79d12f77257cd2e087df247a
|
|
BLAKE2b-256 checksum How to use checksums |
b27de023e73a49cb9096ca339d2d468efcdeae2b5e7895c01efeefba05560271
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / pyd3js_dispatch-0.1.1-py3-none-any.whl
| Download URL | pyd3js_dispatch-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f3569ecc1b5f38f716e81716e399fb2c753303b1b819fcdd62b00f77970e9102
|
|
BLAKE2b-256 checksum How to use checksums |
cdfe87ef2c599a81c862742375ab2cc4175a4b859638cb5169b2594e7f4e6d7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|