reflex-rosencharts
A port of the rosencharts charting library (43 React/TSX components built with D3.js + Tailwind) to a custom component for Reflex, so the charts can be used from pure Python.
Status: scaffold + SDD plan. The charts are implemented in phases according to
specs/plans/implementation-plan.md.
Why?
rosencharts is not an npm package: it's a set of .tsx components to copy and paste, with
hardcoded data and Tailwind styling. This project wraps them as local Reflex components
(rx.asset + library="$/public..."), parametrizes them to receive data from rx.State, and
exposes them as Python functions:
import reflex as rx
import reflex_rosencharts as rxc
class State(rx.State):
sales: list[dict] = [{"date": "2023-05-01", "value": 6}, {"date": "2023-05-02", "value": 8}]
def index() -> rx.Component:
return rxc.line_chart(data=State.sales)
Charts (43 across 8 families)
| Family | # | Examples |
|---|---|---|
| Area | 4 | area_chart, area_chart_gradient |
| Bar | 12 | bar_chart_horizontal, bar_chart_benchmark |
| Line | 8 | line_chart, line_chart_multiple |
| Pie/Donut | 8 | pie_chart, donut_chart_center_text |
| Scatter | 4 | scatter_chart, scatter_chart_interactive |
| Treemap | 3 | treemap_chart, treemap_chart_images |
| Radar | 2 | radar_chart, radar_chart_rounded |
| Other | 2 | bubble_chart, funnel_chart |
Full catalog and props: specs/api/component-api-v1.md.
Axis options (scatter and line charts)
The scatter charts build both axes from the extent of the data, label them with regular ticks that line up with the grid lines, and reserve room for the dots so none is clipped at the edges — the data does not have to arrive sorted:
rxc.scatter_chart(
data=State.repos, # [{"revenue": x, "value": y, "company": label}, ...]
x_scale="log", # "linear" (default), "log" or "symlog"
margin_left="46px", # optional; by default it fits the longest y label
)
| Prop | Charts | Default |
|---|---|---|
margin_left |
the 4 scatter charts, line_chart, line_chart_curved, line_chart_multiple, line_chart_pulse, line_chart_step, line_chart_stocks_curved |
computed from the longest y label |
x_scale / y_scale |
the 4 scatter charts | "linear" |
"log" needs strictly positive values and falls back to "symlog" when any
value is <= 0. See CHANGELOG.md for what changed in 0.2.2.
Installation
pip install reflex-rosencharts
# or, with uv:
uv add reflex-rosencharts
Requires Python ≥ 3.13 and Reflex ≥ 0.10.0 (since 0.3.0; use
reflex-rosencharts<0.3 on Reflex 0.9).
Project layout
This repo is a Reflex custom component:
custom_components/
└── reflex_rosencharts/ # the published package (import name: reflex_rosencharts)
├── __init__.py # public API surface
├── reflex_rosencharts.py # shared base wrapper (RosenChart)
└── components/<family>/ # chart wrappers, ported in phases
reflex_rosencharts_demo/ # demo app (reflex run) showcasing the component
pyproject.toml # packaging metadata (where = ["custom_components"])
Development
Managed with uv:
uv sync --extra dev --group test # install runtime + publishing + test tooling
uv run reflex run # start the demo app / gallery
Axis regression check for the scatter and line charts (server-renders them with
clustered, unsorted and extreme-valued data and asserts the tick, margin and
clipping guarantees). It uses the frontend dependencies Reflex installs on the
first reflex run, plus esbuild (Reflex 0.10 builds with Vite 8 / rolldown and
no longer installs it):
npm install --no-save --prefix scripts esbuild
node scripts/check_scatter_axes.mjs
Build & publish (custom component)
Reflex 0.10 removed reflex component build, so the build is two steps:
# 1. Generate the .pyi stubs (PYTHONPATH=. lets the generator resolve the
# package under custom_components/).
PYTHONPATH=. uv run python -m reflex_base.utils.pyi_generator custom_components/reflex_rosencharts
# 2. Build the sdist + wheel into dist/.
uv build
# 3. Sanity-check the artifacts.
uv run twine check --strict dist/*
# 4. Publish to PyPI with uv (needs a PyPI API token):
uv publish --token "$PYPI_TOKEN"
# …or to TestPyPI first:
uv publish --publish-url https://test.pypi.org/legacy/ --token "$TEST_PYPI_TOKEN"
Automated release: bump version in pyproject.toml and __version__,
add the CHANGELOG.md section, merge to main and push a vX.Y.Z tag. The
Release workflow re-runs CI on the tag, builds, publishes to PyPI (secret
PYPI_API_TOKEN in the pypi environment, or Trusted Publishing) and creates
the GitHub release. An existing tag can be released from Actions → Release →
Run workflow.
See Reflex's publishing prerequisites.
Specifications (SDD)
The project follows Spec-Driven Design. The specs are the primary artifact:
- PRD — the what and the who-for
- API Spec — public Python API (functions, props)
- Technical Design — wrapping pattern and architecture
- Data Model — per-chart data schemas
- Implementation Plan — phases by family
The original code (reference, read-only) lives in reference/rosencharts/.
License and attribution
MIT. This project is a port of rosencharts
by Filsommer (MIT). See LICENSE and NOTICE.
Metadata
Release files for reflex-rosencharts 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| reflex_rosencharts-0.3.0.tar.gz | 81.5 kB | With provenance | Details for reflex_rosencharts-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| reflex_rosencharts-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for reflex_rosencharts-0.3.0-py3-none-any.whl |
Total release size: 298.1 kB
Release files / reflex_rosencharts-0.3.0.tar.gz
| Download URL | reflex_rosencharts-0.3.0.tar.gz |
|---|---|
| Size | 81.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68e89a256e34c20a251bab57bd82b575d4d338c81c165b4eff6f841c8e8ed4c6
|
|
BLAKE2b-256 checksum How to use checksums |
5d56bda9a091e45ba1364b16603c71336cbf6453740740537b0c1fe3a961e2e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logRelease files / reflex_rosencharts-0.3.0-py3-none-any.whl
| Download URL | reflex_rosencharts-0.3.0-py3-none-any.whl |
|---|---|
| Size | 216.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
67a52ddd498fc5773e32c0c57347f8895a47af8e0e86037de117b4e23c35e94c
|
|
BLAKE2b-256 checksum How to use checksums |
605f8c0759602cb3cd7baba4e74a8c0d2109228bacd03ceb164b8bc2fd3319e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logSecurity for reflex-rosencharts 0.3.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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for reflex_rosencharts-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logA 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.