Skip to main content

Python port of d3-array

Project description

pyd3js-array

PyPI version

Python port of d3-array.

Tracked version: see upstream_lock.json.

Install

This repo is a uv workspace. For local development:

uv sync --group dev

To add just this package to another project (once published), you’d install pyd3js-array and import pyd3js_array.

Usage

from pyd3js_array import extent, min, max, range

extent([5, 1, 2, 3, 4])  # (1, 5)
min([5, 1, 2, 3, 4])     # 1
max([5, 1, 2, 3, 4])     # 5
range(2, 5)              # [2, 3, 4]

Accessors receive (d, i, array) (mirroring D3):

from pyd3js_array import extent

data = [{"value": 3}, {"value": 1}, {"value": 2}]
extent(data, lambda d, i, a: d["value"])  # (1, 3)

Implemented API (currently)

  • extent(values, valueof=None)
  • min(values, valueof=None)
  • max(values, valueof=None)
  • range(stop) / range(start, stop) / range(start, stop, step)

Testing

Run the package tests:

uv run pytest packages/pyd3js-array/tests

Oracle parity tests (Node)

Some tests compare behavior against real d3-array via the repo’s Node oracle:

cd tools/oracle && npm install
uv run pytest -m oracle packages/pyd3js-array/tests

Roadmap

See ROADMAP.md.

Changelog

See CHANGELOG.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyd3js_array-0.0.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyd3js_array-0.0.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file pyd3js_array-0.0.1.tar.gz.

File metadata

  • Download URL: pyd3js_array-0.0.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for pyd3js_array-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2141a18523b9dee724c6c5208746426387239a270f199487c16c153a5778a94a
MD5 60420d3d76fe96a6246b0af3d63c4ff9
BLAKE2b-256 5f9f3ffd353e3b45848373bd8e89512dfe75102f31147ac19ef0ec93c3365a5e

See more details on using hashes here.

File details

Details for the file pyd3js_array-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyd3js_array-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for pyd3js_array-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 736182a15fcb11e2320f13e4a714c6743a4b7fa933ba210471ab0d8067775e4e
MD5 11b39e7078d3e53c765081755108dfeb
BLAKE2b-256 88e286316f6a60a28ef31a4346309403a458eb9fd27fbbf9a0aca24de14ef918

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page