Skip to main content

pyd3js-selection

PyPI version Python versions License CI Security

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-selection JS 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-selection semantics and tests; it is not a full browser DOM implementation.
  • Callback “this”: D3’s this binding is represented explicitly (callbacks receive this as 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

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)

Source distribution for pyd3js-selection 0.1.0
File Size Uploaded
pyd3js_selection-0.1.0.tar.gz 32.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyd3js-selection 0.1.0
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page