Skip to main content

Python bindings and notebook widget support for ruviz

Project description

ruviz for Python

ruviz for Python wraps the Rust plotting runtime with a fluent Python API, static export helpers, native desktop show(), and notebook widget support. It requires Python 3.10 or newer and installs the runtime dependencies needed for NumPy inputs, static rendering, and AnyWidget notebooks.

Install

pip install ruviz

If you want pandas or Polars dataframe inputs, install the matching optional extra:

pip install "ruviz[dataframes]"
# or only one dataframe backend:
pip install "ruviz[pandas]"
pip install "ruviz[polars]"

Quick Start

import numpy as np
import ruviz

x = np.linspace(0.0, 4.0, 50)
y = x**2

(
    ruviz.plot()
    .line(x, y)
    .title("Quadratic")
    .xlabel("x")
    .ylabel("y = x^2")
    .save("quadratic.png")
)

Notebook and Desktop Usage

  • In Jupyter, plot.show() displays a static PNG in the cell output.
  • Use plot.widget() when you want the synced WASM-backed notebook widget.
  • plot.size_px(width, height) also controls the widget's displayed size and aspect ratio.
  • Without size_px(...), the widget uses the default PNG size (640x480) and shrinks proportionally if the notebook column is narrower.
  • Drag the widget's bottom-right handle to resize the display freely.
  • Hold Shift or Ctrl while dragging the handle to preserve the current aspect ratio.
  • In the widget, right click opens the export menu and right drag performs box zoom.
  • Outside notebooks, plot.show() opens the native interactive window.
  • The published Linux wheel focuses on static rendering and notebook widgets. Install from source on Linux if you need the native desktop plot.show() window.
  • plot.render_png() returns PNG bytes and plot.render_svg() returns an SVG string.
  • plot.save(path) writes PNG, SVG, or PDF according to the file extension and returns the output Path.

Reactive Notebook Data

Use ruviz.observable(...) for notebook-driven updates that keep explicit widgets in sync:

import numpy as np
import ruviz

x = np.linspace(0.0, 6.0, 200)
y = ruviz.observable(np.sin(x))

plot = ruviz.plot().size_px(640, 360).line(x, y).title("Live Sine Wave")
widget = plot.widget()

ObservableSeries supports elementwise arithmetic and NumPy ufuncs. Derived observables stay live until you write to them directly. Live observable series are supported by line, scatter, bar, histogram, boxplot, error_bars, and error_bars_xy; other plot types snapshot their inputs.

import numpy as np

scaled = np.sin(y * 2.0 + 0.25)
plot.line(x, scaled)
y.replace(np.cos(x))

deepcopy(plot) creates an independent live copy with fresh observables, while plot.clone() remains a static snapshot copy.

Documentation

Contributor Workflow

cd python
uv sync
uv run maturin develop
uv run python scripts/generate_gallery.py
uv run mkdocs serve

Rebuild the bundled widget frontend from the repository root when you change the web SDK or packages/ruviz-web/src/python-widget.ts:

bun run build:python-widget

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

ruviz-0.4.19.tar.gz (4.6 MB view details)

Uploaded Source

Built Distributions

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

ruviz-0.4.19-cp310-abi3-win_amd64.whl (6.9 MB view details)

Uploaded CPython 3.10+Windows x86-64

ruviz-0.4.19-cp310-abi3-manylinux_2_28_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64

ruviz-0.4.19-cp310-abi3-macosx_11_0_arm64.whl (6.9 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

ruviz-0.4.19-cp310-abi3-macosx_10_12_x86_64.whl (7.1 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file ruviz-0.4.19.tar.gz.

File metadata

  • Download URL: ruviz-0.4.19.tar.gz
  • Upload date:
  • Size: 4.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ruviz-0.4.19.tar.gz
Algorithm Hash digest
SHA256 22ff6466d2c7ff1eaf2e68194ec76d6e0b56e67a60e6af0d7a291e514e2f1ee6
MD5 02a8c8475990e8c60d56beebffa4d7a1
BLAKE2b-256 b3bbb3ecb6c5984e629da314dad2ad747e4702fe2494fddf55abbb20d8475281

See more details on using hashes here.

Provenance

The following attestation bundles were made for ruviz-0.4.19.tar.gz:

Publisher: release.yml on Ameyanagi/ruviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ruviz-0.4.19-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: ruviz-0.4.19-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 6.9 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ruviz-0.4.19-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 18418ffd4bfa9e3623c81f8a677963a2fb318fbb4b2b42b6bc9ff2967fbbc9a2
MD5 9a1950b91ed1734f8116c44924d47ae7
BLAKE2b-256 60423ce293b60ab8bfa7953305f9f64de74668e012bf59c65efc3976f0c51189

See more details on using hashes here.

Provenance

The following attestation bundles were made for ruviz-0.4.19-cp310-abi3-win_amd64.whl:

Publisher: release.yml on Ameyanagi/ruviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ruviz-0.4.19-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ruviz-0.4.19-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1eee54b5a933a89fac2a3aca2718a6a5dc73430b1ea74255c88ec03531a200a2
MD5 f23894a090c30e97bb96b8634a7b1597
BLAKE2b-256 c6a5fd0eb9d700cdfd6aa3d7b0e8d0d2a09092a9e98c60137cd7c282b4d35e49

See more details on using hashes here.

Provenance

The following attestation bundles were made for ruviz-0.4.19-cp310-abi3-manylinux_2_28_x86_64.whl:

Publisher: release.yml on Ameyanagi/ruviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ruviz-0.4.19-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ruviz-0.4.19-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5cea3161055c347ecc84afacbdba66f188f1e5cdb423cccf949a43bb0c88f670
MD5 5cc847005310b97aa77e735099ef3c69
BLAKE2b-256 04ea286399d6583368eb92412369ff580ab70ba85ba88bf3c23a9f12d50dbdb3

See more details on using hashes here.

Provenance

The following attestation bundles were made for ruviz-0.4.19-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on Ameyanagi/ruviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ruviz-0.4.19-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ruviz-0.4.19-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7f5070d028c582ab5c8db0945307062574e44412a4a9f62fd0a5573034c8fbaf
MD5 25c19b4b29607193cc29d16f4bea8842
BLAKE2b-256 f279201a7804354056b193aa45e3486a70adf87be2174a766a6dbee03ac92e45

See more details on using hashes here.

Provenance

The following attestation bundles were made for ruviz-0.4.19-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on Ameyanagi/ruviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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