pyd3js-selection
Python port of d3-selection.
Tracked version: see upstream_lock.json.
What you get
- 100% upstream export parity for the pinned
d3-selection@3.0.0(see matrix below). - 100% Python test coverage for
pyd3js_selection. - Upstream
d3-selectionJS tests vendored and passing via a pytest gate (-m upstream).
Install
From PyPI:
pip install pyd3js-selection
For local development (uv workspace):
uv sync --group dev
Usage
import pyd3js_selection as d3
root = d3.create("div")
root.append("span").text("hi")
print(root.node().innerHTML)
<span>hi</span>
Stability & intentional deviations
- Minimal DOM: this package includes a tiny DOM shim sufficient for upstream
d3-selectionsemantics and tests; it is not a full browser DOM implementation. - Callback “this”: D3’s
thisbinding is represented explicitly (callbacks receivethisas their first argument).
Compatibility matrix
Pinned upstream inventory: docs/UPSTREAM_API.md.
Legend:
[ported]: implemented and covered by ported upstream tests.[missing]: reserved for future upstream drift.
Upstream exports (d3-selection@3.0.0)
create— [ported]creator— [ported]local— [ported]matcher— [ported]namespace— [ported]namespaces— [ported]pointer— [ported]pointers— [ported]select— [ported]selectAll— [ported]selection— [ported]selector— [ported]selectorAll— [ported]style— [ported]window— [ported]
Testing
Run the package tests:
uv run pytest packages/pyd3js-selection/package_tests
Coverage (Python)
uv run pytest packages/pyd3js-selection/package_tests --cov=pyd3js_selection --cov-report=term-missing
Upstream d3-selection test suite (vendored)
We vendor the pinned upstream d3-selection repo (including its Mocha test suite) and run it via pytest:
uv run python scripts/vendor_upstream.py
cd packages/pyd3js-selection/upstream/d3-selection && npm install --legacy-peer-deps
uv run pytest -m upstream packages/pyd3js-selection/package_tests
Documentation
- User guide:
docs/USER_GUIDE.md - Changelog:
docs/CHANGELOG.md
Metadata
Release files for pyd3js-selection 0.1.0
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_selection-0.1.0.tar.gz | 32.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyd3js_selection-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 52.6 kB
Release files / pyd3js_selection-0.1.0.tar.gz
| Download URL | pyd3js_selection-0.1.0.tar.gz |
|---|---|
| Size | 32.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1ded053806e5c9574552ae95edef103b66b4e3144f926486061cc0f5da4dbdcc
|
|
BLAKE2b-256 checksum How to use checksums |
dd9f68fd203748a00c9a426cccd91b506b71090d9f2c5aaced1e260481af653c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / pyd3js_selection-0.1.0-py3-none-any.whl
| Download URL | pyd3js_selection-0.1.0-py3-none-any.whl |
|---|---|
| Size | 19.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
561c7d5282abcab286a0a818e6f4bb93dcefb23b1cdb48a42988f9f9bc20a2f3
|
|
BLAKE2b-256 checksum How to use checksums |
dd8a2e6704f4184cd786db47059af618822b8dac4c1aeb72f928590f09a91c5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|