Python port of d3-dispatch
Project description
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
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 pyd3js_dispatch-0.1.1.tar.gz.
File metadata
- Download URL: pyd3js_dispatch-0.1.1.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68a4571b6117ef9fce424462ecc44df72b0ee9ba79d12f77257cd2e087df247a
|
|
| MD5 |
c3852cfab5f4a87d906bdb02353a93bf
|
|
| BLAKE2b-256 |
b27de023e73a49cb9096ca339d2d468efcdeae2b5e7895c01efeefba05560271
|
File details
Details for the file pyd3js_dispatch-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pyd3js_dispatch-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3569ecc1b5f38f716e81716e399fb2c753303b1b819fcdd62b00f77970e9102
|
|
| MD5 |
561375c4918843bee638d36113005cbb
|
|
| BLAKE2b-256 |
cdfe87ef2c599a81c862742375ab2cc4175a4b859638cb5169b2594e7f4e6d7a
|