refast-echarts
Refast extension for ECharts
A Refast extension that provides the Echarts component.
Installation
pip install refast-echarts
Usage
Option 1: Auto-Discovery (Recommended)
When you install the package, Refast will automatically discover and load the extension:
from fastapi import FastAPI
from refast import RefastApp, Context
from refast.components import Container
from refast_echarts import ECharts
ui = RefastApp(title="ECharts Demo")
@ui.page("/")
def home(ctx: Context):
option = {
"title": {"text": "Monthly Sales"},
"tooltip": {},
"xAxis": {
"data": ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
},
"yAxis": {},
"series": [
{
"name": "Sales",
"type": "bar",
"data": [120, 200, 150, 80, 70, 110],
}
],
}
return Container(
children=[
ECharts(option=option, height="400px"),
]
)
app = FastAPI()
app.include_router(ui.router)
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)
Option 2: Manual Registration
If you want to disable auto-discovery and register extensions manually:
from refast import RefastApp
from refast_echarts import Echarts, EchartsExtension
ui = RefastApp(
title="Echarts Demo",
auto_discover_extensions=False,
extensions=[EchartsExtension()],
)
Component Props
| Prop | Type | Default | Description |
|---|---|---|---|
option |
dict | {} |
ECharts option configuration object |
theme |
str | dict | None |
Theme name ("light", "dark") or custom theme object |
height |
str | None |
Chart height (e.g. "400px") |
width |
str | None |
Chart width (e.g. "100%") |
auto_resize |
bool | True |
Auto-resize chart when container size changes |
loading |
bool | False |
Show loading animation |
on_click |
Callback | None |
Fired when clicking on a chart element |
on_mouseover |
Callback | None |
Fired when hovering over a chart element |
id |
str | None |
Component ID (required for setOption calls) |
class_name |
str | "" |
CSS classes to apply to the container |
Development
Prerequisites
- Python 3.10+
- Node.js 18+
- npm
Building the Frontend
cd frontend
npm install
npm run build
This builds the UMD bundle to src/refast_echarts/static/.
Installing Locally
# Install with automatic frontend build (via hatch hook)
pip install -e .
# Or build frontend first, then install
cd frontend && npm install && npm run build && cd ..
pip install -e .
Running the Example
python usage.py
Then open http://localhost:8000 in your browser.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for refast-echarts 0.2.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 | |
|---|---|---|---|---|
| refast_echarts-0.2.0.tar.gz | 24.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| refast_echarts-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 421.8 kB
Release files / refast_echarts-0.2.0.tar.gz
| Download URL | refast_echarts-0.2.0.tar.gz |
|---|---|
| Size | 24.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5448e94cdbf0dc9c2c1d4d41d160449791cc87546ebccbaee24b98f096e330a
|
|
BLAKE2b-256 checksum How to use checksums |
005efe54bac4d002057dfc74cec74e5a304d1c59b1df1f148347f034fcfb8dad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / refast_echarts-0.2.0-py3-none-any.whl
| Download URL | refast_echarts-0.2.0-py3-none-any.whl |
|---|---|
| Size | 397.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b53623544bd8ada0cc0961017c0dec0ed76412d709bd30004821f9faa2883fcc
|
|
BLAKE2b-256 checksum How to use checksums |
40802fb61ea8b20fb8d3c455ca39d3708e9b8ef785c2b834f68a233966c428e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for refast-echarts 0.2.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.