Python port of d3-selection
Project description
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
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_selection-0.1.0.tar.gz.
File metadata
- Download URL: pyd3js_selection-0.1.0.tar.gz
- Upload date:
- Size: 32.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ded053806e5c9574552ae95edef103b66b4e3144f926486061cc0f5da4dbdcc
|
|
| MD5 |
00bfa631abebd03295f6df18c5397d60
|
|
| BLAKE2b-256 |
dd9f68fd203748a00c9a426cccd91b506b71090d9f2c5aaced1e260481af653c
|
File details
Details for the file pyd3js_selection-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyd3js_selection-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
561c7d5282abcab286a0a818e6f4bb93dcefb23b1cdb48a42988f9f9bc20a2f3
|
|
| MD5 |
83dc8a5d1719f32b022e036fe9d8658d
|
|
| BLAKE2b-256 |
dd8a2e6704f4184cd786db47059af618822b8dac4c1aeb72f928590f09a91c5c
|