Skip to main content

silverpoint

silverpoint charts from Python — in notebooks, Flask, Django and static HTML. No picture is made in Python: the package builds a chart spec and the markup that carries it, and the library's own standalone script (@silverpoint/embed, vendored version for version) draws it.

pip install silverpoint            # no dependencies
pip install "silverpoint[flask]"   # or [django]

silverpoint X.Y.Z vendors @silverpoint/embed X.Y.Z (silverpoint.SILVERPOINT_VERSION).

A chart

import pandas as pd
import silverpoint

df = pd.DataFrame({"team": ["A", "B", "C"], "wins": [12, 9, 15]})
chart = silverpoint.bar_chart(df, x="team", value="wins", orientation="rows", title="Wins")

chart.spec  # the ChartSpec, a dict
chart.to_html()  # a complete, self-contained page (the script inlined; no network)
chart.to_svg()  # the library's renderToSVG bytes (needs Node 20+ on PATH)

There is one builder per chart a table can feed — silverpoint.line_chart, heatmap_chart, sankey_chart, … — with one keyword per role (a column name) and per option, generated from the host catalog. silverpoint.Chart("bar-chart", df, roles={...}, options={...}) is the same thing by name, and silverpoint.catalog is the catalog itself. Data can be rows, a mapping of columns, a pandas or polars DataFrame or a pyarrow Table; dates become ISO strings and NaN/NaT become None.

A role, column, option or value the catalog does not know raises SpecError naming the closest valid names, before any HTML is written.

Jupyter, JupyterLab, VS Code

A chart as a cell's value draws itself: each one is a sandboxed <iframe srcdoc> holding the inline page, so it needs no trusted notebook. silverpoint.notebook.enable() shows the script once and writes later charts as <silverpoint-chart> elements, for front ends that run scripts in outputs.

Databricks

A Spark DataFrame goes straight into a builder, and a chart as a cell's value draws itself:

from pyspark.sql import functions as F

import silverpoint

by_hour = (
    spark.read.table("samples.nyctaxi.trips")
    .groupBy(F.hour("tpep_pickup_datetime").alias("hour"))
    .agg(F.count("*").alias("trips"))
    .orderBy("hour")
)
silverpoint.line_chart(by_hour, x="hour", value="trips", title="Trips per pickup hour")

displayHTML(chart.to_html(render="client")) draws a chart anywhere in a cell, so one cell can draw several. pandas-on-Spark DataFrames and the Rows of collect() work too.

  • Rows. At most silverpoint.data.SPARK_ROW_LIMIT (10,000) rows are read, through limit, so a large table never reaches the driver; a bigger DataFrame raises ValueError. Aggregate in Spark first.
  • Size. Each chart carries its own copy of the script (about 0.5 MB; 1.1 MB with 10,000 rows). One cell's output may be 10 MB by default on Runtime 17+ (%set_cell_max_output_size_in_mb sets 1–20 MB), and a notebook keeps about fifteen charts before Databricks stops saving its revision snapshots (10 MB).
  • silverpoint.notebook.enable() has no effect there: each output is its own frame.

examples/notebooks/databricks.py is a notebook to import (Databricks source format) that runs on samples.nyctaxi.trips.

Flask

from silverpoint.contrib.flask import Silverpoint

Silverpoint(app)  # serves the script at /_silverpoint/, immutable, with its integrity
<head>{{ silverpoint_script() }}</head>
<body>{{ silverpoint_chart(chart) }}</body>

Django

Add "silverpoint.contrib.django" to INSTALLED_APPS (with django.contrib.staticfiles), then:

{% load silverpoint %}
<head>{% silverpoint_script %}</head>
<body>{% silverpoint_chart chart %}</body>

The Flask and Django markup has no inline script or style: it renders under Content-Security-Policy: script-src 'self'; style-src 'self'.

HTML

to_html(full_document=True, script="inline", render="auto"):

  • script: "inline" (the vendored file in the page), "none" (the page loads it) or a URL your application serves. A CDN URL is never written.
  • render: "server" draws the chart in Node with the library's renderToHTML (byte-identical to its goldens; the script then adopts it); "client" writes only the spec and the script draws it; "auto" picks server when Node is on PATH.

silverpoint.static_path() is the folder holding silverpoint-embed.full.js, for any framework.

Development

uv sync
uv run pytest                                   # browser tests: uv run playwright install chromium
uv run ruff check . && uv run ruff format --check .
uv run python scripts/vendor.py --check         # the vendored files against integrity.json
uv run python scripts/make_builders.py --check  # the generated builders are current
node scripts/conformance.mjs                    # the library's conformance kit, in Node

A new silverpoint version: uv run python scripts/vendor.py X.Y.Z (the release's hosts kit), then uv run python scripts/make_builders.py, and set version in pyproject.toml to X.Y.Z.

Licence: MIT. The vendored script embeds EB Garamond (SIL OFL 1.1, _vendor/OFL.txt).

Metadata

Release files for silverpoint 0.11.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 silverpoint 0.11.0
File Size Uploaded Provenance Actions
silverpoint-0.11.0.tar.gz 734.2 kB Without provenance Details for silverpoint-0.11.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for silverpoint 0.11.0
File Interpreter ABI Platform Actions
silverpoint-0.11.0-py3-none-any.whl Python 3 none any Details for silverpoint-0.11.0-py3-none-any.whl

Total release size: 1.5 MB

Release files / silverpoint-0.11.0.tar.gz

Download URL silverpoint-0.11.0.tar.gz
Size 734.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2a55b04700fd86c31d73bcde474266b7ab8b9dee3752c7971d21b1eb0a5d6c3d
BLAKE2b-256 checksum
How to use checksums
28ff0a09596ef61a2dfd0be8c5df4cb1bf05d728bca45c020820a82aabbda4dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / silverpoint-0.11.0-py3-none-any.whl

Download URL silverpoint-0.11.0-py3-none-any.whl
Size 748.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44db12c05f30875227163caa36e50eb2bce98237ff02e4cc8bfc83705d8fa3b9
BLAKE2b-256 checksum
How to use checksums
4dca37ef5641eeaec654341b4121f9a2b1688df80f6f9f2c5d2e8d809b1e95b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for silverpoint 0.11.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.11.0 This release

2 release files No provenance

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